Inference
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Respair/Hayate_Translate_FT_EN2JP"
tokenizer = "Qwen/Qwen3-4B-Instruct-2507"
tokenizer = AutoTokenizer.from_pretrained(tokenizer)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
text = (
"Mitochondria produce ATP by coupling electron transport to proton translocation across the inner membrane. "
"As electrons move through the respiratory chain, protons are pumped into the intermembrane space, and ATP synthase harnesses their return flow to phosphorylate ADP."
"The coupling is imperfect: some protons leak back independently, dissipating the gradient as heat."
).replace('\n', ' ').strip()
prompt = "JP->EN: "
messages = [
{"role": "user", "content": prompt + text}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=8192,
do_sample=True,
temperature=0.1, # or whatever
top_p=0.95,
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):].tolist()
content = tokenizer.decode(output_ids, skip_special_tokens=True)
print(content)
# out:
# ใใใณใณใใชใขใฏใๅ
่ใๆใใ ใใญใใณ่ผธ้ใจ้ปๅญ่ผธ้ใใซใใใชใณใฐใใฆATPใ็ฃ็ใใใ
# ๅผๅธ้ใ้ปๅญใ้ใ้็จใงใใใญใใณใ่้่
ใซๆฑฒใฟๅบใใใใใฎๆปใๆตใใๅฉ็จใใฆATPๅๆ้
ต็ด ใADPใใชใณ้
ธๅใใใ
# ใซใใใชใณใฐใฏไธๅฎๅ
จใงใไธ้จใฎใใญใใณใฏ็ฌ็ซใใฆๆปใใๅพ้
ใ็ฑใจใใฆๆฃ้ธใใใ
Details
This is a translation model for English -> Japanese.
for Japanese to English please visit Respair/Hayate_Translate_base_v1.0_JPtoEN
I trained it mainly because I needed something lightweight with a long enough context window for a few personal projects.
these models were trained on roughly 4-7B tokens of high quality data, with a context length of 10k tokens, using a few tricks to source and clean the data.
Japanese is highly contextual in ways English doesn't always encode, but I tried to cover as many topics as possible, from fiction to science and code. it should fare quite well given its smaller size. It is also programming syntax-aware, and will sometimes automatically provide the original technical phrase in parentheses.
Benchmarking
The benchmarking method is a simple LLM as a Judge on ~2400 samples (you can find it in this repo), covering multiple topics.
I used Gemini 3 Pro to judge the naturalness, accuracy and overall flow of the output, comparing it with GPT 5.2 (no reasoning) & CAT Translate.
Gemini prefers this model in the majority of cases.
Only English -> Japanese was assessed.
Note:
- Translation is a one-to-many problem, so this benchmarking method doesn't necessarily determine which model is more accurate.
![]() |
![]() |
- Downloads last month
- 38

