Views
No views yet
safetensors weights for Qwen3-Izy-Translate-EN-TH-0.6B, a highly efficient, lightweight model fine-tuned for bidirectional English and Thai translation.unsloth/qwen3-0.6b-unsloth-bnb-4bitsafetensors1Translate the following English text to Thai.
2### English:
3[Your English text here]
41Translate the following Thai text to English.
2### Thai:
3[Your Thai text here]
41from transformers import AutoModelForCausalLM, AutoTokenizer
2
3# Replace with your actual Hugging Face repo path if it differs
4model_name = "izyya/Qwen3-Izy-Translate-EN-TH-0.6B"
5
6# Load the tokenizer and the model
7tokenizer = AutoTokenizer.from_pretrained(model_name)
8model = AutoModelForCausalLM.from_pretrained(
9 model_name,
10 torch_dtype="auto",
11 device_map="auto"
12)
13
14# Prepare the translation snippet input
15prompt = """
16Translate the following English text to Thai.
17
18### English:
19But friends, I am so gay, that if I had a wife, I would encourage her to cheat on me.
20"""
21
22messages = [
23 {"role": "user", "content": prompt}
24]
25
26text = tokenizer.apply_chat_template(
27 messages,
28 tokenize=False,
29 add_generation_prompt=True
30)
31
32model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
33
34# Conduct text completion
35generated_ids = model.generate(
36 **model_inputs,
37 max_new_tokens=512
38)
39
40output_ids = generated_ids[0][len(model_inputs.input_ids[0]):]
41content = tokenizer.decode(output_ids, skip_special_tokens=True).strip("\n")
42
43print("content:", content)
44