Text Generation
Transformers
Safetensors
qwen2
unsloth
text-generation-inference
4-bit precision
bitsandbytes
Instructions to use unsloth/Qwen2.5-0.5B-bnb-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/Qwen2.5-0.5B-bnb-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/Qwen2.5-0.5B-bnb-4bit")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsloth/Qwen2.5-0.5B-bnb-4bit") model = AutoModelForCausalLM.from_pretrained("unsloth/Qwen2.5-0.5B-bnb-4bit", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use unsloth/Qwen2.5-0.5B-bnb-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/Qwen2.5-0.5B-bnb-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/Qwen2.5-0.5B-bnb-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/unsloth/Qwen2.5-0.5B-bnb-4bit
- SGLang
How to use unsloth/Qwen2.5-0.5B-bnb-4bit 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-0.5B-bnb-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/Qwen2.5-0.5B-bnb-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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-0.5B-bnb-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/Qwen2.5-0.5B-bnb-4bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Unsloth Desktop
- Docker Model Runner
How to use unsloth/Qwen2.5-0.5B-bnb-4bit with Docker Model Runner:
docker model run hf.co/unsloth/Qwen2.5-0.5B-bnb-4bit
Upload tokenizer
Browse files- special_tokens_map.json +7 -1
- tokenizer_config.json +0 -1
special_tokens_map.json
CHANGED
|
@@ -21,5 +21,11 @@
|
|
| 21 |
"rstrip": false,
|
| 22 |
"single_word": false
|
| 23 |
},
|
| 24 |
-
"pad_token":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
}
|
|
|
|
| 21 |
"rstrip": false,
|
| 22 |
"single_word": false
|
| 23 |
},
|
| 24 |
+
"pad_token": {
|
| 25 |
+
"content": "<|PAD_TOKEN|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
}
|
| 31 |
}
|
tokenizer_config.json
CHANGED
|
@@ -203,7 +203,6 @@
|
|
| 203 |
"<|video_pad|>"
|
| 204 |
],
|
| 205 |
"bos_token": null,
|
| 206 |
-
"chat_template": null,
|
| 207 |
"clean_up_tokenization_spaces": false,
|
| 208 |
"eos_token": "<|endoftext|>",
|
| 209 |
"errors": "replace",
|
|
|
|
| 203 |
"<|video_pad|>"
|
| 204 |
],
|
| 205 |
"bos_token": null,
|
|
|
|
| 206 |
"clean_up_tokenization_spaces": false,
|
| 207 |
"eos_token": "<|endoftext|>",
|
| 208 |
"errors": "replace",
|