Today we will show you for translate Thai language on AI style, you can using tools for create script such as https://colab.research.google.com/ or https://www.kaggle.com/
Step 1 : Install python program transformers and torch
!pip install transformers
!pip install torch

Step 2 : Call transformers and torch then import pipeline
from transformers import pipeline
import torch

Step 3 :
You’re creating a translation pipeline using the 🤗 Hugging Face transformers
library.
pipeline("translation", ...)
- This creates a pipeline for machine translation — i.e., it translates text from one language to another.
- The
pipeline
function abstracts away the complexity of tokenization, model loading, and inference. Super convenient!
model="facebook/nllb-200-distilled-600M"
- This specifies the model to use.
facebook/nllb-200-distilled-600M
is a multilingual translation model by Meta AI.- NLLB stands for No Language Left Behind.
- It supports 200+ languages.
- The “distilled” version is smaller and faster, good for efficiency.
- “600M” means it has 600 million parameters.
torch_dtype=torch.bfloat16
- This sets the model to use the bfloat16 data type.
bfloat16
(Brain Float 16) is a reduced-precision format that’s faster and uses less memory — common in modern GPUs like TPUs or newer NVIDIA cards.- Only works well if your hardware supports it.
translator = pipeline("translation",
model="facebook/nllb-200-distilled-600M",
torch_dtype=torch.bfloat16)
Step 4 : Create text for translate to Thai language
text = """
The little boy walked to the park with his dog on a sunny afternoon."""

Step 5 : create text_translated for translate English to Thai
text_translated = translator(text,
src_lang="eng_Latn",
tgt_lang="tha_Thai")
You can visit link for other language : https://github.com/facebookresearch/flores/blob/main/flores200/README.md

Step 6 : Call text_translated

Can you copy coding on link below : Thank you.
https://colab.research.google.com/drive/1-000q5TWkLyaQwmWxTcgO3O71jjOomtR?usp=sharing