Files

197 lines
4.3 KiB
Markdown
Raw Permalink Normal View History

---
language:
- en
- th
license: apache-2.0
pipeline_tag: translation
tags:
- translation
- thai
- english
- gemma-3
- typhoon
- machine-translation
- bilingual
- sft
base_model: typhoon-ai/typhoon2.1-gemma3-4b
---
# 🇹🇭🇺🇸 Typhoon 2.1 Gemma 3 KordTranslate EN-TH 4B
<p align="center">
<img src="https://i.ibb.co/q3H1WPgj/logo.png" width="220" alt="KordTranslate Logo">
</p>
**Typhoon 2.1 Gemma 3 KordTranslate EN-TH 4B** is a bilingual English ↔ Thai translation model fine-tuned from **`typhoon-ai/typhoon2.1-gemma3-4b`** for high-quality machine translation between Thai and English.
The model is instruction-tuned specifically for translation tasks using bilingual translation datasets while preserving the strong language understanding inherited from the Typhoon base model.
---
# ✨ Features
- 🇺🇸 English → Thai translation
- 🇹🇭 Thai → English translation
- Instruction-tuned for translation
- Built on **Typhoon2.1 Gemma 3 4B**
- Lightweight and suitable for local inference
---
| Item | Value |
|------|-------|
| Model | `KordAI/Typhoon-Gemma3-KordTranslate-EN-TH-4B` |
| Base Model | `typhoon-ai/typhoon2.1-gemma3-4b` |
| Architecture | Gemma 3 (4B) |
| Task | Machine Translation |
| Languages | English, Thai |
| Fine-tuning | Supervised Fine-Tuning (SFT) |
---
This model is optimized for:
- English → Thai translation
- Thai → English translation
- Localization
- Educational applications
- Chatbot translation
- API integration
- Batch document translation
For the best performance, use the prompt templates below.
---
# 📝 Prompt Templates
For optimal translation quality, structure your inputs exactly as shown below depending on the translation direction.
## English → Thai
```text
Translate the following English text to Thai.
### English:
[Your English text here]
```
## Thai → English
```text
Translate the following Thai text to English.
### Thai:
[Your Thai text here]
```
---
# 🐍 Inference Code (Python / Transformers)
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
# Hugging Face repository
model_name = "KordAI/Typhoon-Gemma3-KordTranslate-EN-TH-4B"
# Load tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
prompt = """
Translate the following English text to Thai.
### English:
But friends, I am so gay, that if I had a wife, I would encourage her to cheat on me.
"""
messages = [
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):]
translation = tokenizer.decode(
output_ids,
skip_special_tokens=True
).strip()
print(translation)
```
---
# 🏋️ Training
This model is fine-tuned from **`typhoon-ai/typhoon2.1-gemma3-4b`** using supervised instruction tuning on bilingual English–Thai translation datasets.
The model is trained to perform direct translation between:
- 🇺🇸 English → Thai
- 🇹🇭 Thai → English
while maintaining natural, fluent, and context-aware outputs.
---
# ⚠️ Limitations
- Translation quality may decrease on highly specialized domains such as medical, legal, or scientific texts.
- Proper nouns and newly coined terminology may require manual verification.
- The model may occasionally hallucinate or paraphrase ambiguous inputs.
- Human review is recommended for production-critical translations.
---
Special thanks to:
- **Typhoon AI** for the excellent **`typhoon2.1-gemma3-4b`** base model.
- **KordAI** for developing and fine-tuning the translation model.
- **Unsloth** for enabling efficient supervised fine-tuning.
- **llama.cpp** for the GGUF format and inference ecosystem.
- The open-source AI community for advancing multilingual language models.
---
# 📖 Citation
```bibtex
@misc{kordtranslate2026,
title={Typhoon Gemma3 KordTranslate EN-TH 4B},
author={KordAI},
year={2026},
publisher={Hugging Face},
howpublished={https://huggingface.co/KordAI/Typhoon-Gemma3-KordTranslate-EN-TH-4B}
}
```