grenishrai/math-sft-dataset
Viewer โข Updated โข 87.3k โข 46
How to use grenishrai/suzu-1.7b with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="grenishrai/suzu-1.7b")
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("grenishrai/suzu-1.7b")
model = AutoModelForCausalLM.from_pretrained("grenishrai/suzu-1.7b", 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]:]))How to use grenishrai/suzu-1.7b with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "grenishrai/suzu-1.7b"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "grenishrai/suzu-1.7b",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/grenishrai/suzu-1.7b
How to use grenishrai/suzu-1.7b with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "grenishrai/suzu-1.7b" \
--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": "grenishrai/suzu-1.7b",
"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 "grenishrai/suzu-1.7b" \
--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": "grenishrai/suzu-1.7b",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use grenishrai/suzu-1.7b with Docker Model Runner:
docker model run hf.co/grenishrai/suzu-1.7b
Suzu is the second-generation model in the Mori family by Grenish Rai: a QLoRA SFT of HuggingFaceTB/SmolLM2-1.7B for reasoning, math, coding, and technical help, merged to fp16. Its predecessor is Yoru.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
tok = AutoTokenizer.from_pretrained("grenishrai/Suzu-1.7B")
model = AutoModelForCausalLM.from_pretrained("grenishrai/Suzu-1.7B", torch_dtype=torch.float16, device_map="auto")
msgs = [{"role": "user", "content": "A train travels 120 km in 1.5 hours. What is its average speed?"}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(ids, max_new_tokens=256, do_sample=False)
print(tok.decode(out[0, ids.shape[-1]:], skip_special_tokens=True))
The chat template injects a short Suzu system prompt when none is given. Training also used the full Suzu prompt
and no prompt at all, so all three work. eos is <|im_end|>, pad is <empty_output>.
| Setting | Value |
|---|---|
| Base | HuggingFaceTB/SmolLM2-1.7B (base checkpoint; ChatML embeddings mean-initialized before training) |
| Method | QLoRA (4-bit NF4) with Unsloth on one Kaggle T4, completion-only loss, merged to fp16 |
| LoRA | r=32, alpha=64, dropout 0, all attention + MLP projections |
| Data | grenishrai/math-sft-dataset 70% train split (61,230 rows incl. identity set) |
| System prompt mix | 40% full / 40% short / 20% none |
| Steps | 5452 (1.42 epochs), global batch 16, max length 2048 |
| LR | 0.0002, cosine, 3% warmup, adamw_8bit |
| Checkpoint kept | best validation loss (0.4768) |
| Metric | Value |
|---|---|
| Held-out test loss (1,000-row sample of the 20% split) | 0.5259 |
| GSM8K test, 250-problem sample, 0-shot greedy (4-bit + LoRA, before merge) | 47.2% |
| GSM8K test, 64-problem subset, 0-shot greedy (these merged fp16 weights) | 48.4% |
The GSM8K numbers come from samples with a simple final-number match, not an official harness run.