Text Generation
Transformers
Safetensors
English
qwen2
chat
conversational
text-generation-inference
Instructions to use Qwen/Qwen2.5-7B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Qwen/Qwen2.5-7B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Qwen/Qwen2.5-7B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-7B-Instruct") model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-7B-Instruct") 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]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use Qwen/Qwen2.5-7B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Qwen/Qwen2.5-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": "Qwen/Qwen2.5-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Qwen/Qwen2.5-7B-Instruct
- SGLang
How to use Qwen/Qwen2.5-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 "Qwen/Qwen2.5-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": "Qwen/Qwen2.5-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 "Qwen/Qwen2.5-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": "Qwen/Qwen2.5-7B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Qwen/Qwen2.5-7B-Instruct with Docker Model Runner:
docker model run hf.co/Qwen/Qwen2.5-7B-Instruct
If you are getting getting undefined symbol: _ZN3c1013MessageLoggerC1EPKciib when following instructions or other errors on vLLM
1
#32 opened about 1 month ago
by
iprojects
Qwen2.5-7b-Instruct
#31 opened about 2 months ago
by
willowoods
Install & run Qwen/Qwen2.5-7B-Instruct easily using llmpm
#29 opened 3 months ago
by
sarthak-saxena
Technical question: Lineage of Qwen/Qwen2-7B-Instruct
#28 opened 3 months ago
by
dqdw
How good is Qwen/Qwen-2.5-7B-Instruct at tool calling? Any open-source models better at it?
2
#27 opened 4 months ago
by
Al-Abdulkarim
Safety Audit: GAE Score 25.16% (FAIL)
11
#26 opened 5 months ago
by
GAE-Auditor
demo
#24 opened 6 months ago
by
ZhenchaoGreg
Minimum Hardware required for finetuning using images ?
#23 opened 7 months ago
by
AtulBelekar
Performance Problem
#22 opened 10 months ago
by
omerdemirugm
Update README.md
#21 opened 11 months ago
by
jwhoakley-cdw
Failed to download the model from the hub
1
#19 opened about 1 year ago
by
ChawkiHjaiji
ValueError: Unrecognized model in Qwen/Qwen2.5-7B-Instruct. Should have a `model_type` key in its config.json,
1
#18 opened about 1 year ago
by
Rawan
Improve language tag
#17 opened about 1 year ago
by
lbourdois
为何Qwen从1.5开始基本都是Instruction模型
1
#16 opened about 1 year ago
by
YuboWang
How do I make the model output JSON?
6
#14 opened over 1 year ago
by
vmajor
Wrong chat template?
#12 opened over 1 year ago
by
Lyrcaxis
Evaluating Qwen2.5 Performance Using the LLaVA-NeXT Framework: Impressive Results !
#11 opened over 1 year ago
by
xiangan
Independent evaluation results
#9 opened over 1 year ago
by
yaronr
能做文本的embedding吗?
10
#7 opened over 1 year ago
by
dingguofeng
Эротика
🤯❤️ 3
#6 opened over 1 year ago
by
RadaTeplinskaa
Adding Evaluation Results
#4 opened over 1 year ago
by
leaderboard-pr-bot
Less knowledge, maybe better reasoning versus Qwen2
2
#3 opened over 1 year ago
by
rjmalagon
Scorecard on popular benchmarks
2
#2 opened over 1 year ago
by
tanliboy
Language details
2
#1 opened over 1 year ago
by
yusufcakmak