winglian/OpenThoughts-114k-math-correct
Viewer • Updated • 56.7k • 56
How to use winglian/qwen3-4b-math-kd with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="winglian/qwen3-4b-math-kd")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("winglian/qwen3-4b-math-kd")
model = AutoModelForCausalLM.from_pretrained("winglian/qwen3-4b-math-kd")
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 winglian/qwen3-4b-math-kd with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "winglian/qwen3-4b-math-kd"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "winglian/qwen3-4b-math-kd",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/winglian/qwen3-4b-math-kd
How to use winglian/qwen3-4b-math-kd with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "winglian/qwen3-4b-math-kd" \
--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": "winglian/qwen3-4b-math-kd",
"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 "winglian/qwen3-4b-math-kd" \
--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": "winglian/qwen3-4b-math-kd",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use winglian/qwen3-4b-math-kd with Docker Model Runner:
docker model run hf.co/winglian/qwen3-4b-math-kd
axolotl version: 0.10.0.dev0
base_model: Qwen/Qwen3-4B-Base
plugins:
- axolotl.integrations.kd.KDPlugin
- axolotl.integrations.liger.LigerPlugin
liger_rms_norm: true
liger_glu_activation: true
# torch_compile: true
strict: false
kd_trainer: true
kd_ce_alpha: 0.05
kd_alpha: 0.95
kd_temperature: 2.0
kd_online_server: vllm
kd_online_server_base_url: http://localhost:8888/
kd_online_topk: 40
dataloader_prefetch_factor: 8
dataloader_num_workers: 2
dataloader_pin_memory: true
gc_steps: -1 # gc at the end of each epoch
chat_template: qwen3
datasets:
- path: winglian/OpenThoughts-114k-math-correct
type: chat_template
split: train
split_thinking: true
eot_tokens:
- "<|im_end|>"
dataset_prepared_path: last_run_prepared
val_set_size: 0.0
output_dir: ./outputs/out-kd-4b
sequence_len: 8192
sample_packing: true
pad_to_sequence_len: true
wandb_project: kd-4b-math
wandb_entity: axolotl-ai
wandb_watch:
wandb_name:
wandb_log_model:
gradient_accumulation_steps: 2
micro_batch_size: 4
num_epochs: 2
optimizer: adamw_torch_fused
adam_beta2: 0.95
lr_scheduler: rex
learning_rate: 3e-5
max_grad_norm: 0.1
save_safetensors: true
train_on_inputs: false
group_by_length: false
bf16: true
tf32: true
gradient_checkpointing: true
gradient_checkpointing_kwargs:
use_reentrant: false
logging_steps: 1
flash_attention: true
warmup_steps: 100
evals_per_epoch: 4
saves_per_epoch: 1
debug:
weight_decay: 0.0
special_tokens:
eos_token: <|im_end|>
deepspeed: deepspeed_configs/zero2_torch_compile.json
This model is a fine-tuned version of Qwen/Qwen3-4B-Base on the winglian/OpenThoughts-114k-math-correct dataset.
More information needed
More information needed
More information needed
The following hyperparameters were used during training:
Base model
Qwen/Qwen3-4B-Base