Instructions to use keyfan/Qwen-72B-Chat-2bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use keyfan/Qwen-72B-Chat-2bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="keyfan/Qwen-72B-Chat-2bit", trust_remote_code=True)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("keyfan/Qwen-72B-Chat-2bit", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use keyfan/Qwen-72B-Chat-2bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "keyfan/Qwen-72B-Chat-2bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "keyfan/Qwen-72B-Chat-2bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/keyfan/Qwen-72B-Chat-2bit
- SGLang
How to use keyfan/Qwen-72B-Chat-2bit 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 "keyfan/Qwen-72B-Chat-2bit" \ --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": "keyfan/Qwen-72B-Chat-2bit", "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 "keyfan/Qwen-72B-Chat-2bit" \ --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": "keyfan/Qwen-72B-Chat-2bit", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use keyfan/Qwen-72B-Chat-2bit with Docker Model Runner:
docker model run hf.co/keyfan/Qwen-72B-Chat-2bit
This is 2-bit quantization of Qwen/Qwen-72B-Chat using QuIP#
Random samples from C4 are used as calibration data.
For Chinese related tasks, please use the zh branch instead, which use bilingual text from C4 and SkyPile as calibration data.
Model loading
Please follow the instruction of QuIP-for-all for usage.
As an alternative, you can use vLLM branch for faster inference. QuIP has to launch like 5 kernels for each linear layer, so it's very helpful for vLLM to use cuda-graph to reduce launching overhead. BTW, If you have problem installing fast-hadamard-transform from pip, you can also install it from source
Perplexity
Measured at Wikitext with 4096 context length
| fp16 | 2-bit |
|---|---|
| 5.8438 | 6.9492 |
Speed
Latency and throughput are measured using vLLM (examples/benchmark_latency.py and examples/benchmark_throughput.py respectively) at single A100-80G.
Latency at batch size 1: 13.5 tokens/s.
Throughput: 0.77 requests/s
- Downloads last month
- 15