This LoRA adapter for Mistral-7B-Instruct-v0.3 classifies a Farsi theatrical dialogue as negative, neutral or positive. It was trained on the PlayDial-Fa train split (1,867 dialogues) of TalkFa, a human-verified benchmark for Farsi dialogue generation and understanding, released with the paper TalkFa: A Unified Benchmark for Farsi Dialogue Generation and Understanding.
PlayDial-Fa test set (104 dialogues). A reply counts as correct when it names exactly the gold label.
| Metric (macro) | Base | TalkFa LoRA | Δ |
|---|---|---|---|
| Precision | 0.56 | 0.60 | +0.04 |
| Recall | 0.08 | 0.58 | +0.50 |
| F1 | 0.13 | 0.57 | +0.44 |
import torch
from datasets import load_dataset
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer
base_id = "mistralai/Mistral-7B-Instruct-v0.3"
adapter_id = "Kamyar-zeinalipour/TalkFa-Sentiment-Mistral-7B-Instruct-v0.3-LoRA"
tokenizer = AutoTokenizer.from_pretrained(base_id)
model = AutoModelForCausalLM.from_pretrained(base_id, torch_dtype=torch.bfloat16, device_map="auto")
model = PeftModel.from_pretrained(model, adapter_id).merge_and_unload()
item = load_dataset("Kamyar-zeinalipour/TalkFa", "playdial_fa", split="test")[0]
messages = [{"role": x["role"], "content": x["content"]} for x in item["messages"][:-1]]
chat = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(chat, return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=1024, do_sample=True, temperature=0.3, top_p=0.8, top_k=50, repetition_penalty=1.1)
print(tokenizer.decode(output[0, inputs["input_ids"].shape[1]:], skip_special_tokens=True))
The base model is gated: accept its terms on its page and run
huggingface-cli login. Training settings are in configs/train_sentiment.json; inference and
evaluation code is in the GitHub repository.
@misc{jamshidi2026talkfa,
title = {TalkFa: A Unified Benchmark for Farsi Dialogue Generation and Understanding},
author = {Neda Jamshidi and Kamyar Zeinalipour and Fahimeh Akbari and Monica Bianchini and Marco Maggini and Marco Gori},
year = {2026},
eprint = {2609.01810},
archivePrefix = {arXiv},
primaryClass = {cs.CL},
url = {https://arxiv.org/abs/2609.01810}
}
Derivative of Mistral-7B-Instruct-v0.3, released under the base model's license
(apache-2.0). TalkFa data: CC BY-NC-SA 4.0. Code: Apache-2.0.
mistralai/Mistral-7B-Instruct-v0.3