Downloads · 30 days
8
10% of all-time downloads
Hookem22/qwen3-4b-subtitle-es-v3-lora
qwen3-4b-subtitle-es-v3-lora is a translation model from Hookem22. Use it when you need text moved from one language to another. It is set up for peft. The card lists the license as apache-2.0.
QLoRA adapter for Qwen3-4B that performs constrained EN→ES subtitle translation: given a scene of English subtitle lines (12–28 lines, one per line), it outputs exactly one Spanish line per source line — no lines adde…
Downloads · 30 days
8
10% of all-time downloads
All-time downloads
79
Public
Repo size
276 MB
Likes
0
Public
Click a slice to open those files.
.safetensors132 MB · 92%
From the Hugging Face model README
QLoRA adapter for Qwen3-4B that performs constrained EN→ES subtitle translation: given a scene of English subtitle lines (12–28 lines, one per line), it outputs exactly one Spanish line per source line — no lines added, dropped, or merged — with no output line exceeding 42 characters, in a single direct pass (no extended thinking).
Important: load the adapter against
Qwen/Qwen3-4Bas shown below. Thebase_model_name_or_pathinadapter_config.jsonpoints at a 4-bit Unsloth variant (a training-time artifact); loading against that base is not the configuration this model was evaluated in and will fail on machines withoutbitsandbytes.
The evaluated regime is: fp16, greedy decoding, thinking disabled, and the system prompt below verbatim.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
ADAPTER = "Hookem22/qwen3-4b-subtitle-es-v3-lora"
tok = AutoTokenizer.from_pretrained(ADAPTER)
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3-4B", dtype=torch.float16)
model = PeftModel.from_pretrained(base, ADAPTER).eval()
device = ("cuda" if torch.cuda.is_available()
else "mps" if torch.backends.mps.is_available() else "cpu")
model.to(device)
SYSTEM = ("Translate these subtitles from English to Spanish. Output exactly one "
"Spanish line per source line, and keep every line to 42 characters or fewer.")
english_scene = """\
I need the report by Friday.
That's not enough time.
Then ask Marcus for help.""" # normally 12-28 lines
messages = [{"role": "system", "content": SYSTEM},
{"role": "user", "content": english_scene}]
prompt = tok.apply_chat_template(messages, tokenize=False,
add_generation_prompt=True,
enable_thinking=False)
inputs = tok(prompt, return_tensors="pt").to(device)
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=1024, do_sample=False,
pad_token_id=tok.eos_token_id)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:],
skip_special_tokens=True).strip())
Any output can be checked mechanically:
wc -L ≤ 42)