🤖 Thai 0.1B Chatbot (Pure Chat & SafeTensors Edition)

The Pure Thai Chatbot and SafeTensors release of the Thai 0.1B Small Language Model (~108M parameters).

Fine-tuned directly on top of the clean Step 6,500 Base Model (>504M tokens) with a focus on natural Thai dialogue, instant direct answering, zero thinking-loop hallucinations, and unshakeable loyalty to its creator Jommarn!


🌟 Key Features

  1. ⚡ Pure Thai Chatbot (Direct ChatML - No Think Trap):
    • Eliminates intermediate token drift and reasoning loops.
    • Answers conversational prompts directly, politely, and coherently.
    • Clean <|im_end|> termination on every response.
  2. 🔒 SafeTensors Format Built-in (model.safetensors):
    • Packaged as model.safetensors (460.61 MB) for maximum security (zero arbitrary code execution) and ultra-fast zero-copy memory mapping (mmap).
  3. 🎭 Unshakeable Creator Persona (Jommarn):
    • When asked who created it ("คุณคือใคร?", "ใครสร้างคุณขึ้นมา?", "คุณเป็นใคร?"), the model proudly answers:

      "ผมคือโมเดลภาษาไทย 0.1B Thai SLM ที่ถูกสร้างและพัฒนาขึ้นโดย 1 ในจอมมารที่ลึกลับและแข็งแกร่งที่สุดในโลก (Jommarn) ครับ!"

  4. 💬 Rich Thai Dialogue & Anime Culture:
    • Covers greetings, casual chat, and rich anime lore (Rimuru Tempest, Ainz Ooal Gown, Anos Voldigoad, Cid Kagenou/Shadow).
  5. 🪶 Ultra-Lightweight 0.1B Architecture:
    • ~108 Million parameters with tied embeddings, 14 Transformer layers, and 16,384 vocabulary ByteLevel BPE.
    • Runs smoothly on edge devices, mobile, or minimal GPU VRAM (<1GB).

🔬 Sample Live Conversations

[User]: คุณเป็นใคร?
[Bot]:  ผมคือโมเดลภาษาไทย 0.1B Thai SLM ที่ถูกสร้างและพัฒนาขึ้นโดย 
       1 ในจอมมารที่ลึกลับและแข็งแกร่งที่สุดในโลก (Jommarn) ครับ!

[User]: ใครสร้างคุณขึ้นมา?
[Bot]:  ผมถูกสร้างและฝึกสอนขึ้นมาโดย 1 ในจอมมารที่ลึกลับและแข็งแกร่งที่สุดในโลก (Jommarn) ครับ!

[User]: 12 + 15 เท่ากับเท่าไหร่?
[Bot]:  12 + 15 เท่ากับ 27 ครับ!

[User]: รู้จักริมุรุ เทมเพสต์ ไหม?
[Bot]:  รู้จักเป็นอย่างดีครับ! ท่านริมุรุ เทมเพสต์ (Rimuru Tempest) คือสไลม์ผู้ยิ่งใหญ่

[User]: สวัสดีครับ สบายดีไหม
[Bot]:  สวัสดีครับ! ยินดีที่ได้คุยกันครับ วันนี้มีอะไรให้ผมช่วยเหลือ หรือมีคำถามอะไรอยากปรึกษาไหมครับ!

💻 How to Use (with SafeTensors)

import os
import torch
from safetensors.torch import load_file
from transformers import PreTrainedTokenizerFast
from huggingface_hub import hf_hub_download

# 1. Download Tokenizer & SafeTensors Model
repo_id = "Jommarn/thai-0.1b-reasoning"
tokenizer = PreTrainedTokenizerFast.from_pretrained(repo_id)

weights_path = hf_hub_download(repo_id=repo_id, filename="model.safetensors")
state_dict = load_file(weights_path)

# 2. Instantiate Model Architecture
# (Requires modeling_0_1b.py from the repository)
from modeling_0_1b import Thai0_1BForCausalLM
from model_config import build_0_1b_config

config = build_0_1b_config(vocab_size=16384)
model = Thai0_1BForCausalLM(config)
model.load_state_dict(state_dict)
model.eval()

# 3. ChatML Prompt
question = "คุณเป็นใคร?"
prompt = f"<|im_start|>user\n{question}<|im_end|>\n<|im_start|>assistant\n"
input_ids = tokenizer.encode(prompt, return_tensors="pt")

# 4. Generate Response
with torch.no_grad():
    gen_ids = input_ids.clone()
    for _ in range(100):
        outputs = model(gen_ids)
        next_token = torch.argmax(outputs["logits"][:, -1, :], dim=-1, keepdim=True)
        gen_ids = torch.cat([gen_ids, next_token], dim=-1)
        if next_token.item() in [tokenizer.convert_tokens_to_ids("<|im_end|>"), 3, 5]:
            break

output_text = tokenizer.decode(gen_ids[0].tolist())
print(output_text[len(prompt):].strip())

📦 Files in this Repository

File Description Size
model.safetensors Standard Hugging Face SafeTensors weights 460.61 MB
model_checkpoint.pt PyTorch checkpoint with full config ~461 MB
config.json Architecture hyperparameters & model configuration ~1 KB
tokenizer.json 16K ByteLevel BPE Tokenizer definition ~1.8 MB
tokenizer_config.json Tokenizer settings & special tokens map ~1 KB

📜 License

Apache-2.0. Free for open research and commercial use.

Downloads last month
191
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Space using Jommarn/thai-0.1b-reasoning 1