Loading…
Loading…
A dialogue fine-tune of classical-smollm2-trunk, a 125M-parameter model trained from scratch only on texts written before 1868. It was fine-tuned on real conversations from classical and Edo-period texts, so it answers in premodern Japanese with replies such as 「いとかしこし」 or 「おかへりなされませ」.
This is an early research checkpoint. It has learned the turn-taking format and to stop after a short reply, but its replies are formulaic and often don't really answer the question.
The model was trained with this plain-text format; BOS is added by the tokenizer:
<s>user:
{your message}assistant:
{model reply}</s>
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "kuramot6f/classical-smollm2-sft"
tok = AutoTokenizer.from_pretrained(repo, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(repo, torch_dtype=torch.bfloat16).eval()
prompt = "user:\nいづこへ行く" + "assistant:\n"
inputs = tok(prompt, return_tensors="pt") # prepends <s>
out = model.generate(**inputs, max_new_tokens=96, do_sample=True, temperature=0.8, top_p=0.95,
eos_token_id=tok.eos_token_id, pad_token_id=tok.pad_token_id)
print(tok.decode(out[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
For multi-turn chat, append assistant:\n{reply}</s> after each reply, then user:\n{next message}assistant:\n.
The separators are listed in chat_format.json.
extraction_confidence >= 2 and context_dependence <= 1. That gives 1,426 training scenes
from 234 works and 56 validation scenes. The first speaker in a scene becomes user and the other becomes assistant; consecutive turns by the same speaker are merged.| update | validation NLL (assistant tokens) |
|---|---|
| 0 (base) | 4.570 |
| 45 | 4.322 |
| 90 (this model) | 4.302 |
| 180 | 4.334 |
| 270 | 4.351 |
SUMMARY.md has the full training report (in Japanese).Weights and code: Apache-2.0. The fine-tuning data is CC BY-SA 4.0. The base model's training data also includes public-domain and CC BY-NC-SA 3.0 TW (CBETA) texts; see classical-smollm2-trunk.
kuramot6f/classical-smollm2-trunk