Tiny Models
Collection
Tiny models used for testing • 8 items • Updated
How to use inference-optimization/GLM-5.2-0.8B-A0.8B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="inference-optimization/GLM-5.2-0.8B-A0.8B")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("inference-optimization/GLM-5.2-0.8B-A0.8B")
model = AutoModelForCausalLM.from_pretrained("inference-optimization/GLM-5.2-0.8B-A0.8B")
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]:]))How to use inference-optimization/GLM-5.2-0.8B-A0.8B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "inference-optimization/GLM-5.2-0.8B-A0.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": "inference-optimization/GLM-5.2-0.8B-A0.8B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/inference-optimization/GLM-5.2-0.8B-A0.8B
How to use inference-optimization/GLM-5.2-0.8B-A0.8B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "inference-optimization/GLM-5.2-0.8B-A0.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": "inference-optimization/GLM-5.2-0.8B-A0.8B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "inference-optimization/GLM-5.2-0.8B-A0.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": "inference-optimization/GLM-5.2-0.8B-A0.8B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use inference-optimization/GLM-5.2-0.8B-A0.8B with Docker Model Runner:
docker model run hf.co/inference-optimization/GLM-5.2-0.8B-A0.8B
This is a tiny version of zai-org/GLM-5.2 created for testing and development.
The following parameters were reduced from the original model:
| Parameter | Original | Tiny |
|---|---|---|
| num_hidden_layers | 78 | 6 |
| hidden_size | 6144 | 2048 |
| intermediate_size | 12288 | 4096 |
| num_attention_heads | 64 | 16 |
| num_key_value_heads | 64 | 16 |
| n_routed_experts | 256 | 8 |
| num_experts_per_tok | 8 | 2 |
| moe_intermediate_size | 2048 | 512 |
| kv_lora_rank | 512 | 128 |
| q_lora_rank | 2048 | 512 |
| v_head_dim | 256 | 128 |
| index_n_heads | 32 | 8 |
| index_head_dim | 128 | 64 |
| first_k_dense_replace | 3 | 2 |
Single safetensors file containing 194 tensors in float32. Layers 0-1 have dense MLP, layers 2-5 have MoE MLP. Layers 0-2 have full DSA indexer weights, layers 3-5 use shared indexer.
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("inference-optimization/GLM-5.2-0.8B-A0.8B", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("inference-optimization/GLM-5.2-0.8B-A0.8B")
input_ids = tokenizer("According to all known laws", return_tensors="pt").input_ids.to(model.device)
output = model.generate(input_ids, max_new_tokens=20)
print(tokenizer.decode(output[0]))
Success: 1.0000379085540771 <= 10.0
Generating sample text:
According to all known laws of aviation, there is no way a bee should be able to fly.
Base model
zai-org/GLM-5.2