Views
No views yet
tokenizer.json) has been rebuilt from the repository's SentencePiece vocabulary and uploaded to the model repo on the Hugging Face Hub so AutoTokenizer.from_pretrained will download the canonical tokenizer matching the model's vocab_size (1000).trust_remote_code=True in our test environment — see "How to use" below for recommended usage.| Key | Value |
|---|---|
| vocab_size | 1000 |
| block_size | 128 |
| n_layer | 6 |
| n_head | 8 |
| n_embd | 512 |
| parameter_count | 20004864 |
Input: 'แม่อย่าคิดมาก' (Mom, don't think too much)
Words: ['แม่', 'อย่า', 'คิด', 'มาก']
Tokens: ['▁แม่', '▁อย่า', '▁คิด', '▁มาก'] (4 tokens - word-level)tokenizer.json on the Hub. The recommended, simplest way to load the tokenizer and model is using the standard Transformers Auto APIs. In our smoke tests the Auto classes load correctly without requiring trust_remote_code=True.1from transformers import AutoTokenizer, AutoModelForCausalLM
2
3# Loads the canonical tokenizer.json from the Hub and the model implementation
4tokenizer = AutoTokenizer.from_pretrained('JonusNattapong/wilai-2.0')
5model = AutoModelForCausalLM.from_pretrained('JonusNattapong/wilai-2.0')
6
7text = 'สวัสดีครับ นี่คือการทดสอบ'
8inputs = tokenizer(text, return_tensors='pt')
9outputs = model.generate(**inputs, max_new_tokens=50, do_sample=True, temperature=0.8)
10print(tokenizer.batch_decode(outputs, skip_special_tokens=True))wilai_transformers.WilaiTokenizer.from_pretrained(...) and use it to pre-process text before calling the standard model.python test_auto_apis.py1from transformers import AutoModelForCausalLM
2from wilai_transformers import WilaiTokenizer
3
4# Load model with standard Transformers
5model = AutoModelForCausalLM.from_pretrained('JonusNattapong/wilai-2.0')
6
7# Load tokenizer separately using custom class
8tokenizer = WilaiTokenizer.from_pretrained('JonusNattapong/wilai-2.0')
9
10# Generate text
11input_text = 'สวัสดีครับ'
12tokens = tokenizer.encode(input_text, add_special_tokens=True)
13outputs = model.generate([tokens], max_length=50, do_sample=True, temperature=0.8)
14generated_text = tokenizer.decode(outputs[0])
15print(generated_text)1from huggingface_hub import hf_hub_download
2from src.inference import ThaiTextGenerator, GenerationConfig
3
4# Download model artifacts
5model_path = hf_hub_download(repo_id='JonusNattapong/wilai-2.0', filename='pytorch_model.bin')
6config_path = hf_hub_download(repo_id='JonusNattapong/wilai-2.0', filename='config.json')
7tokenizer_path = hf_hub_download(repo_id='JonusNattapong/wilai-2.0', filename='thai_sp.model')
8
9# Load model
10generator = ThaiTextGenerator.from_pretrained(model_path, config_path, tokenizer_path)
11generated = generator.generate('สวัสดี', config=GenerationConfig(max_tokens=20))
12print(generated)1@misc{wilai,
2 title={Wilai-2.0: A Thai Language Model},
3 author={Nattapong Tapachoom},
4 year={2025},
5 url={https://huggingface.co/JonusNattapong/wilai-2.0}
6}