Downloads · 30 days
5
15% of all-time downloads
SaeedAngiz1/shahnameh-qwen3-4b-multilingual-lora
shahnameh-qwen3-4b-multilingual-lora is a text generation model from SaeedAngiz1. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
A LoRA adapter that makes Qwen3-4B-Instruct-2507 answer in Shahnameh-style verse in Persian, English and German.
Downloads · 30 days
5
15% of all-time downloads
All-time downloads
33
Public
Repo size
144 MB
Likes
0
Public
Click a slice to open those files.
.safetensors132 MB · 89%
From the Hugging Face model README
A LoRA adapter that makes Qwen3-4B-Instruct-2507 answer in Shahnameh-style verse in Persian, English and German.
This is the most consistent of the three models: clean script output in all three languages, at the cost of weaker Persian form.
| Persian rhyming couplets | Foreign characters in Persian | |
|---|---|---|
| Training data (target) | 90% | none |
| This model | 33% | none |
| Persian-only sibling | 65% | ~6 per 10 answers |
For the strongest Persian verse, use
SaeedAngiz1/shahnameh-qwen3-4b-fa-lora,
accepting occasional script contamination.
Q: Is it better to speak or to stay silent?
Speak not for words' sake, nor without thought,
Nor when you know not what you say is worth.
For words like arrows fly from hand to hand;
One that falls false may wound a friend, and none.
English is fluent and genuinely verse-like. German is fluent but drifts off-domain.
from unsloth import FastLanguageModel
model, tokenizer = FastLanguageModel.from_pretrained(
"SaeedAngiz1/shahnameh-qwen3-4b-multilingual-lora",
max_seq_length=1024, load_in_4bit=True, dtype=None)
FastLanguageModel.for_inference(model)
messages = [
{"role": "system", "content": "You are a poet who answers in the voice of Ferdowsi's Shahnameh, in English verse."},
{"role": "user", "content": "Who was Rostam?"},
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
ids = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to("cuda")
out = model.generate(**ids, max_new_tokens=256, do_sample=True,
temperature=0.7, top_p=0.8, top_k=20,
pad_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(out[0][ids["input_ids"].shape[1]:], skip_special_tokens=True))
Qwen3-4B-Instruct-2507 (4-bit) · LoRA r=16, lora_alpha=16 · lr 2e-4 · 3 epochs ·
270 examples across fa/en/de · response-only loss · 2× Tesla T4 · 411 seconds.
Best validation loss 2.553.
temperature=0.7. Judge on averages, not favourites.Trained on Kaggle's free tier: 2× NVIDIA Tesla T4. Total compute for the whole project is under three hours. Full method, measurements, charts, and a documented record of four separate failures: https://github.com/SaeedAngiz1/shahnameh-slm
Ferdowsi's Shahnameh (completed 1010 CE). The training verse is newly written in his style — it is not his text.