ZombitX64/ThaiChatbotConversation
Viewer • Updated • 10.1k • 50
How to use JonusNattapong/gptoss-mini-thaichat with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="JonusNattapong/gptoss-mini-thaichat") # Load model directly
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained("JonusNattapong/gptoss-mini-thaichat", device_map="auto")How to use JonusNattapong/gptoss-mini-thaichat with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "JonusNattapong/gptoss-mini-thaichat"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "JonusNattapong/gptoss-mini-thaichat",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'docker model run hf.co/JonusNattapong/gptoss-mini-thaichat
How to use JonusNattapong/gptoss-mini-thaichat with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "JonusNattapong/gptoss-mini-thaichat" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "JonusNattapong/gptoss-mini-thaichat",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'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 "JonusNattapong/gptoss-mini-thaichat" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "JonusNattapong/gptoss-mini-thaichat",
"prompt": "Once upon a time,",
"max_tokens": 512,
"temperature": 0.5
}'How to use JonusNattapong/gptoss-mini-thaichat with Docker Model Runner:
docker model run hf.co/JonusNattapong/gptoss-mini-thaichat
GPT-OSS Mini Thai Chat เป็นโมเดลภาษาไทยขนาดเล็กที่พัฒนาขึ้นโดยอ้างอิงสถาปัตยกรรม GPT-OSS และ Mixture of Experts (MoE) ออกแบบมาเพื่อการทดลองและใช้งานบนเครื่องที่มีทรัพยากรจำกัด เช่น Google Colab T4 หรือ GPU ที่มีหน่วยความจำไม่มาก โมเดลนี้ได้รับการฝึกด้วยข้อมูลสนทนาภาษาไทยที่มีลักษณะเป็น instruction, input และ output
| Specification | Value |
|---|---|
| Architecture | GPT-OSS Mini (MoE) |
| Number of Layers | 6 |
| Hidden Size | 768 |
| Attention Heads | 8 |
| Intermediate Size | 3072 (SwiGLU) |
| Mixture of Experts | 4 |
| Top-K Active Experts | 2 |
| Vocabulary Size | 50,000 |
| Maximum Sequence Length | 512 |
| Normalization | RMSNorm |
| Activation Function | SwiGLU |
| Tokenizer | ZombitX64/Hanuman |
pip install transformers accelerate sentencepiece
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("JonusNattapong/gptoss-mini-thaichat", trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained("JonusNattapong/gptoss-mini-thaichat", trust_remote_code=True)
inputs = tokenizer("สวัสดีครับ", return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_length=50,
do_sample=True,
top_p=0.9,
temperature=0.7
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Input: สวัสดีครับ
Output: สวัสดีครับ ยินดีที่ได้สนทนาด้วยครับ ต้องการให้ช่วยเรื่องใดเพิ่มเติมหรือไม่
MIT License