Views
No views yet
Translate the following text into Thai. or
Translate the following text into English.

1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4model_id = "scb10x/Typhoon-translate-4b"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto",
11)
12
13# Translate English to Thai
14
15messages = [
16 {"role": "system", "content": "Translate the following text into Thai."},
17 {"role": "user", "content": "A banished celestial, Serai, cursed to walk as a mortal boy, fights against the Empire that slaughtered the skyborn.\nHe trains with humans, bonds with them, bleeds beside them. In secret, he regrows his wings through combat—but each feather only returns when he loses someone he loves.\nAt the climax, he ascends—glorious, radiant, unstoppable—only to find his friends gone, their memories etched into his wings.\nAs he watches the sun rise, his halo returns.\nHe whispers, “Was it worth it?”\nAnd no one answers."},
18]
19
20# Translate Thai to English
21
22# messages = [
23# {"role": "system", "content": "Translate the following text into English."},
24# {"role": "user", "content": "เมื่อสิ้นปี 2022 การเปิดตัว ChatGPT ของ OpenAI ถือเป็นจุดเปลี่ยนสำคัญ—โลกได้รู้จักกับ Generative AI (Gen AI) และทุกอย่างก็เปลี่ยนไป สิ่งที่เคยรู้สึกเหมือน frontier ไกลๆ กลายเป็นพลังในปัจจุบัน AI ถูกฝังตัวอย่างรวดเร็วทั้งในกิจวัตรส่วนตัวและกลยุทธ์องค์กร กลายเป็นตัวเปลี่ยนเกมอันทรงพลัง—ช่วยยกระดับชีวิต ปลดล็อกประสิทธิภาพใหม่ๆ และเปลี่ยนวิธีที่องค์กรดำเนินงาน ในการแสวงหาความได้เปรียบเชิงแข่งขัน ธุรกิจในหลากหลายภาคส่วนต่างเร่งทำความเข้าใจ นำไปใช้ และสร้างนวัตกรรมด้วย AI\nSCBX AI Outlook 2025: Beaconing the Future of Artificial Intelligence ถูกออกแบบมาเป็นประภาคารท่ามกลางคลื่นที่เร่งตัวขึ้นนี้—มอบความชัดเจนและทิศทางให้ผู้นำรับมือกับกระแสการเปลี่ยนแปลงทางเทคโนโลยี รายงานนี้สำรวจแนวโน้ม AI ที่กำลังกำหนดทิศทางในปีข้างหน้า และนำเสนอมุมมองเชิงกลยุทธ์ในการเปลี่ยนความไม่แน่นอนให้เป็นโอกาส รายงานแบ่งออกเป็นสี่ส่วน (Acts) แต่ละส่วนเน้นพลังสำคัญที่กำลังเปลี่ยนภูมิทัศน์ AI:\nACT I: Two Philosophies, One Future. The Battle Between Open-Source and Closed-Source AI Intensifies\nACT II: Tiny Titans - Small, but Mighty. More Versatile, Smaller, and Smarter: 3 Trends of the Next AI Evolution\nACT III: AI at Your Fingertips. Agentic AI: Rise of the Agents\nACT IV: Not Quite Human, But Almost There. Artificial General Intelligence (AGI) and the Unresolved Path to Human-Level AI\nรายงานปิดท้ายด้วย EPILOGUE: The AI Storm – Infinite Impact พร้อม Case Studies จากภายในดวงตาของพายุไต้ฝุ่น—นำเสนอกรณีศึกษาจริงจาก SCBX ในการใช้ AI Engine “Typhoon” ของกลุ่มในหน่วยธุรกิจต่างๆ ขณะที่กระแส AI กำลังก้าวไปข้างหน้า รายงานนี้จึงไม่ได้เป็นเพียงการคาดการณ์ แต่เป็นประภาคารเชิงกลยุทธ์สำหรับผู้พร้อมจะก้าวขึ้นไปกับคลื่นและเป็นผู้นำในอนาคต"},
25# ]
26
27input_ids = tokenizer.apply_chat_template(
28 messages,
29 add_generation_prompt=True,
30 return_tensors="pt",
31).to(model.device)
32
33outputs = model.generate(
34 input_ids,
35 max_new_tokens=8192,
36 temperature=0.2,
37)
38response = outputs[0][input_ids.shape[-1]:]
39print(tokenizer.decode(response, skip_special_tokens=True))Translate the following text into Thai.Translate the following text into English.{system_prompt}\n\n{text_to_translate}Translate the following text into Thai.\n\nA banished celestial, Serai, cursed to walk as a mortal boy, fights against the Empire that slaughtered the skyborn.\nHe trains with humans, bonds with them, bleeds beside them. In secret, he regrows his wings through combat—but each feather only returns when he loses someone he loves.\nAt the climax, he ascends—glorious, radiant, unstoppable—only to find his friends gone, their memories etched into his wings.\nAs he watches the sun rise, his halo returns.\nHe whispers, “Was it worth it?”\nAnd no one answers.python3 -m sglang.launch_server scb10x/typhoon-translate-4b --context-length 16000 --dtype bfloat16vllm serve scb10x/typhoon-translate-4b --max-model-len 16000 --dtype bfloat16Translate the following text into Thai. for English to Thai translation and Translate the following text into English. for Thai to English translation.@misc{typhoon2,
title={Typhoon 2: A Family of Open Text and Multimodal Thai Large Language Models},
author={Kunat Pipatanakul and Potsawee Manakul and Natapong Nitarach and Warit Sirichotedumrong and Surapon Nonesung and Teetouch Jaknamon and Parinthapat Pengpun and Pittawat Taveekitworachai and Adisai Na-Thalang and Sittipong Sripaisarnmongkol and Krisanapong Jirayoot and Kasima Tharnpipitchai},
year={2024},
eprint={2412.13702},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2412.13702},
}