Files
ModelHub XC 8dc0b4b55b 初始化项目,由ModelHub XC社区提供模型
Model: izyya/Qwen3-Izy-Translate-EN-TH-0.6B
Source: Original Platform
2026-10-13 01:08:19 +08:00

113 lines
2.7 KiB
Markdown

---
base_model: unsloth/qwen3-0.6b-unsloth-bnb-4bit
tags:
- text-generation-inference
- transformers
- unsloth
- qwen3
- translation
- en-th
- safetensors
license: apache-2.0
language:
- en
- th
pipeline_tag: translation
---
# Qwen3-Izy-Translate-EN-TH-0.6B
This repository contains the `safetensors` weights for **Qwen3-Izy-Translate-EN-TH-0.6B**, a highly efficient, lightweight model fine-tuned for bidirectional English and Thai translation.
The model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Hugging Face's TRL library.
---
## 🚀 Model Details
- **Developed by:** [izyya](https://huggingface.co/izyya)
- **License:** Apache-2.0
- **Base Model:** `unsloth/qwen3-0.6b-unsloth-bnb-4bit`
- **Supported Languages:** English (EN) and Thai (TH)
- **Format:** Hugging Face `safetensors`
---
## 📝 Prompt Templates
For optimal translation quality, structure your inputs exactly as shown below depending on the translation direction.
### English to Thai
```text
Translate the following English text to Thai.
### English:
[Your English text here]
```
### Thai to English
```text
Translate the following Thai text to English.
### Thai:
[Your Thai text here]
```
---
## 🐍 Inference Code (Python / Transformers)
This snippet demonstrates how to load the model, pipe your translation prompt into it, and cleanly extract the output text.
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
# Replace with your actual Hugging Face repo path if it differs
model_name = "izyya/Qwen3-Izy-Translate-EN-TH-0.6B"
# Load the tokenizer and the model
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
# Prepare the translation snippet input
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)
# Conduct text completion
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
output_ids = generated_ids[0][len(model_inputs.input_ids[0]):]
content = tokenizer.decode(output_ids, skip_special_tokens=True).strip("\n")
print("content:", content)
```
---
## ⚡ Acknowledgments
* Super-accelerated and fine-tuned with ❤️ by [Unsloth](https://github.com/unslothai/unsloth).