Text Generation
Transformers
Safetensors
English
qwen3
from-scratch
experimental
research
conversational
Eval Results (legacy)
text-generation-inference
Instructions to use sraivante/TinyThinkModel-72M-V1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use sraivante/TinyThinkModel-72M-V1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="sraivante/TinyThinkModel-72M-V1") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("sraivante/TinyThinkModel-72M-V1") model = AutoModelForCausalLM.from_pretrained("sraivante/TinyThinkModel-72M-V1", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use sraivante/TinyThinkModel-72M-V1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "sraivante/TinyThinkModel-72M-V1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "sraivante/TinyThinkModel-72M-V1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/sraivante/TinyThinkModel-72M-V1
- SGLang
How to use sraivante/TinyThinkModel-72M-V1 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 "sraivante/TinyThinkModel-72M-V1" \ --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": "sraivante/TinyThinkModel-72M-V1", "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 "sraivante/TinyThinkModel-72M-V1" \ --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": "sraivante/TinyThinkModel-72M-V1", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use sraivante/TinyThinkModel-72M-V1 with Docker Model Runner:
docker model run hf.co/sraivante/TinyThinkModel-72M-V1
Download code/common.py from sraivante/TinyThinkModel-72M-V1: direct link, hf CLI and curl.
- Browser
- Download file 2.57 kB
-
https://huggingface.co/sraivante/TinyThinkModel-72M-V1/resolve/main/code/common.py
- Command line
-
hf download hf://sraivante/TinyThinkModel-72M-V1/code/common.py
-
curl -L -o common.py https://huggingface.co/sraivante/TinyThinkModel-72M-V1/resolve/main/code/common.py
2.57 kB
| """Shared, deterministic model/data definitions. Copyright (c) 2026 sraivante.""" | |
| from __future__ import annotations | |
| import hashlib | |
| import json | |
| import re | |
| import unicodedata | |
| from datetime import datetime, timezone | |
| from pathlib import Path | |
| SEED = 20261017 | |
| CONTEXT = 1024 | |
| VOCAB = 33069 | |
| SPECIALS = ["<|pad|>", "<|endoftext|>", "<|im_end|>", "<|im_start|>", "<think>", "</think>"] | |
| MAX_SOURCE_BYTES = 20_000_000_000 | |
| MAX_FILE_BYTES = 7_000_000_000 | |
| def now(): | |
| return datetime.now(timezone.utc).isoformat() | |
| def sha(path): | |
| h = hashlib.sha256() | |
| with Path(path).open('rb') as f: | |
| for chunk in iter(lambda: f.read(8 * 1024 * 1024), b''): | |
| h.update(chunk) | |
| return h.hexdigest() | |
| def dump(path, value): | |
| path = Path(path) | |
| path.parent.mkdir(parents=True, exist_ok=True) | |
| tmp = path.with_name(path.name + '.partial') | |
| tmp.write_text(json.dumps(value, indent=2, ensure_ascii=False) + '\n', encoding='utf-8') | |
| tmp.replace(path) | |
| def prompt_key(prompt): | |
| # All identical normalized questions share a split, including different solutions. | |
| s = re.sub(r'\s+', ' ', unicodedata.normalize('NFKC', str(prompt))).strip().casefold() | |
| return hashlib.sha256(s.encode('utf-8')).digest() | |
| def split_for(prompt): | |
| bucket = int.from_bytes(prompt_key(prompt)[:8], 'big') % 1000 | |
| return 'validation' if bucket < 5 else ('test' if bucket < 10 else 'train') | |
| def render_row(row): | |
| prompt = str(row.get('prompt') or '').strip() | |
| answer = str(row.get('answer') or '').strip() | |
| thought = str(row.get('think') or '').strip() | |
| if not prompt or not (answer or thought): | |
| return None | |
| # Preserve source Unicode, math, code indentation and newlines. No ASCII filtering. | |
| reasoning = '<think>\n' + thought + '\n</think>\n' if thought else '' | |
| return ('<|im_start|>user\n' + prompt + '<|im_end|>\n' | |
| + '<|im_start|>assistant\n' + reasoning + answer + '<|im_end|>\n<|endoftext|>') | |
| def model_config(): | |
| from transformers import Qwen3Config | |
| return Qwen3Config( | |
| vocab_size=VOCAB, hidden_size=512, intermediate_size=1536, | |
| num_hidden_layers=14, num_attention_heads=8, num_key_value_heads=4, | |
| head_dim=128, max_position_embeddings=CONTEXT, | |
| hidden_act='silu', rms_norm_eps=1e-6, rope_theta=1_000_000.0, | |
| attention_bias=False, attention_dropout=0.0, tie_word_embeddings=True, | |
| use_sliding_window=False, sliding_window=None, max_window_layers=14, | |
| pad_token_id=0, bos_token_id=1, eos_token_id=2, use_cache=False, | |
| architectures=['Qwen3ForCausalLM'], | |
| ) | |