Text Generation
Transformers
Safetensors
deepseek_v3
DeepSeek-R1-0528
GPTQ
Int4-Int8Mix
量化修复
vLLM
conversational
custom_code
text-generation-inference
4-bit precision
gptq
Instructions to use QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact", trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained("QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact", trust_remote_code=True) 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
- vLLM
How to use QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact
- SGLang
How to use QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact 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 "QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact" \ --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": "QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact", "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 "QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact" \ --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": "QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact with Docker Model Runner:
docker model run hf.co/QuantTrio/DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact
Update README.md
Browse files
README.md
CHANGED
|
@@ -15,11 +15,23 @@ base_model_relation: quantized
|
|
| 15 |
# DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact
|
| 16 |
Base mode [deepseek-ai/DeepSeek-R1-0528](https://huggingface.co/deepseek-ai/DeepSeek-R1-0528)
|
| 17 |
|
| 18 |
-
This repository
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
### 【Model Update Date】
|
| 25 |
```
|
|
|
|
| 15 |
# DeepSeek-R1-0528-GPTQ-Int4-Int8Mix-Compact
|
| 16 |
Base mode [deepseek-ai/DeepSeek-R1-0528](https://huggingface.co/deepseek-ai/DeepSeek-R1-0528)
|
| 17 |
|
| 18 |
+
This repository delivers an Int4 + selectively-Int8 GPTQ `DeepSeek-R1-0528` model: only layers that are highly sensitive to quantization remain in Int8, while the rest stay Int4—preserving generation quality with minimal file-size overhead.
|
| 19 |
|
| 20 |
+
Preliminary trials show that converting the entire model to pure Int4 (AWQ/GPTQ) under the quantization layout used in vLLM’s current DeepSeek-R1 implementation degrades inference accuracy and can produce faulty outputs. Layer-wise fine-grained quantization substantially mitigates this issue.
|
| 21 |
|
| 22 |
+
Temporary patch:
|
| 23 |
+
vLLM == 0.9.0 does not yet natively support per-layer quantization for MoE modules.
|
| 24 |
+
We added get_moe_quant_method to gptq_marlin.py as an interim fix.
|
| 25 |
+
Until the upstream PR is merged, please replace the original file with the one provided in this repo.
|
| 26 |
+
|
| 27 |
+
Variant Overview
|
| 28 |
+
|
| 29 |
+
| Variant | Characteristics | File Size | Recommended Scenario |
|
| 30 |
+
|-------------|-------------------------------------------------------------------------|-----------|----------------------------------------------------------|
|
| 31 |
+
| **Compact** | More Int8 layers, higher fidelity | 414 GB | Ample GPU memory & strict quality needs (e.g., 8 × A100) |
|
| 32 |
+
| **Lite** | Only the most critical layers upgraded to Int8; size close to pure Int4 | 355 GB | Resource-constrained, lightweight server deployments |
|
| 33 |
+
|
| 34 |
+
Choose the variant that best matches your hardware and quality requirements.
|
| 35 |
|
| 36 |
### 【Model Update Date】
|
| 37 |
```
|