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
Safetensors
Model size
4B params
Tensor type
BF16
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support