2.7 KiB
base_model, tags, license, language
| base_model | tags | license | language | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| manotham/Thai-dialogue-transalate_sft_80K |
|
apache-2.0 |
|
Emotion-Conditioned English-to-Thai Translator (Warm-up SFT)
- Developed by: manotham
- License: apache-2.0
- Base Model:
manotham/Thai-dialogue-transalate_sft_80K - Architecture: Qwen3
This model is an experimental fine-tune aimed at adding Emotion-Conditioned Translation capabilities to the base English-to-Thai translation model. By specifying an emotion tag in the prompt, the model adjusts its vocabulary, tone, and sentence structure to match the requested emotional context.
This model was trained 2x faster with Unsloth and Huggingface's TRL library.
🎯 Supported Emotion Labels
The model has been explicitly trained to recognize and adapt to the following 11 emotion tags:
anger, contempt, disgust, fear, frustration, gratitude, joy, love, neutral, sadness, surprise
💻 Usage / Prompt Format
This model uses the ChatML template. To trigger the emotion-conditional translation, include the [Emotion: <label>] tag in your instruction. We recommend using apply_chat_template from the transformers library for the best results.
Python Inference Example
from transformers import AutoTokenizer, AutoModelForCausalLM
model_name = "manotham/Thai-dialogue-transalate_emotion"
# 1. Load the model and tokenizer
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")
# 2. Prepare the instruction with the desired emotion
instruction = "Translate this English sentence into natural Thai. [Emotion: sadness]\nI worked so hard on preparing for that exam, but the score was far below what I expected."
messages = [
{"role": "user", "content": instruction},
]
# 3. Apply chat template automatically
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
# 4. Generate output
outputs = model.generate(**inputs, max_new_tokens=128)
# 5. Decode and print only the generated response
response = tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:], skip_special_tokens=True)
print(response)
# Expected Output: ฉันพยายามอย่างหนักเพื่อเตรียมตัวสอบแต่ผลลัพธ์กลับต่ำกว่าที่คาดไว้มาก
