Text Generation
Transformers
Safetensors
English
qwen2
unsloth
conversational
text-generation-inference
Instructions to use unsloth/Qwen2.5-Math-7B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/Qwen2.5-Math-7B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/Qwen2.5-Math-7B-Instruct") 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("unsloth/Qwen2.5-Math-7B-Instruct") model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-Math-7B-Instruct", 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsloth/Qwen2.5-Math-7B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/Qwen2.5-Math-7B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/Qwen2.5-Math-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/unsloth/Qwen2.5-Math-7B-Instruct
- SGLang
How to use unsloth/Qwen2.5-Math-7B-Instruct 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 "unsloth/Qwen2.5-Math-7B-Instruct" \ --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": "unsloth/Qwen2.5-Math-7B-Instruct", "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 "unsloth/Qwen2.5-Math-7B-Instruct" \ --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": "unsloth/Qwen2.5-Math-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Desktop
- Docker Model Runner
How to use unsloth/Qwen2.5-Math-7B-Instruct with Docker Model Runner:
docker model run hf.co/unsloth/Qwen2.5-Math-7B-Instruct
Commit History
-
Upload Qwen2ForCausalLM
Verified signatureddb1643 -
Upload Qwen2ForCausalLM
Verified signature8a7dd72 -
Delete model-00004-of-00004.safetensors
Verified signature026fc16 -
Delete model-00003-of-00004.safetensors
Verified signatured1c4e91 -
Delete model-00003-of-00003.safetensors
Verified signature3970ad2 -
Delete model-00002-of-00004.safetensors
Verified signaturee897614 -
Delete model-00002-of-00003.safetensors
Verified signature050c226 -
Delete model-00001-of-00004.safetensors
Verified signature3223c18 -
Delete model-00001-of-00003.safetensors
Verified signatured2edf17 -
Upload Qwen2ForCausalLM
Verified signatured37c704
-
Upload README.md with huggingface_hub
Verified signature77277ea -
Upload README.md with huggingface_hub
Verified signature09a8789 -
Upload README.md with huggingface_hub
Verified signature7ad14d6 -
Upload tokenizer
Verified signaturede7b0d0 -
Upload Qwen2ForCausalLM
Verified signaturef5a7911 -
initial commit
Verified signature8657c3a