---
title: DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4
canonical_url: "https://www.modelscope.cn/models/ModelScope-GTPQ/DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4"
md_url: "https://www.modelscope.cn/models/ModelScope-GTPQ/DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4.md"
repository: ModelScope-GTPQ/DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4
chinese_name: "DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4量化"
last_updated: 2025-02-08
license: "Apache License 2.0"
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - qwen2
architectures:
  - Qwen2ForCausalLM
base_model:
  - deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B
base_model_relation: quantized
parameters: 642.7M
tensor_type:
  - F16
  - BF16
  - I32
library_name:
  - transformer
  - safetensors
  - other
frameworks:
  - other
inference_backends:
  - "deploy_task text/emb"
  - "lmdeploy 0.9.1"
  - "lmdeploy_turbomind 0.9.1"
  - "sglang 0.5.2"
  - "vllm 0.9.2"
downloads: 454
stars: 2
---

# DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4

> DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4 - ModelScope-GTPQ 在 ModelScope 开源的模型。使用GPTQModel从DeepSeek-R1-Distill-Qwen-1.5B模型量化而来。可使用如下代码加载：

ModelScope-GTPQ/DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4 是 ModelScope 魔搭社区上的 642.7M 参数text-generation模型，采用 Apache License 2.0 许可，基于 deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B 构建，可用 deploy_task text/emb、lmdeploy 0.9.1、lmdeploy_turbomind 0.9.1 部署。

- **Repository**: ModelScope-GTPQ/DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4
- **License**: Apache License 2.0
- **Tasks**: text-generation
- **Parameters**: 642.7M
- **Base model**: deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B
- **Inference backends**: deploy_task text/emb, lmdeploy 0.9.1, lmdeploy_turbomind 0.9.1, sglang 0.5.2, vllm 0.9.2
- **Downloads**: 454
- **Stars**: 2
- **Last updated**: 2025-02-08

Source: https://www.modelscope.cn/models/ModelScope-GTPQ/DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4

---

使用GPTQModel从[DeepSeek-R1-Distill-Qwen-1.5B](https://www.modelscope.cn/models/deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B)模型量化而来。可使用如下代码加载：

```python
from modelscope import AutoModelForCausalLM, AutoTokenizer
from transformers import TextStreamer

model_name = "ModelScope-GTPQ/DeepSeek-R1-Distill-Qwen-1.5B-GTPQ-Int4"
model = AutoModelForCausalLM.from_pretrained(
    model_name,
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
streamer = TextStreamer(tokenizer, skip_prompt=True)
prompt = "Give me a short introduction to large language model."
messages = [
    {"role": "system", "content": "You are a helpful and harmless assistant. You should think step-by-step."},
    {"role": "user", "content": "Compute 562 + 32"},
]
text = tokenizer.apply_chat_template(
    messages,
    tokenize=False,
    add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
    **model_inputs,
    streamer=streamer,
    max_new_tokens=2048
)
```
