Instructions to use Qwen/Qwen2.5-14B-Instruct-1M with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Qwen/Qwen2.5-14B-Instruct-1M with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Qwen/Qwen2.5-14B-Instruct-1M") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-14B-Instruct-1M") model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-14B-Instruct-1M", 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]:])) - Inference
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Qwen/Qwen2.5-14B-Instruct-1M with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Qwen/Qwen2.5-14B-Instruct-1M" # 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-14B-Instruct-1M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Qwen/Qwen2.5-14B-Instruct-1M
- SGLang
How to use Qwen/Qwen2.5-14B-Instruct-1M 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-14B-Instruct-1M" \ --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-14B-Instruct-1M", "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-14B-Instruct-1M" \ --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-14B-Instruct-1M", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Qwen/Qwen2.5-14B-Instruct-1M with Docker Model Runner:
docker model run hf.co/Qwen/Qwen2.5-14B-Instruct-1M
Better than distilled version
Tested it on lots of questions, and it's my favorite model now. Not only R1-Distill-Qwen-14B performs worse, but apparently even 32B. If anyone can prove me wrong, give some examples.
There is a guy on youtube, who tested full Deepseek-R1 vs Openai O3 mini, and maybe some other models, on this question >>> "Write a snake game code in html", openai failed, only R1 succeded. I decided to test Qwen2.5-14B-Instruct-1M on this, and lol, it also wrote correct code (with a little bug though, but corrected it after i described the bug)
I have had doubts as well. Not really seeing some radical improvement, but not seeing any major degradation either, in comparison. But the R1 versions are running a little faster on my hardware, so it may be a wash, for me.
i think both may have their place in the world. My guess at this stage is that if the model has to 'figure it out' R1 might be better with the extra overhead, but its its straight forward, then the 'base' will be better, with less noise. But that is a guess, not really had time to prove that suspicion.
EDIT and this is mostly on the 14b models
I played with the R1 distilled version and then found my way to this one and this is much smoother and smarter. For reasoning, I loaded it with a system prompt designed to approximate reasoning and it surprised us all how smart it was. Very smart model, especially given it's size.
@Windsage Care to share that prompt? id be curious to see it.
https://gist.github.com/Maharshi-Pandya/4aeccbe1dbaa7f89c182bd65d2764203