JunHowie commited on
Commit
63e6e86
·
verified ·
1 Parent(s): e285e32

Upload folder using huggingface_hub

Browse files
README.md CHANGED
@@ -1,12 +1,42 @@
1
  ---
2
  library_name: transformers
3
- license: apache-2.0
4
  license_link: https://huggingface.co/Qwen/Qwen3-4B/blob/main/LICENSE
5
  pipeline_tag: text-generation
 
 
 
 
 
 
6
  base_model:
7
- - Qwen/Qwen3-4B-Base
 
8
  ---
 
 
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  # Qwen3-4B
11
  <a href="https://chat.qwen.ai/" target="_blank" style="margin: 2px;">
12
  <img alt="Chat" src="https://img.shields.io/badge/%F0%9F%92%9C%EF%B8%8F%20Qwen%20Chat%20-536af5" style="display: inline-block; vertical-align: middle;"/>
@@ -344,11 +374,13 @@ To achieve optimal performance, we recommend the following settings:
344
  If you find our work helpful, feel free to give us a cite.
345
 
346
  ```
347
- @misc{qwen3,
348
- title = {Qwen3},
349
- url = {https://qwenlm.github.io/blog/qwen3/},
350
- author = {Qwen Team},
351
- month = {April},
352
- year = {2025}
 
 
353
  }
354
  ```
 
1
  ---
2
  library_name: transformers
3
+ license: apache-2.0
4
  license_link: https://huggingface.co/Qwen/Qwen3-4B/blob/main/LICENSE
5
  pipeline_tag: text-generation
6
+ tags:
7
+ - Qwen2
8
+ - GPTQ
9
+ - Int4
10
+ - 量化修复
11
+ - vLLM
12
  base_model:
13
+ - Qwen/Qwen3-4B
14
+ base_model_relation: quantized
15
  ---
16
+ # Qwen3-4B-GPTQ-Int4
17
+ Base model: [Qwen/Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B)
18
 
19
+ <i>This model is quantized to 4-bit with a group size of 128.</i>
20
+ <br>
21
+ <i>Compared to earlier quantized versions, the new quantized model demonstrates better tokens/s efficiency. This improvement comes from setting desc_act=False in the quantization configuration.</i>
22
+
23
+ ```
24
+ vllm serve JunHowie/Qwen3-4B-GPTQ-Int4
25
+ ```
26
+
27
+ ### 【Dependencies】
28
+ ```
29
+ vllm>=0.9.2
30
+ ```
31
+
32
+ ### 【Model Download】
33
+
34
+ ```python
35
+ from huggingface_hub import snapshot_download
36
+ snapshot_download('JunHowie/Qwen3-4B-GPTQ-Int4', cache_dir="your_local_path")
37
+ ```
38
+
39
+ ### 【Overview】
40
  # Qwen3-4B
41
  <a href="https://chat.qwen.ai/" target="_blank" style="margin: 2px;">
42
  <img alt="Chat" src="https://img.shields.io/badge/%F0%9F%92%9C%EF%B8%8F%20Qwen%20Chat%20-536af5" style="display: inline-block; vertical-align: middle;"/>
 
374
  If you find our work helpful, feel free to give us a cite.
375
 
376
  ```
377
+ @misc{qwen3technicalreport,
378
+ title={Qwen3 Technical Report},
379
+ author={Qwen Team},
380
+ year={2025},
381
+ eprint={2505.09388},
382
+ archivePrefix={arXiv},
383
+ primaryClass={cs.CL},
384
+ url={https://arxiv.org/abs/2505.09388},
385
  }
386
  ```
