CAT-Translate Learner Edition (0.8b)
A Japanese → English translation model that returns structured JSON with furigana (reading aids) and vocabulary lookups — built for language learners. This is a fine-tune of cyberagent/CAT-Translate-0.8b.
Given a Japanese sentence, the model produces a JSON object like:
{
"sentence": "私は毎日日本語を勉強しています。",
"furigana": "私は毎日(まいにち)日本語(にほんご)を勉強(べんきょう)しています。",
"translation": "I'm studying Japanese every day.",
"vocab": [
{"kanji": "毎日", "kana": "まいにち", "translation": "every day"},
{"kanji": "日本語", "kana": "にほんご", "translation": "Japanese language"}
]
}
Model
Full-precision bfloat16 weights (the compact 0.8B variant of the family — see also the 1.4b learner edition).
| Revision | Weights | Size | Notes |
|---|---|---|---|
main | bfloat16 | ~1.5 GB | Full precision weights (default) |
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
repo = "tuhen/cat-translate-learner-edition-0.8b"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.bfloat16,
device_map="cuda")
PROMPT = ("Given a Japanese sentence, return a JSON object with the keys "
'"sentence", "furigana", "translation", and "vocab" as described '
"in the training examples.\n\n ")
msgs = [{"role": "user", "content": PROMPT + "猫がソファの上で寝ている。"}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True,
tokenize=True, return_dict=False)
out = model.generate(torch.tensor([ids], device="cuda"),
max_new_tokens=512, do_sample=False,
pad_token_id=tok.pad_token_id)
print(tok.decode(out[0, len(ids):], skip_special_tokens=True))
What changed vs the base model
The base model's tokenizer was replaced with a fixed multi-char Unigram
tokenizer (real scores injected, PreTrainedTokenizerFast), and the model
was fine-tuned on a curated learner corpus of Japanese sentences annotated
with furigana, translations and vocabulary. Recipe: 2 epochs, learning rate
2e-5, FSDP (bf16), validated on the same chat format used at inference.
Files
config.json
model.safetensors # bf16 weights
tokenizer.json # fixed multi-char Unigram tokenizer
chat_template.jinja
demo.py # inference demo
README.md