Instructions to use tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft") model = AutoModelForCausalLM.from_pretrained("tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft", 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 tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft
- SGLang
How to use tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft 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 "tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft" \ --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": "tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft", "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 "tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft" \ --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": "tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft with Docker Model Runner:
docker model run hf.co/tugstugi/Qwen2.5-Coder-0.5B-QwQ-draft
Special tokens don't match between draft model and target model
Hi, thanks for making this model! I'd love to compare it to the non-fine-tuned Qwen2.5-Coder-0.5B, but unfortunately llama.cpp won't accept it as a matching draft model:
common_speculative_are_compatible: draft model special tokens must match target model to use speculation
common_speculative_are_compatible: tgt: bos = 151643 (0), eos = 151645 (0)
common_speculative_are_compatible: dft: bos = 11 (0), eos = 151645 (0)
srv load_model: the draft model './models/Qwen2.5-Coder-0.5B-QwQ-draft.Q8_0.gguf' is not compatible with the target model './models/QwQ-32B-Preview-Q4_K_M.gguf'
I'm using QwQ quantized to Q4_K_M from this HF repo: bartowski/QwQ-32B-Preview-GGUF
And I'm using this model quantized to Q8_0 from this HF repo: MaziyarPanahi/Qwen2.5-Coder-0.5B-QwQ-draft-GGUF
My understanding is that quantization changes many things, but the token IDs should stay identical to the original model. Is this something that can be changed in your model?
Qwen models don't have any bos_token, probably quantatizer/GGUF converter is setting something to bos_token.
In the above, 151643 should be <|endoftext|> and 11 is ,. Probably, you should regenerate again GGUF and set <|endoftext|> as bos token.
OK thanks, I'll ask the GGUF quant author if he can update his repo. I appreciate the speedy answer.