chat_template.jinja ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if tools %}
2
+ {{- '<|im_start|>system\n' }}
3
+ {%- if messages[0].role == 'system' %}
4
+ {{- messages[0].content + '\n\n' }}
5
+ {%- endif %}
6
+ {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
7
+ {%- for tool in tools %}
8
+ {{- "\n" }}
9
+ {{- tool | tojson }}
10
+ {%- endfor %}
11
+ {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
12
+ {%- else %}
13
+ {%- if messages[0].role == 'system' %}
14
+ {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
15
+ {%- endif %}
16
+ {%- endif %}
17
+ {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
18
+ {%- for message in messages[::-1] %}
19
+ {%- set index = (messages|length - 1) - loop.index0 %}
20
+ {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
21
+ {%- set ns.multi_step_tool = false %}
22
+ {%- set ns.last_query_index = index %}
23
+ {%- endif %}
24
+ {%- endfor %}
25
+ {%- for message in messages %}
26
+ {%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
27
+ {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
28
+ {%- elif message.role == "assistant" %}
29
+ {%- set content = message.content %}
30
+ {%- set reasoning_content = '' %}
31
+ {%- if message.reasoning_content is defined and message.reasoning_content is not none %}
32
+ {%- set reasoning_content = message.reasoning_content %}
33
+ {%- else %}
34
+ {%- if '</think>' in message.content %}
35
+ {%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
36
+ {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
37
+ {%- endif %}
38
+ {%- endif %}
39
+ {%- if loop.index0 > ns.last_query_index %}
40
+ {%- if loop.last or (not loop.last and reasoning_content) %}
41
+ {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
42
+ {%- else %}
43
+ {{- '<|im_start|>' + message.role + '\n' + content }}
44
+ {%- endif %}
45
+ {%- else %}
46
+ {{- '<|im_start|>' + message.role + '\n' + content }}
47
+ {%- endif %}
48
+ {%- if message.tool_calls %}
49
+ {%- for tool_call in message.tool_calls %}
50
+ {%- if (loop.first and content) or (not loop.first) %}
51
+ {{- '\n' }}
52
+ {%- endif %}
53
+ {%- if tool_call.function %}
54
+ {%- set tool_call = tool_call.function %}
55
+ {%- endif %}
56
+ {{- '<tool_call>\n{"name": "' }}
57
+ {{- tool_call.name }}
58
+ {{- '", "arguments": ' }}
59
+ {%- if tool_call.arguments is string %}
60
+ {{- tool_call.arguments }}
61
+ {%- else %}
62
+ {{- tool_call.arguments | tojson }}
63
+ {%- endif %}
64
+ {{- '}\n</tool_call>' }}
65
+ {%- endfor %}
66
+ {%- endif %}
67
+ {{- '<|im_end|>\n' }}
68
+ {%- elif message.role == "tool" %}
69
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
70
+ {{- '<|im_start|>user' }}
71
+ {%- endif %}
72
+ {{- '\n<tool_response>\n' }}
73
+ {{- message.content }}
74
+ {{- '\n</tool_response>' }}
75
+ {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
76
+ {{- '<|im_end|>\n' }}
77
+ {%- endif %}
78
+ {%- endif %}
79
+ {%- endfor %}
80
+ {%- if add_generation_prompt %}
81
+ {{- '<|im_start|>assistant\n' }}
82
+ {%- if enable_thinking is defined and enable_thinking is false %}
83
+ {{- '<think>\n\n</think>\n\n' }}
84
+ {%- endif %}
85
+ {%- endif %}
config.json CHANGED
@@ -11,6 +11,44 @@
11
  "hidden_size": 2560,
12
  "initializer_range": 0.02,
13
  "intermediate_size": 9728,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  "max_position_embeddings": 40960,
15
  "max_window_layers": 36,
16
  "model_type": "qwen3",
@@ -20,19 +58,22 @@
20
  "quantization_config": {
21
  "bits": 4,
22
  "checkpoint_format": "gptq",
23
- "desc_act": true,
24
  "group_size": 128,
 
25
  "lm_head": false,
26
  "meta": {
27
- "damp_auto_increment": 0.0025,
28
- "damp_percent": 0.01,
29
  "mse": 0.0,
30
  "quantizer": [
31
- "gptqmodel:2.2.0"
32
  ],
33
  "static_groups": false,
34
  "true_sequential": true,
35
- "uri": "https://github.com/modelcloud/gptqmodel"
 
 
36
  },
37
  "pack_dtype": "int32",
38
  "quant_method": "gptq",
@@ -44,7 +85,7 @@
44
  "sliding_window": null,
45
  "tie_word_embeddings": true,
46
  "torch_dtype": "bfloat16",
47
- "transformers_version": "4.51.3",
48
  "use_cache": true,
49
  "use_sliding_window": false,
50
  "vocab_size": 151936
 
11
  "hidden_size": 2560,
12
  "initializer_range": 0.02,
13
  "intermediate_size": 9728,
14
+ "layer_types": [
15
+ "full_attention",
16
+ "full_attention",
17
+ "full_attention",
18
+ "full_attention",
19
+ "full_attention",
20
+ "full_attention",
21
+ "full_attention",
22
+ "full_attention",
23
+ "full_attention",
24
+ "full_attention",
25
+ "full_attention",
26
+ "full_attention",
27
+ "full_attention",
28
+ "full_attention",
29
+ "full_attention",
30
+ "full_attention",
31
+ "full_attention",
32
+ "full_attention",
33
+ "full_attention",
34
+ "full_attention",
35
+ "full_attention",
36
+ "full_attention",
37
+ "full_attention",
38
+ "full_attention",
39
+ "full_attention",
40
+ "full_attention",
41
+ "full_attention",
42
+ "full_attention",
43
+ "full_attention",
44
+ "full_attention",
45
+ "full_attention",
46
+ "full_attention",
47
+ "full_attention",
48
+ "full_attention",
49
+ "full_attention",
50
+ "full_attention"
51
+ ],
52
  "max_position_embeddings": 40960,
53
  "max_window_layers": 36,
54
  "model_type": "qwen3",
 
58
  "quantization_config": {
59
  "bits": 4,
60
  "checkpoint_format": "gptq",
61
+ "desc_act": false,
62
  "group_size": 128,
63
+ "hyb_act": false,
64
  "lm_head": false,
65
  "meta": {
66
+ "damp_auto_increment": 0.01,
67
+ "damp_percent": 0.05,
68
  "mse": 0.0,
69
  "quantizer": [
70
+ "gptqmodel:4.0.0"
71
  ],
72
  "static_groups": false,
73
  "true_sequential": true,
74
+ "uri": "https://github.com/modelcloud/gptqmodel",
75
+ "v2": false,
76
+ "v2_alpha": 0.25
77
  },
78
  "pack_dtype": "int32",
79
  "quant_method": "gptq",
 
85
  "sliding_window": null,
86
  "tie_word_embeddings": true,
87
  "torch_dtype": "bfloat16",
88
+ "transformers_version": "4.55.4",
89
  "use_cache": true,
90
  "use_sliding_window": false,
91
  "vocab_size": 151936
generation_config.json CHANGED
@@ -9,5 +9,5 @@
9
  "temperature": 0.6,
10
  "top_k": 20,
11
  "top_p": 0.95,
12
- "transformers_version": "4.51.3"
13
  }
 
9
  "temperature": 0.6,
10
  "top_k": 20,
11
  "top_p": 0.95,
12
+ "transformers_version": "4.55.4"
13
  }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7f41fca2ecc8545feae17b59e491521d5ab0ee5a4dfc160d0535ed8bcd4e8b3e
3
  size 2669888648
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e890c8ea503e1ee7ca6573d4f063fa63775e31f83608d07be01431d2a059f7a0
3
  size 2669888648
quantize_config.json CHANGED
@@ -1,7 +1,8 @@
1
  {
2
  "bits": 4,
3
  "group_size": 128,
4
- "desc_act": true,
 
5
  "sym": true,
6
  "lm_head": false,
7
  "quant_method": "gptq",
@@ -9,13 +10,15 @@
9
  "pack_dtype": "int32",
10
  "meta": {
11
  "quantizer": [
12
- "gptqmodel:2.2.0"
13
  ],
14
  "uri": "https://github.com/modelcloud/gptqmodel",
15
- "damp_percent": 0.01,
16
- "damp_auto_increment": 0.0025,
17
  "static_groups": false,
18
  "true_sequential": true,
19
- "mse": 0.0
 
 
20
  }
21
  }
 
1
  {
2
  "bits": 4,
3
  "group_size": 128,
4
+ "desc_act": false,
5
+ "hyb_act": false,
6
  "sym": true,
7
  "lm_head": false,
8
  "quant_method": "gptq",
 
10
  "pack_dtype": "int32",
11
  "meta": {
12
  "quantizer": [
13
+ "gptqmodel:4.0.0"
14
  ],
15
  "uri": "https://github.com/modelcloud/gptqmodel",
16
+ "damp_percent": 0.05,
17
+ "damp_auto_increment": 0.01,
18
  "static_groups": false,
19
  "true_sequential": true,
20
+ "mse": 0.0,
21
+ "v2": false,
22
+ "v2_alpha": 0.25
23
  }
24
  }
tokenizer_config.json CHANGED
@@ -227,7 +227,6 @@
227
  "<|video_pad|>"
228
  ],
229
  "bos_token": null,
230
- "chat_template": "{%- if tools %}\n {{- '<|im_start|>system\\n' }}\n {%- if messages[0].role == 'system' %}\n {{- messages[0].content + '\\n\\n' }}\n {%- endif %}\n {{- \"# Tools\\n\\nYou may call one or more functions to assist with the user query.\\n\\nYou are provided with function signatures within <tools></tools> XML tags:\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\\n\\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\\n<tool_call>\\n{\\\"name\\\": <function-name>, \\\"arguments\\\": <args-json-object>}\\n</tool_call><|im_end|>\\n\" }}\n{%- else %}\n {%- if messages[0].role == 'system' %}\n {{- '<|im_start|>system\\n' + messages[0].content + '<|im_end|>\\n' }}\n {%- endif %}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- if (message.role == \"user\") or (message.role == \"system\" and not loop.first) %}\n {{- '<|im_start|>' + message.role + '\\n' + message.content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set content = message.content %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is defined and message.reasoning_content is not none %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in message.content %}\n {%- set content = message.content.split('</think>')[-1].lstrip('\\n') %}\n {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- if loop.index0 > ns.last_query_index %}\n {%- if loop.last or (not loop.last and reasoning_content) %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content.strip('\\n') + '\\n</think>\\n\\n' + content.lstrip('\\n') }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls %}\n {%- for tool_call in message.tool_calls %}\n {%- if (loop.first and content) or (not loop.first) %}\n {{- '\\n' }}\n {%- endif %}\n {%- if tool_call.function %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {{- '<tool_call>\\n{\"name\": \"' }}\n {{- tool_call.name }}\n {{- '\", \"arguments\": ' }}\n {%- if tool_call.arguments is string %}\n {{- tool_call.arguments }}\n {%- else %}\n {{- tool_call.arguments | tojson }}\n {%- endif %}\n {{- '}\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.first or (messages[loop.index0 - 1].role != \"tool\") %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- message.content }}\n {{- '\\n</tool_response>' }}\n {%- if loop.last or (messages[loop.index0 + 1].role != \"tool\") %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {%- if enable_thinking is defined and enable_thinking is false %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}",
231
  "clean_up_tokenization_spaces": false,
232
  "eos_token": "<|im_end|>",
233
  "errors": "replace",
 
227
  "<|video_pad|>"
228
  ],
229
  "bos_token": null,
 
230
  "clean_up_tokenization_spaces": false,
231
  "eos_token": "<|im_end|>",
232
  "errors": "replace",