Upload folder using huggingface_hub
Browse files- .gitattributes +3 -0
- README.md +40 -0
- chat_template.jinja +87 -0
- config.json +1 -0
- dd_metastate_Llm_Token_MatMulNBits_2_0.ctrlpkt +0 -0
- dd_metastate_Llm_Token_MatMulNBits_2_0.fconst +3 -0
- dd_metastate_Llm_Token_MatMulNBits_2_0.state +3 -0
- dd_metastate_Llm_Token_MatMulNBits_2_0.super +0 -0
- fusion.onnx +3 -0
- fusion.onnx.data +3 -0
- genai_config.json +59 -0
- prefill.bin +3 -0
- prefill.pb.bin +3 -0
- rai_config.json +11 -0
- special_tokens_map.json +30 -0
- tokenizer.json +0 -0
- tokenizer.model +3 -0
- tokenizer_config.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
dd_metastate_Llm_Token_MatMulNBits_2_0.fconst filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
dd_metastate_Llm_Token_MatMulNBits_2_0.state filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
fusion.onnx.data filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
language:
|
| 3 |
+
- zh
|
| 4 |
+
- en
|
| 5 |
+
tags:
|
| 6 |
+
- glm
|
| 7 |
+
- chatglm
|
| 8 |
+
- thudm
|
| 9 |
+
- ryzenai-npu
|
| 10 |
+
base_model: THUDM/chatglm3-6b
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# chatglm3-6b
|
| 14 |
+
- ## Introduction
|
| 15 |
+
This model was created using Quark Quantization, followed by OGA Model Builder, and finalized with post-processing for NPU deployment.
|
| 16 |
+
- ## Quantization Strategy
|
| 17 |
+
- AWQ / Group 128 / Asymmetric / BF16 activations / UINT4 weights
|
| 18 |
+
|
| 19 |
+
- ## Quick Start
|
| 20 |
+
For quickstart, refer to [Ryzen AI doucmentation](https://ryzenai.docs.amd.com/en/latest/npu_oga.html)
|
| 21 |
+
|
| 22 |
+
#### Evaluation scores
|
| 23 |
+
The perplexity measurement is run on the wikitext-2-raw-v1 (raw data) dataset provided by Hugging Face. Perplexity score measured for prompt length 2k is 29.81679.
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
#### License
|
| 28 |
+
Modifications copyright(c) 2024 Advanced Micro Devices,Inc. All rights reserved.
|
| 29 |
+
|
| 30 |
+
Licensed under the Apache License, Version 2.0 (the "License");
|
| 31 |
+
you may not use this file except in compliance with the License.
|
| 32 |
+
You may obtain a copy of the License at
|
| 33 |
+
|
| 34 |
+
http://www.apache.org/licenses/LICENSE-2.0
|
| 35 |
+
|
| 36 |
+
Unless required by applicable law or agreed to in writing, software
|
| 37 |
+
distributed under the License is distributed on an "AS IS" BASIS,
|
| 38 |
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 39 |
+
See the License for the specific language governing permissions and
|
| 40 |
+
limitations under the License.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if messages[0]["role"] == "system" %}
|
| 2 |
+
{%- set system_message = messages[0]["content"] %}
|
| 3 |
+
{%- set loop_messages = messages[1:] %}
|
| 4 |
+
{%- else %}
|
| 5 |
+
{%- set loop_messages = messages %}
|
| 6 |
+
{%- endif %}
|
| 7 |
+
{%- if not tools is defined %}
|
| 8 |
+
{%- set tools = none %}
|
| 9 |
+
{%- endif %}
|
| 10 |
+
{%- set user_messages = loop_messages | selectattr("role", "equalto", "user") | list %}
|
| 11 |
+
|
| 12 |
+
{#- This block checks for alternating user/assistant messages, skipping tool calling messages #}
|
| 13 |
+
{%- set ns = namespace() %}
|
| 14 |
+
{%- set ns.index = 0 %}
|
| 15 |
+
{%- for message in loop_messages %}
|
| 16 |
+
{%- if not (message.role == "tool" or message.role == "tool_results" or (message.tool_calls is defined and message.tool_calls is not none)) %}
|
| 17 |
+
{%- if (message["role"] == "user") != (ns.index % 2 == 0) %}
|
| 18 |
+
{{- raise_exception("After the optional system message, conversation roles must alternate user/assistant/user/assistant/...") }}
|
| 19 |
+
{%- endif %}
|
| 20 |
+
{%- set ns.index = ns.index + 1 %}
|
| 21 |
+
{%- endif %}
|
| 22 |
+
{%- endfor %}
|
| 23 |
+
|
| 24 |
+
{{- bos_token }}
|
| 25 |
+
{%- for message in loop_messages %}
|
| 26 |
+
{%- if message["role"] == "user" %}
|
| 27 |
+
{%- if tools is not none and (message == user_messages[-1]) %}
|
| 28 |
+
{{- "[AVAILABLE_TOOLS] [" }}
|
| 29 |
+
{%- for tool in tools %}
|
| 30 |
+
{%- set tool = tool.function %}
|
| 31 |
+
{{- '{"type": "function", "function": {' }}
|
| 32 |
+
{%- for key, val in tool.items() if key != "return" %}
|
| 33 |
+
{%- if val is string %}
|
| 34 |
+
{{- '"' + key + '": "' + val + '"' }}
|
| 35 |
+
{%- else %}
|
| 36 |
+
{{- '"' + key + '": ' + val|tojson }}
|
| 37 |
+
{%- endif %}
|
| 38 |
+
{%- if not loop.last %}
|
| 39 |
+
{{- ", " }}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- endfor %}
|
| 42 |
+
{{- "}}" }}
|
| 43 |
+
{%- if not loop.last %}
|
| 44 |
+
{{- ", " }}
|
| 45 |
+
{%- else %}
|
| 46 |
+
{{- "]" }}
|
| 47 |
+
{%- endif %}
|
| 48 |
+
{%- endfor %}
|
| 49 |
+
{{- "[/AVAILABLE_TOOLS]" }}
|
| 50 |
+
{%- endif %}
|
| 51 |
+
{%- if loop.last and system_message is defined %}
|
| 52 |
+
{{- "[INST] " + system_message + "\n\n" + message["content"] + "[/INST]" }}
|
| 53 |
+
{%- else %}
|
| 54 |
+
{{- "[INST] " + message["content"] + "[/INST]" }}
|
| 55 |
+
{%- endif %}
|
| 56 |
+
{%- elif message.tool_calls is defined and message.tool_calls is not none %}
|
| 57 |
+
{{- "[TOOL_CALLS] [" }}
|
| 58 |
+
{%- for tool_call in message.tool_calls %}
|
| 59 |
+
{%- set out = tool_call.function|tojson %}
|
| 60 |
+
{{- out[:-1] }}
|
| 61 |
+
{%- if not tool_call.id is defined or tool_call.id|length != 9 %}
|
| 62 |
+
{{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
|
| 63 |
+
{%- endif %}
|
| 64 |
+
{{- ', "id": "' + tool_call.id + '"}' }}
|
| 65 |
+
{%- if not loop.last %}
|
| 66 |
+
{{- ", " }}
|
| 67 |
+
{%- else %}
|
| 68 |
+
{{- "]" + eos_token }}
|
| 69 |
+
{%- endif %}
|
| 70 |
+
{%- endfor %}
|
| 71 |
+
{%- elif message["role"] == "assistant" %}
|
| 72 |
+
{{- " " + message["content"]|trim + eos_token}}
|
| 73 |
+
{%- elif message["role"] == "tool_results" or message["role"] == "tool" %}
|
| 74 |
+
{%- if message.content is defined and message.content.content is defined %}
|
| 75 |
+
{%- set content = message.content.content %}
|
| 76 |
+
{%- else %}
|
| 77 |
+
{%- set content = message.content %}
|
| 78 |
+
{%- endif %}
|
| 79 |
+
{{- '[TOOL_RESULTS] {"content": ' + content|string + ", " }}
|
| 80 |
+
{%- if not message.tool_call_id is defined or message.tool_call_id|length != 9 %}
|
| 81 |
+
{{- raise_exception("Tool call IDs should be alphanumeric strings with length 9!") }}
|
| 82 |
+
{%- endif %}
|
| 83 |
+
{{- '"call_id": "' + message.tool_call_id + '"}[/TOOL_RESULTS]' }}
|
| 84 |
+
{%- else %}
|
| 85 |
+
{{- raise_exception("Only user and assistant roles are supported, with the exception of an initial optional system message!") }}
|
| 86 |
+
{%- endif %}
|
| 87 |
+
{%- endfor %}
|
config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{}
|
dd_metastate_Llm_Token_MatMulNBits_2_0.ctrlpkt
ADDED
|
File without changes
|
dd_metastate_Llm_Token_MatMulNBits_2_0.fconst
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:570049a214b6e12bb102831da55c1c4877854546e4aadceb9fe18f1d99863f10
|
| 3 |
+
size 3917510656
|
dd_metastate_Llm_Token_MatMulNBits_2_0.state
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f13bca31f55cf178ee77dfe971ed8f80dbec8410cb51ab6ad62d1adacefbfce4
|
| 3 |
+
size 10521913
|
dd_metastate_Llm_Token_MatMulNBits_2_0.super
ADDED
|
File without changes
|
fusion.onnx
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3091ce01ce42d8fd0e1318fe4c9781dbfd4b105bd16e2f42353c97f006510693
|
| 3 |
+
size 8868674
|
fusion.onnx.data
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:063815b53487e9185cea88255dc081d6560bfdea0d58fe7460482b64477cf75e
|
| 3 |
+
size 277356544
|
genai_config.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"model": {
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"context_length": 32768,
|
| 5 |
+
"decoder": {
|
| 6 |
+
"session_options": {
|
| 7 |
+
"log_id": "onnxruntime-genai",
|
| 8 |
+
"custom_ops_library": "onnx_custom_ops.dll",
|
| 9 |
+
"custom_allocator": "ryzen_mm",
|
| 10 |
+
"external_data_file": "prefill.pb.bin",
|
| 11 |
+
"config_entries": {
|
| 12 |
+
"hybrid_opt_token_backend": "npu",
|
| 13 |
+
"max_length_for_kv_cache": "4096",
|
| 14 |
+
"hybrid_opt_gpu_jit": "5",
|
| 15 |
+
"hybrid_opt_max_seq_length": "4096"
|
| 16 |
+
},
|
| 17 |
+
"provider_options": []
|
| 18 |
+
},
|
| 19 |
+
"filename": "fusion.onnx",
|
| 20 |
+
"head_size": 128,
|
| 21 |
+
"hidden_size": 4096,
|
| 22 |
+
"inputs": {
|
| 23 |
+
"input_ids": "input_ids",
|
| 24 |
+
"attention_mask": "attention_mask",
|
| 25 |
+
"position_ids": "position_ids",
|
| 26 |
+
"past_key_names": "past_key_values.%d.key",
|
| 27 |
+
"past_value_names": "past_key_values.%d.value"
|
| 28 |
+
},
|
| 29 |
+
"outputs": {
|
| 30 |
+
"logits": "logits",
|
| 31 |
+
"present_key_names": "present.%d.key",
|
| 32 |
+
"present_value_names": "present.%d.value"
|
| 33 |
+
},
|
| 34 |
+
"num_attention_heads": 32,
|
| 35 |
+
"num_hidden_layers": 32,
|
| 36 |
+
"num_key_value_heads": 8
|
| 37 |
+
},
|
| 38 |
+
"eos_token_id": 2,
|
| 39 |
+
"pad_token_id": 2,
|
| 40 |
+
"type": "mistral",
|
| 41 |
+
"vocab_size": 32768
|
| 42 |
+
},
|
| 43 |
+
"search": {
|
| 44 |
+
"diversity_penalty": 0.0,
|
| 45 |
+
"do_sample": false,
|
| 46 |
+
"early_stopping": true,
|
| 47 |
+
"length_penalty": 1.0,
|
| 48 |
+
"max_length": 32768,
|
| 49 |
+
"min_length": 0,
|
| 50 |
+
"no_repeat_ngram_size": 0,
|
| 51 |
+
"num_beams": 1,
|
| 52 |
+
"num_return_sequences": 1,
|
| 53 |
+
"past_present_share_buffer": true,
|
| 54 |
+
"repetition_penalty": 1.0,
|
| 55 |
+
"temperature": 1.0,
|
| 56 |
+
"top_k": 50,
|
| 57 |
+
"top_p": 1.0
|
| 58 |
+
}
|
| 59 |
+
}
|
prefill.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:dac5a301a1571c6c780e09f344b02e024c734768d71a0fda4c3271a03c13c7e7
|
| 3 |
+
size 3874881536
|
prefill.pb.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cf781541a94c654fce9903339ef253e3bfd6978133ab8256034fd6aa0d87e5a2
|
| 3 |
+
size 8259
|
rai_config.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"max_prompt_length": {
|
| 3 |
+
"1.3.1": 2048,
|
| 4 |
+
"1.4.0": 2048,
|
| 5 |
+
"1.4.1": 2048,
|
| 6 |
+
"1.5.0": 2048,
|
| 7 |
+
"1.5.1" : 2048,
|
| 8 |
+
"1.6.0": 4096
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "</s>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:37f00374dea48658ee8f5d0f21895b9bc55cb0103939607c8185bfd1c6ca1f89
|
| 3 |
+
size 587404
|
tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|