Text Generation
Transformers
Safetensors
English
qwen3
text-generation-inference
unsloth
conversational
Instructions to use KordAI/ThaiLLM-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use KordAI/ThaiLLM-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="KordAI/ThaiLLM-8B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("KordAI/ThaiLLM-8B") model = AutoModelForCausalLM.from_pretrained("KordAI/ThaiLLM-8B", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use KordAI/ThaiLLM-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "KordAI/ThaiLLM-8B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KordAI/ThaiLLM-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/KordAI/ThaiLLM-8B
- SGLang
How to use KordAI/ThaiLLM-8B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "KordAI/ThaiLLM-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KordAI/ThaiLLM-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "KordAI/ThaiLLM-8B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "KordAI/ThaiLLM-8B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use KordAI/ThaiLLM-8B with Docker Model Runner:
docker model run hf.co/KordAI/ThaiLLM-8B
KordAI/ThaiLLM-8B
KordAI/ThaiLLM-8B is an 8B-parameter large language model with strong Thai language capabilities.
Usage
Transformers
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
model_id = "KordAI/ThaiLLM-8B"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto",
)
messages = [
{
"role": "user",
"content": "อธิบายให้หน่อยว่าทำไมท้องฟ้าถึงเป็นสีฟ้า",
}
]
inputs = tokenizer.apply_chat_template(
messages,
tokenize=True,
add_generation_prompt=True,
return_tensors="pt",
).to(model.device)
with torch.no_grad():
outputs = model.generate(
inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True,
)
response = tokenizer.decode(
outputs[0][inputs.shape[-1]:],
skip_special_tokens=True,
)
print(response)
Chat Template
For chat/instruction use, pass messages in the standard format:
messages = [
{
"role": "system",
"content": "คุณคือผู้ช่วยที่ตอบคำถามอย่างกระชับและถูกต้อง",
},
{
"role": "user",
"content": "ประเทศไทยมีเมืองหลวงชื่ออะไร?",
},
]
prompt = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
print(prompt)
Inference
For deterministic generation:
outputs = model.generate(
inputs,
max_new_tokens=256,
do_sample=False,
)
For sampling:
outputs = model.generate(
inputs,
max_new_tokens=512,
temperature=0.7,
top_p=0.9,
do_sample=True,
)
Model Details
- Model:
KordAI/ThaiLLM-8B - Parameters: 8B
- Type: Causal Language Model
- Primary strength: Thai language understanding and generation
Notes
The model may occasionally produce incorrect or unsupported information. Verify outputs for factual or high-stakes use cases.
Citation
@misc{kordai_thaillm_8b,
title = {KordAI/ThaiLLM-8B},
author = {KordAI},
year = {2026},
url = {https://huggingface.co/KordAI/ThaiLLM-8B}
}
- Downloads last month
- 539
Model tree for KordAI/ThaiLLM-8B
Base model
ThaiLLM/ThaiLLM-8B