Upload Qwen2ForCausalLM
Browse files- README.md +37 -0
- config.json +53 -0
- generation_config.json +6 -0
- model-00001-of-00004.safetensors +3 -0
- model-00002-of-00004.safetensors +3 -0
- model-00003-of-00004.safetensors +3 -0
- model-00004-of-00004.safetensors +3 -0
- model.safetensors.index.json +0 -0
README.md
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
tags: []
|
4 |
+
---
|
5 |
+
|
6 |
+
# GPTQ 4bit quantized version of [DeepSeek-R1-Distill-Qwen-32B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B)
|
7 |
+
|
8 |
+
|
9 |
+
## Model Details
|
10 |
+
|
11 |
+
See details in the official model page: [DeepSeek-R1-Distill-Qwen-32B](https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B)
|
12 |
+
|
13 |
+
Quantized using [GPTQModel](https://github.com/ModelCloud/GPTQModel) using [wikitext2 dataset](https://github.com/ModelCloud/GPTQModel/blob/main/examples/quantization/basic_usage_wikitext2.py) with `nsamples=512` and `seqlen=2048`. Quantization config:
|
14 |
+
```
|
15 |
+
bits=4,
|
16 |
+
group_size=128,
|
17 |
+
desc_act=False,
|
18 |
+
damp_percent=0.01,
|
19 |
+
```
|
20 |
+
Minimum VRAM required: ~20GB
|
21 |
+
|
22 |
+
## How to use
|
23 |
+
Using `transformers` library with integrated GPTQ support:
|
24 |
+
```python
|
25 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
|
26 |
+
|
27 |
+
model_name = "avoroshilov/DeepSeek-R1-Distill-Qwen-32B-GPTQ_4bit-128g"
|
28 |
+
|
29 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
30 |
+
quantized_model = AutoModelForCausalLM.from_pretrained(model_name, device_map='cuda')
|
31 |
+
|
32 |
+
chat = [{"role": "user", "content": "Why is grass green?"},]
|
33 |
+
question_tokens = tokenizer.apply_chat_template(chat, add_generation_prompt=True, return_tensors="pt").to(quantized_model.device)
|
34 |
+
answer_tokens = quantized_model.generate(question_tokens, generation_config=GenerationConfig(max_length=2048, ))[0]
|
35 |
+
|
36 |
+
print(tokenizer.decode(answer_tokens))
|
37 |
+
```
|
config.json
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "DeepSeek-R1-Distill-Qwen-32B-GPTQ_4bit-128g",
|
3 |
+
"architectures": [
|
4 |
+
"Qwen2ForCausalLM"
|
5 |
+
],
|
6 |
+
"attention_dropout": 0.0,
|
7 |
+
"bos_token_id": 151643,
|
8 |
+
"eos_token_id": 151643,
|
9 |
+
"hidden_act": "silu",
|
10 |
+
"hidden_size": 5120,
|
11 |
+
"initializer_range": 0.02,
|
12 |
+
"intermediate_size": 27648,
|
13 |
+
"max_position_embeddings": 131072,
|
14 |
+
"max_window_layers": 64,
|
15 |
+
"model_type": "qwen2",
|
16 |
+
"num_attention_heads": 40,
|
17 |
+
"num_hidden_layers": 64,
|
18 |
+
"num_key_value_heads": 8,
|
19 |
+
"quantization_config": {
|
20 |
+
"batch_size": 1,
|
21 |
+
"bits": 4,
|
22 |
+
"block_name_to_quantize": null,
|
23 |
+
"cache_block_outputs": true,
|
24 |
+
"damp_percent": 0.1,
|
25 |
+
"dataset": null,
|
26 |
+
"desc_act": false,
|
27 |
+
"exllama_config": {
|
28 |
+
"version": 1
|
29 |
+
},
|
30 |
+
"group_size": 128,
|
31 |
+
"max_input_length": null,
|
32 |
+
"model_seqlen": null,
|
33 |
+
"module_name_preceding_first_block": null,
|
34 |
+
"modules_in_block_to_quantize": null,
|
35 |
+
"pad_token_id": null,
|
36 |
+
"quant_method": "gptq",
|
37 |
+
"sym": true,
|
38 |
+
"tokenizer": null,
|
39 |
+
"true_sequential": true,
|
40 |
+
"use_cuda_fp16": false,
|
41 |
+
"use_exllama": true
|
42 |
+
},
|
43 |
+
"rms_norm_eps": 1e-05,
|
44 |
+
"rope_scaling": null,
|
45 |
+
"rope_theta": 1000000.0,
|
46 |
+
"sliding_window": null,
|
47 |
+
"tie_word_embeddings": false,
|
48 |
+
"torch_dtype": "float16",
|
49 |
+
"transformers_version": "4.48.1",
|
50 |
+
"use_cache": true,
|
51 |
+
"use_sliding_window": false,
|
52 |
+
"vocab_size": 152064
|
53 |
+
}
|
generation_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_from_model_config": true,
|
3 |
+
"bos_token_id": 151643,
|
4 |
+
"eos_token_id": 151643,
|
5 |
+
"transformers_version": "4.48.1"
|
6 |
+
}
|
model-00001-of-00004.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7baf591a55c82170d8be3ec7ed570383b8c48305cbc6bb9f9a959429dd8089a0
|
3 |
+
size 4960232944
|
model-00002-of-00004.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a4cc6dd780a37a73954d79d1b307e22bbbd521bd2fae9b935075941104d9ac44
|
3 |
+
size 4998127832
|
model-00003-of-00004.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f0af7df5d1461a161e6bd99145270f31577822b736afcb38fea2c3203052ad28
|
3 |
+
size 4965412752
|
model-00004-of-00004.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:03bac45f3e35b7768eb42bd6edab5fb742b568cfe90664e5b660081aa9083d9c
|
3 |
+
size 4420211440
|
model.safetensors.index.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|