sudo-0x2a commited on
Commit
7144154
·
verified ·
1 Parent(s): fabdab6

Add files using upload-large-folder tool

Browse files
README.md CHANGED
@@ -1,20 +1,17 @@
1
- ---
2
- license: apache-2.0
3
- library_name: mlx
4
- tags:
5
- - mlx
6
- pipeline_tag: text-generation
7
- base_model: deepseek-ai/DeepSeek-R1-0528-Qwen3-8B
8
- ---
9
 
10
  # mlx-community/DeepSeek-R1-0528-Qwen3-8B-4bit-AWQ
11
 
12
  This model [mlx-community/DeepSeek-R1-0528-Qwen3-8B-4bit-AWQ](https://huggingface.co/mlx-community/DeepSeek-R1-0528-Qwen3-8B-4bit-AWQ) was
13
  converted to MLX format from [deepseek-ai/DeepSeek-R1-0528-Qwen3-8B](https://huggingface.co/deepseek-ai/DeepSeek-R1-0528-Qwen3-8B)
14
- using mlx-lm version **0.24.1**.
15
-
16
- AWQ Parameters:
17
- --bits 4 --num-samples 256 --group-size 64 --sequence-length 1024, with a custom calibration dataset
18
 
19
  ## Use with mlx
20
 
@@ -36,4 +33,4 @@ if tokenizer.chat_template is not None:
36
  )
37
 
38
  response = generate(model, tokenizer, prompt=prompt, verbose=True)
39
- ```
 
1
+ ---
2
+ license: mit
3
+ library_name: mlx
4
+ tags:
5
+ - mlx
6
+ base_model: deepseek-ai/DeepSeek-R1-0528-Qwen3-8B
7
+ pipeline_tag: text-generation
8
+ ---
9
 
10
  # mlx-community/DeepSeek-R1-0528-Qwen3-8B-4bit-AWQ
11
 
12
  This model [mlx-community/DeepSeek-R1-0528-Qwen3-8B-4bit-AWQ](https://huggingface.co/mlx-community/DeepSeek-R1-0528-Qwen3-8B-4bit-AWQ) was
13
  converted to MLX format from [deepseek-ai/DeepSeek-R1-0528-Qwen3-8B](https://huggingface.co/deepseek-ai/DeepSeek-R1-0528-Qwen3-8B)
14
+ using mlx-lm version **0.25.2**.
 
 
 
15
 
16
  ## Use with mlx
17
 
 
33
  )
34
 
35
  response = generate(model, tokenizer, prompt=prompt, verbose=True)
36
+ ```
chat_template.jinja ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- if not add_generation_prompt is defined %}
2
+ {%- set add_generation_prompt = false %}
3
+ {%- endif %}
4
+ {%- set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='', is_first_sp=true, is_last_user=false) %}
5
+ {%- for message in messages %}
6
+ {%- if message['role'] == 'system' %}
7
+ {%- if ns.is_first_sp %}
8
+ {%- set ns.system_prompt = ns.system_prompt + message['content'] %}
9
+ {%- set ns.is_first_sp = false %}
10
+ {%- else %}
11
+ {%- set ns.system_prompt = ns.system_prompt + '\n\n' + message['content'] %}
12
+ {%- endif %}
13
+ {%- endif %}
14
+ {%- endfor %}
15
+
16
+ {#- Adapted from https://github.com/sgl-project/sglang/blob/main/examples/chat_template/tool_chat_template_deepseekr1.jinja #}
17
+ {%- if tools is defined and tools is not none %}
18
+ {%- set tool_ns = namespace(text='You are a helpful assistant with tool calling capabilities. ' + 'When a tool call is needed, you MUST use the following format to issue the call:\n' + '<|tool▁calls▁begin|><|tool▁call▁begin|>function<|tool▁sep|>FUNCTION_NAME\n' + '```json\n{"param1": "value1", "param2": "value2"}\n```<|tool▁call▁end|><|tool▁calls▁end|>\n\n' + 'Make sure the JSON is valid.' + '## Tools\n\n### Function\n\nYou have the following functions available:\n\n') %}
19
+ {%- for tool in tools %}
20
+ {%- set tool_ns.text = tool_ns.text + '\n```json\n' + (tool | tojson) + '\n```\n' %}
21
+ {%- endfor %}
22
+ {%- if ns.system_prompt|length != 0 %}
23
+ {%- set ns.system_prompt = ns.system_prompt + '\n\n' + tool_ns.text %}
24
+ {%- else %}
25
+ {%- set ns.system_prompt = tool_ns.text %}
26
+ {%- endif %}
27
+ {%- endif %}
28
+ {{- bos_token }}
29
+ {{- ns.system_prompt }}
30
+ {%- set last_index = (messages|length - 1) %}
31
+ {%- for message in messages %}
32
+ {%- set content = message['content'] %}
33
+ {%- if message['role'] == 'user' %}
34
+ {%- set ns.is_tool = false -%}
35
+ {%- set ns.is_first = false -%}
36
+ {%- set ns.is_last_user = true -%}
37
+ {%- if loop.index0 == last_index %}
38
+ {{- '<|User|>' + content }}
39
+ {%- else %}
40
+ {{- '<|User|>' + content + '<|Assistant|>'}}
41
+ {%- endif %}
42
+ {%- endif %}
43
+ {%- if message['role'] == 'assistant' %}
44
+ {%- if '</think>' in content %}
45
+ {%- set content = (content.split('</think>')|last) %}
46
+ {%- endif %}
47
+ {%- endif %}
48
+ {%- if message['role'] == 'assistant' and message['tool_calls'] is defined and message['tool_calls'] is not none %}
49
+ {%- set ns.is_last_user = false -%}
50
+ {%- if ns.is_tool %}
51
+ {{- '<|tool▁outputs▁end|>'}}
52
+ {%- endif %}
53
+ {%- set ns.is_first = false %}
54
+ {%- set ns.is_tool = false -%}
55
+ {%- set ns.is_output_first = true %}
56
+ {%- for tool in message['tool_calls'] %}
57
+ {%- set arguments = tool['function']['arguments'] %}
58
+ {%- if arguments is not string %}
59
+ {%- set arguments = arguments|tojson %}
60
+ {%- endif %}
61
+ {%- if not ns.is_first %}
62
+ {%- if content is none %}
63
+ {{- '<|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + arguments + '\n' + '```' + '<|tool▁call▁end|>'}}
64
+ }
65
+ {%- else %}
66
+ {{- content + '<|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + arguments + '\n' + '```' + '<|tool▁call▁end|>'}}
67
+ {%- endif %}
68
+ {%- set ns.is_first = true -%}
69
+ {%- else %}
70
+ {{- '\n' + '<|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + arguments + '\n' + '```' + '<|tool▁call▁end|>'}}
71
+ {%- endif %}
72
+ {%- endfor %}
73
+ {{- '<|tool▁calls▁end|><|end▁of▁sentence|>'}}
74
+ {%- endif %}
75
+ {%- if message['role'] == 'assistant' and (message['tool_calls'] is not defined or message['tool_calls'] is none) %}
76
+ {%- set ns.is_last_user = false -%}
77
+ {%- if ns.is_tool %}
78
+ {{- '<|tool▁outputs▁end|>' + content + '<|end▁of▁sentence|>'}}
79
+ {%- set ns.is_tool = false -%}
80
+ {%- else %}
81
+ {{- content + '<|end▁of▁sentence|>'}}
82
+ {%- endif %}
83
+ {%- endif %}
84
+ {%- if message['role'] == 'tool' %}
85
+ {%- set ns.is_last_user = false -%}
86
+ {%- set ns.is_tool = true -%}
87
+ {%- if ns.is_output_first %}
88
+ {{- '<|tool▁outputs▁begin|><|tool▁output▁begin|>' + content + '<|tool▁output▁end|>'}}
89
+ {%- set ns.is_output_first = false %}
90
+ {%- else %}
91
+ {{- '\n<|tool▁output▁begin|>' + content + '<|tool▁output▁end|>'}}
92
+ {%- endif %}
93
+ {%- endif %}
94
+ {%- endfor -%}
95
+ {%- if ns.is_tool %}
96
+ {{- '<|tool▁outputs▁end|>'}}
97
+ {%- endif %}
98
+ {#- if add_generation_prompt and not ns.is_last_user and not ns.is_tool #}
99
+ {%- if add_generation_prompt and not ns.is_tool %}
100
+ {{- '<|Assistant|>'}}
101
+ {%- endif %}
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f6e3b583241de5a9c6ca377239fa56415f42c5338db8bd0016ecce1f84f4d809
3
  size 4685626408
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6855552e30af2a06fcbfaba711352e460ee4df303d3fcea7d1fdae63e2b271fc
3
  size 4685626408
model.safetensors.index.json CHANGED
@@ -1,6 +1,7 @@
1
  {
2
  "metadata": {
3
- "total_size": 4685522944
 
4
  },
5
  "weight_map": {
6
  "lm_head.biases": "model.safetensors",
 
1
  {
2
  "metadata": {
3
+ "total_size": 4685522944,
4
+ "total_parameters": 8190735360
5
  },
6
  "weight_map": {
7
  "lm_head.biases": "model.safetensors",
tokenizer_config.json CHANGED
@@ -229,15 +229,16 @@
229
  }
230
  },
231
  "bos_token": "<|begin▁of▁sentence|>",
232
- "chat_template": "{% if not add_generation_prompt is defined %}{% set add_generation_prompt = false %}{% endif %}{% set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='', is_first_sp=true, is_last_user=false) %}{%- for message in messages %}{%- if message['role'] == 'system' %}{%- if ns.is_first_sp %}{% set ns.system_prompt = ns.system_prompt + message['content'] %}{% set ns.is_first_sp = false %}{%- else %}{% set ns.system_prompt = ns.system_prompt + '\n\n' + message['content'] %}{%- endif %}{%- endif %}{%- endfor %}{{ bos_token }}{{ ns.system_prompt }}{%- for message in messages %}{% set content = message['content'] %}{%- if message['role'] == 'user' %}{%- set ns.is_tool = false -%}{%- set ns.is_first = false -%}{%- set ns.is_last_user = true -%}{{'<|User|>' + content + '<|Assistant|>'}}{%- endif %}{%- if message['role'] == 'assistant' %}{% if '</think>' in content %}{% set content = content.split('</think>')[-1] %}{% endif %}{% endif %}{%- if message['role'] == 'assistant' and message['tool_calls'] is defined and message['tool_calls'] is not none %}{%- set ns.is_last_user = false -%}{%- if ns.is_tool %}{{'<|tool▁outputs▁end|>'}}{%- endif %}{%- set ns.is_first = false %}{%- set ns.is_tool = false -%}{%- set ns.is_output_first = true %}{%- for tool in message['tool_calls'] %}{%- if not ns.is_first %}{%- if content is none %}{{'<|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + tool['function']['arguments'] + '\n' + '```' + '<|tool▁call▁end|>'}}{%- else %}{{content + '<|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + tool['function']['arguments'] + '\n' + '```' + '<|tool▁call▁end|>'}}{%- endif %}{%- set ns.is_first = true -%}{%- else %}{{'\n' + '<|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\n' + '```json' + '\n' + tool['function']['arguments'] + '\n' + '```' + '<|tool▁call▁end|>'}}{%- endif %}{%- endfor %}{{'<|tool▁calls▁end|><|end▁of▁sentence|>'}}{%- endif %}{%- if message['role'] == 'assistant' and (message['tool_calls'] is not defined or message['tool_calls'] is none)%}{%- set ns.is_last_user = false -%}{%- if ns.is_tool %}{{'<|tool▁outputs▁end|>' + content + '<|end▁of▁sentence|>'}}{%- set ns.is_tool = false -%}{%- else %}{{content + '<|end▁of▁sentence|>'}}{%- endif %}{%- endif %}{%- if message['role'] == 'tool' %}{%- set ns.is_last_user = false -%}{%- set ns.is_tool = true -%}{%- if ns.is_output_first %}{{'<|tool▁outputs▁begin|><|tool▁output▁begin|>' + content + '<|tool▁output▁end|>'}}{%- set ns.is_output_first = false %}{%- else %}{{'\n<|tool▁output▁begin|>' + content + '<|tool▁output▁end|>'}}{%- endif %}{%- endif %}{%- endfor -%}{% if ns.is_tool %}{{'<|tool▁outputs▁end|>'}}{% endif %}{% if add_generation_prompt and not ns.is_last_user and not ns.is_tool %}{{'<|Assistant|>'}}{% endif %}",
233
  "clean_up_tokenization_spaces": false,
234
  "eos_token": "<|end▁of▁sentence|>",
235
  "extra_special_tokens": {},
236
  "legacy": true,
237
  "model_max_length": 131072,
238
- "pad_token": "<|end▁of▁sentence|>",
 
239
  "sp_model_kwargs": {},
240
  "tokenizer_class": "LlamaTokenizerFast",
241
  "unk_token": null,
242
- "use_default_system_prompt": false
243
- }
 
 
229
  }
230
  },
