Downloads · 30 days
0
NaelShichida/qwen2.5-7b-manga-translator-full
qwen2.5-7b-manga-translator-full is a translation model from NaelShichida. Use it when you need text moved from one language to another. It is set up for transformers.
This repository hosts a production-grade LoRA (Low-Rank Adaptation) adapter fine-tuned on top of Qwen2.5-7B-Instruct. The model is highly optimized for localized, context-aware translation of Japanese manga, anime, an…
Downloads · 30 days
0
Access
Public
Updated Jul 20, 2026
Repo size
162 MB
Likes
1
Public
Click a slice to open those files.
.safetensors162 MB · 100%
From the Hugging Face model README
This repository hosts a production-grade LoRA (Low-Rank Adaptation) adapter fine-tuned on top of Qwen2.5-7B-Instruct. The model is highly optimized for localized, context-aware translation of Japanese manga, anime, and colloquial dialogue into English, matching specific character archetypes while eliminating generic conversational assistant behaviors.
Standard large language models struggle with manga translation because colloquial Japanese relies heavily on implicit context, sentence fragments, omission of pronouns, and intense cultural tropes. When forced to translate, they frequently break character, add conversational preambles (e.g., "Here is the translation..."), or fall back to dry, literal dictionary definitions.
This model solves those challenges by learning to map input text directly to specific character tones. It was trained using a custom-engineered synthetic dataset containing diverse character archetypes (e.g., Yakuza slang, polite but sinister villains, excited teenagers, formal keigo, and stoic samurai).
This model is designed to be integrated directly into manga scanlation workflows, video game localization pipelines, or fan-translation web applications. It accepts raw, colloquial Japanese text along with an archetype instruction and outputs a highly contextual English localization.
The model was trained on 1,120 high-quality rows of stylistically varied Japanese-English dialogue pairs.
Rather than relying on noisy web-scraped text, the training data was engineered programmatically using synthgen, an asynchronous synthetic data generation engine built with Python, uv, and Docker. The data pipeline mapped 224 core Japanese seed phrases into 12 distinct character archetypes via a Teacher LLM (GPT-4o/Claude) using complex system prompt engineering and structured JSON verification.
transformers==4.51.3, peft, trl==0.12.2, and bitsandbytes.nf4) quantization using BitsAndBytesConfig combined with bfloat16 compute precision to maximize throughput within memory constraints.paged_adamw_32bit["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]The production model was evaluated against the bare baseline model on out-of-distribution dialogue prompts.
| Input Japanese Dialogue | Bare Qwen2.5-7B Baseline | Manga-Tuned Model (This Adapter) |
|---|---|---|
| おい、何見てんだよ。ぶち殺すぞ。 (Yakuza Slang) | "Hey, what are you looking at. I'm going to kill you." <br><br>This is a rough translation of the yakuza slang... | Hey, what are you looking at? I’m gonna kill you. |
| おやおや、まだ抗うつもりですか?無駄なことはおやめなさい。 (Sinister Villain) | Here's the translation... <br><br>"Oh, oh. Do you still intend to resist? Please stop wasting your time." | Oh my, do you still intend to resist? Please, cease this futile endeavor. |
| マジかよ!これ超ヤバいじゃん!テンション上がるわー! (Excited Teenager) | Maji ka yo!... <br><br>"Really? This is so intense! My excitement is skyrocketing!" | No way! This is seriously bad! It gets me pumped up! |
Use the code below to hot-load this LoRA adapter into a quantized instance of Qwen2.5-7B using peft and transformers:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig
from peft import PeftModel
model_id = "Qwen/Qwen2.5-7B-Instruct"
lora_id = "NaelShichida/qwen2.5-7b-manga-translator-full"
# 1. Configure 4-bit loading
bnb_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_compute_dtype=torch.bfloat16
)
# 2. Load Tokenizer and Base Architecture
tokenizer = AutoTokenizer.from_pretrained(model_id)
base_model = AutoModelForCausalLM.from_pretrained(
model_id,
quantization_config=bnb_config,
device_map="auto"
)
# 3. Hot-load the LoRA Adapter
model = PeftModel.from_pretrained(base_model, lora_id)
model.eval()
# 4. Run Template-Compliant Inference
def translate_manga(text, context):
prompt = f"<|im_start|>user\nTranslate this manga dialogue into English. Context: {context}\n\nInput: {text}<|im_end|>\n<|im_start|>assistant\n"
inputs = tokenizer(prompt, return_tensors="pt").to("cuda")
with torch.no_grad():
outputs = model.generate(**inputs, max_new_tokens=64, eos_token_id=tokenizer.eos_token_id)
# Slice out input tokens to print only model generation
generated_text = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
return generated_text