Views
No views yet
1{
2 "sentence": "私は毎日日本語を勉強しています。",
3 "furigana": "私は毎日(まいにち)日本語(にほんご)を勉強(べんきょう)しています。",
4 "translation": "I'm studying Japanese every day.",
5 "vocab": [
6 {"kanji": "毎日", "kana": "まいにち", "translation": "every day"},
7 {"kanji": "日本語", "kana": "にほんご", "translation": "Japanese language"}
8 ]
9}| Revision | Weights | Size | Notes |
|---|---|---|---|
main | bfloat16 | ~1.5 GB | Full precision weights (default) |
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4repo = "tuhen/cat-translate-learner-edition-0.8b"
5tok = AutoTokenizer.from_pretrained(repo)
6model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.bfloat16,
7 device_map="cuda")
8
9PROMPT = ("Given a Japanese sentence, return a JSON object with the keys "
10 '"sentence", "furigana", "translation", and "vocab" as described '
11 "in the training examples.\n\n ")
12msgs = [{"role": "user", "content": PROMPT + "猫がソファの上で寝ている。"}]
13ids = tok.apply_chat_template(msgs, add_generation_prompt=True,
14 tokenize=True, return_dict=False)
15out = model.generate(torch.tensor([ids], device="cuda"),
16 max_new_tokens=512, do_sample=False,
17 pad_token_id=tok.pad_token_id)
18print(tok.decode(out[0, len(ids):], skip_special_tokens=True))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.config.json
model.safetensors # bf16 weights
tokenizer.json # fixed multi-char Unigram tokenizer
chat_template.jinja
demo.py # inference demo
README.md