231
  "bos_token": "<|begin▁of▁sentence|>",
 
232
  "clean_up_tokenization_spaces": false,
233
  "eos_token": "<|end▁of▁sentence|>",
234
  "extra_special_tokens": {},
235
  "legacy": true,
236
  "model_max_length": 131072,
237
+ "pad_token": "<|vision_pad|>",
238
+ "padding_side": "left",
239
  "sp_model_kwargs": {},
240
  "tokenizer_class": "LlamaTokenizerFast",
241
  "unk_token": null,
242
+ "use_default_system_prompt": false,
243
+ "chat_template": "{%- if not add_generation_prompt is defined %}\n {%- set add_generation_prompt = false %}\n{%- endif %}\n{%- set ns = namespace(is_first=false, is_tool=false, is_output_first=true, system_prompt='', is_first_sp=true, is_last_user=false) %}\n{%- for message in messages %}\n {%- if message['role'] == 'system' %}\n {%- if ns.is_first_sp %}\n {%- set ns.system_prompt = ns.system_prompt + message['content'] %}\n {%- set ns.is_first_sp = false %}\n {%- else %}\n {%- set ns.system_prompt = ns.system_prompt + '\\n\\n' + message['content'] %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n\n{#- Adapted from https://github.com/sgl-project/sglang/blob/main/examples/chat_template/tool_chat_template_deepseekr1.jinja #}\n{%- if tools is defined and tools is not none %}\n {%- set tool_ns = namespace(text='You are a helpful assistant with tool calling capabilities. ' + 'When a tool call is needed, you MUST use the following format to issue the call:\\n' + '<|tool▁calls▁begin|><|tool▁call▁begin|>function<|tool▁sep|>FUNCTION_NAME\\n' + '```json\\n{\"param1\": \"value1\", \"param2\": \"value2\"}\\n```<|tool▁call▁end|><|tool▁calls▁end|>\\n\\n' + 'Make sure the JSON is valid.' + '## Tools\\n\\n### Function\\n\\nYou have the following functions available:\\n\\n') %}\n {%- for tool in tools %}\n {%- set tool_ns.text = tool_ns.text + '\\n```json\\n' + (tool | tojson) + '\\n```\\n' %}\n {%- endfor %}\n {%- if ns.system_prompt|length != 0 %}\n {%- set ns.system_prompt = ns.system_prompt + '\\n\\n' + tool_ns.text %}\n {%- else %}\n {%- set ns.system_prompt = tool_ns.text %}\n {%- endif %}\n{%- endif %}\n{{- bos_token }}\n{{- ns.system_prompt }}\n{%- set last_index = (messages|length - 1) %}\n{%- for message in messages %}\n {%- set content = message['content'] %}\n {%- if message['role'] == 'user' %}\n {%- set ns.is_tool = false -%}\n {%- set ns.is_first = false -%}\n {%- set ns.is_last_user = true -%}\n {%- if loop.index0 == last_index %}\n {{- '<|User|>' + content }}\n {%- else %}\n {{- '<|User|>' + content + '<|Assistant|>'}}\n {%- endif %}\n {%- endif %}\n {%- if message['role'] == 'assistant' %}\n {%- if '</think>' in content %}\n {%- set content = (content.split('</think>')|last) %}\n {%- endif %}\n {%- endif %}\n {%- if message['role'] == 'assistant' and message['tool_calls'] is defined and message['tool_calls'] is not none %}\n {%- set ns.is_last_user = false -%}\n {%- if ns.is_tool %}\n {{- '<|tool▁outputs▁end|>'}}\n {%- endif %}\n {%- set ns.is_first = false %}\n {%- set ns.is_tool = false -%}\n {%- set ns.is_output_first = true %}\n {%- for tool in message['tool_calls'] %}\n {%- set arguments = tool['function']['arguments'] %}\n {%- if arguments is not string %}\n {%- set arguments = arguments|tojson %}\n {%- endif %}\n {%- if not ns.is_first %}\n {%- if content is none %}\n {{- '<|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + arguments + '\\n' + '```' + '<|tool▁call▁end|>'}}\n }\n {%- else %}\n {{- content + '<|tool▁calls▁begin|><|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + arguments + '\\n' + '```' + '<|tool▁call▁end|>'}}\n {%- endif %}\n {%- set ns.is_first = true -%}\n {%- else %}\n {{- '\\n' + '<|tool▁call▁begin|>' + tool['type'] + '<|tool▁sep|>' + tool['function']['name'] + '\\n' + '```json' + '\\n' + arguments + '\\n' + '```' + '<|tool▁call▁end|>'}}\n {%- endif %}\n {%- endfor %}\n {{- '<|tool▁calls▁end|><|end▁of▁sentence|>'}}\n {%- endif %}\n {%- if message['role'] == 'assistant' and (message['tool_calls'] is not defined or message['tool_calls'] is none) %}\n {%- set ns.is_last_user = false -%}\n {%- if ns.is_tool %}\n {{- '<|tool▁outputs▁end|>' + content + '<|end▁of▁sentence|>'}}\n {%- set ns.is_tool = false -%}\n {%- else %}\n {{- content + '<|end▁of▁sentence|>'}}\n {%- endif %}\n {%- endif %}\n {%- if message['role'] == 'tool' %}\n {%- set ns.is_last_user = false -%}\n {%- set ns.is_tool = true -%}\n {%- if ns.is_output_first %}\n {{- '<|tool▁outputs▁begin|><|tool▁output▁begin|>' + content + '<|tool▁output▁end|>'}}\n {%- set ns.is_output_first = false %}\n {%- else %}\n {{- '\\n<|tool▁output▁begin|>' + content + '<|tool▁output▁end|>'}}\n {%- endif %}\n {%- endif %}\n{%- endfor -%}\n{%- if ns.is_tool %}\n {{- '<|tool▁outputs▁end|>'}}\n{%- endif %}\n{#- if add_generation_prompt and not ns.is_last_user and not ns.is_tool #}\n{%- if add_generation_prompt and not ns.is_tool %}\n {{- '<|Assistant|>'}}\n{%- endif %}"
244
+ }