Text Generation
Transformers
Safetensors
qwen3
Generated from Trainer
conversational
text-generation-inference
Instructions to use winglian/qwen3-4b-math-kd with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
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", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use winglian/qwen3-4b-math-kd with vLLM:
Install from pip and serve model
# 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?" } ] }'Use Docker
docker model run hf.co/winglian/qwen3-4b-math-kd
- SGLang
How to use winglian/qwen3-4b-math-kd 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 "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?" } ] }'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 "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 Model Runner
How to use winglian/qwen3-4b-math-kd with Docker Model Runner:
docker model run hf.co/winglian/qwen3-4b-math-kd
|
Download README.md from winglian/qwen3-4b-math-kd: direct link, hf CLI and curl.
- Browser
- Download file 3.24 kB
-
https://huggingface.co/winglian/qwen3-4b-math-kd/resolve/main/README.md
- Command line
-
hf download hf://winglian/qwen3-4b-math-kd/README.md
-
curl -L -o README.md https://huggingface.co/winglian/qwen3-4b-math-kd/resolve/main/README.md
3.24 kB
metadata
library_name: transformers
license: apache-2.0
base_model: Qwen/Qwen3-4B-Base
tags:
- generated_from_trainer
datasets:
- winglian/OpenThoughts-114k-math-correct
model-index:
- name: outputs/out-kd-4b
results: []
See axolotl config
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
outputs/out-kd-4b
This model is a fine-tuned version of Qwen/Qwen3-4B-Base on the winglian/OpenThoughts-114k-math-correct dataset.
Model description
More information needed
Intended uses & limitations
More information needed
Training and evaluation data
More information needed
Training procedure
Training hyperparameters
The following hyperparameters were used during training:
- learning_rate: 3e-05
- train_batch_size: 4
- eval_batch_size: 4
- seed: 42
- distributed_type: multi-GPU
- num_devices: 4
- gradient_accumulation_steps: 2
- total_train_batch_size: 32
- total_eval_batch_size: 16
- optimizer: Use OptimizerNames.ADAMW_TORCH_FUSED with betas=(0.9,0.95) and epsilon=1e-08 and optimizer_args=No additional optimizer arguments
- lr_scheduler_type: cosine
- lr_scheduler_warmup_steps: 100
- num_epochs: 2.0
Training results
Framework versions
- Transformers 4.51.3
- Pytorch 2.7.0+cu128
- Datasets 3.5.1
- Tokenizers 0.21.1