Add files using upload-large-folder tool
Browse files- .gitattributes +1 -0
- README.md +37 -0
- SHA256SUMS +14 -0
- added_tokens.json +28 -0
- chat_template.jinja +89 -0
- config.json +80 -0
- configuration_qwen3.py +226 -0
- generation_config.json +10 -0
- merges.txt +0 -0
- model.safetensors +3 -0
- model.safetensors.index.json +661 -0
- modeling_qwen3_guard.py +643 -0
- refs/local +1 -0
- refs/main +1 -0
- special_tokens_map.json +31 -0
- tokenizer.json +3 -0
- tokenizer_config.json +239 -0
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ 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 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: mlx
|
| 3 |
+
license: apache-2.0
|
| 4 |
+
license_link: https://huggingface.co/Qwen/Qwen3Guard-Stream-8B/blob/main/LICENSE
|
| 5 |
+
base_model: Qwen/Qwen3Guard-Stream-8B
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- mlx
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# abnormalmapstudio/Qwen3Guard-Stream-8B-mxfp4-mlx
|
| 12 |
+
|
| 13 |
+
This model [abnormalmapstudio/Qwen3Guard-Stream-8B-mxfp4-mlx](https://huggingface.co/abnormalmapstudio/Qwen3Guard-Stream-8B-mxfp4-mlx) was
|
| 14 |
+
converted to MLX format from [Qwen/Qwen3Guard-Stream-8B](https://huggingface.co/Qwen/Qwen3Guard-Stream-8B)
|
| 15 |
+
using mlx-lm version **0.28.1**.
|
| 16 |
+
|
| 17 |
+
## Use with mlx
|
| 18 |
+
|
| 19 |
+
```bash
|
| 20 |
+
pip install mlx-lm
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
```python
|
| 24 |
+
from mlx_lm import load, generate
|
| 25 |
+
|
| 26 |
+
model, tokenizer = load("abnormalmapstudio/Qwen3Guard-Stream-8B-mxfp4-mlx")
|
| 27 |
+
|
| 28 |
+
prompt = "hello"
|
| 29 |
+
|
| 30 |
+
if tokenizer.chat_template is not None:
|
| 31 |
+
messages = [{"role": "user", "content": prompt}]
|
| 32 |
+
prompt = tokenizer.apply_chat_template(
|
| 33 |
+
messages, add_generation_prompt=True
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
response = generate(model, tokenizer, prompt=prompt, verbose=True)
|
| 37 |
+
```
|
SHA256SUMS
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
76f9570920df777f0ba80ba823dcf983ee5d016d4ae1af653601e289cb1d10b2 README.md
|
| 2 |
+
c0284b582e14987fbd3d5a2cb2bd139084371ed9acbae488829a1c900833c680 added_tokens.json
|
| 3 |
+
a55ee1b1660128b7098723e0abcd92caa0788061051c62d51cbe87d9cf1974d8 chat_template.jinja
|
| 4 |
+
5b843b8d39b8022d7e0dd969f37a632ca906b4c8c67c9674c2876b70b746d776 config.json
|
| 5 |
+
db0bc8f36ab1857247263250cd37d62a3be8dacb58c75f486ddfbc0510dbb83e configuration_qwen3.py
|
| 6 |
+
52a5a5dd9227794548c6de5e0a1c8bc795a662912bdae6a3a7e4226c542e835c generation_config.json
|
| 7 |
+
8831e4f1a044471340f7c0a83d7bd71306a5b867e95fd870f74d0c5308a904d5 merges.txt
|
| 8 |
+
a89de59e3808b0e949abc10d3e1aec567719d9302067fc9009e0a7de3b53b13d model.safetensors
|
| 9 |
+
630c03b73bc8fbd97b6c7b62a2d3dbf1967cfc32e8f758a9d61bc74062c09445 model.safetensors.index.json
|
| 10 |
+
69cefff967313df5d8292afe3e7a9cec1f7bad5d52a15108bb52d4cff79f62ec modeling_qwen3_guard.py
|
| 11 |
+
76862e765266b85aa9459767e33cbaf13970f327a0e88d1c65846c2ddd3a1ecd special_tokens_map.json
|
| 12 |
+
aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4 tokenizer.json
|
| 13 |
+
443bfa629eb16387a12edbf92a76f6a6f10b2af3b53d87ba1550adfcf45f7fa0 tokenizer_config.json
|
| 14 |
+
ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910 vocab.json
|
added_tokens.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"</think>": 151668,
|
| 3 |
+
"</tool_call>": 151658,
|
| 4 |
+
"</tool_response>": 151666,
|
| 5 |
+
"<think>": 151667,
|
| 6 |
+
"<tool_call>": 151657,
|
| 7 |
+
"<tool_response>": 151665,
|
| 8 |
+
"<|box_end|>": 151649,
|
| 9 |
+
"<|box_start|>": 151648,
|
| 10 |
+
"<|endoftext|>": 151643,
|
| 11 |
+
"<|file_sep|>": 151664,
|
| 12 |
+
"<|fim_middle|>": 151660,
|
| 13 |
+
"<|fim_pad|>": 151662,
|
| 14 |
+
"<|fim_prefix|>": 151659,
|
| 15 |
+
"<|fim_suffix|>": 151661,
|
| 16 |
+
"<|im_end|>": 151645,
|
| 17 |
+
"<|im_start|>": 151644,
|
| 18 |
+
"<|image_pad|>": 151655,
|
| 19 |
+
"<|object_ref_end|>": 151647,
|
| 20 |
+
"<|object_ref_start|>": 151646,
|
| 21 |
+
"<|quad_end|>": 151651,
|
| 22 |
+
"<|quad_start|>": 151650,
|
| 23 |
+
"<|repo_name|>": 151663,
|
| 24 |
+
"<|video_pad|>": 151656,
|
| 25 |
+
"<|vision_end|>": 151653,
|
| 26 |
+
"<|vision_pad|>": 151654,
|
| 27 |
+
"<|vision_start|>": 151652
|
| 28 |
+
}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 message.content is string 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.content is string %}
|
| 27 |
+
{%- set content = message.content %}
|
| 28 |
+
{%- else %}
|
| 29 |
+
{%- set content = '' %}
|
| 30 |
+
{%- endif %}
|
| 31 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 32 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 33 |
+
{%- elif message.role == "assistant" %}
|
| 34 |
+
{%- set reasoning_content = '' %}
|
| 35 |
+
{%- if message.reasoning_content is string %}
|
| 36 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 37 |
+
{%- else %}
|
| 38 |
+
{%- if '</think>' in content %}
|
| 39 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 40 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 41 |
+
{%- endif %}
|
| 42 |
+
{%- endif %}
|
| 43 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 44 |
+
{%- if loop.last or (not loop.last and reasoning_content) %}
|
| 45 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 46 |
+
{%- else %}
|
| 47 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 48 |
+
{%- endif %}
|
| 49 |
+
{%- else %}
|
| 50 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 51 |
+
{%- endif %}
|
| 52 |
+
{%- if message.tool_calls %}
|
| 53 |
+
{%- for tool_call in message.tool_calls %}
|
| 54 |
+
{%- if (loop.first and content) or (not loop.first) %}
|
| 55 |
+
{{- '\n' }}
|
| 56 |
+
{%- endif %}
|
| 57 |
+
{%- if tool_call.function %}
|
| 58 |
+
{%- set tool_call = tool_call.function %}
|
| 59 |
+
{%- endif %}
|
| 60 |
+
{{- '<tool_call>\n{"name": "' }}
|
| 61 |
+
{{- tool_call.name }}
|
| 62 |
+
{{- '", "arguments": ' }}
|
| 63 |
+
{%- if tool_call.arguments is string %}
|
| 64 |
+
{{- tool_call.arguments }}
|
| 65 |
+
{%- else %}
|
| 66 |
+
{{- tool_call.arguments | tojson }}
|
| 67 |
+
{%- endif %}
|
| 68 |
+
{{- '}\n</tool_call>' }}
|
| 69 |
+
{%- endfor %}
|
| 70 |
+
{%- endif %}
|
| 71 |
+
{{- '<|im_end|>\n' }}
|
| 72 |
+
{%- elif message.role == "tool" %}
|
| 73 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 74 |
+
{{- '<|im_start|>user' }}
|
| 75 |
+
{%- endif %}
|
| 76 |
+
{{- '\n<tool_response>\n' }}
|
| 77 |
+
{{- content }}
|
| 78 |
+
{{- '\n</tool_response>' }}
|
| 79 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 80 |
+
{{- '<|im_end|>\n' }}
|
| 81 |
+
{%- endif %}
|
| 82 |
+
{%- endif %}
|
| 83 |
+
{%- endfor %}
|
| 84 |
+
{%- if add_generation_prompt %}
|
| 85 |
+
{{- '<|im_start|>assistant\n' }}
|
| 86 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 87 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 88 |
+
{%- endif %}
|
| 89 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3ForGuardModel"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"auto_map": {
|
| 8 |
+
"AutoConfig": "configuration_qwen3.Qwen3Config",
|
| 9 |
+
"AutoModel": "modeling_qwen3_guard.Qwen3ForGuardModel"
|
| 10 |
+
},
|
| 11 |
+
"bos_token_id": 151643,
|
| 12 |
+
"eos_token_id": 151645,
|
| 13 |
+
"guard_inner_size": 512,
|
| 14 |
+
"head_dim": 128,
|
| 15 |
+
"hidden_act": "silu",
|
| 16 |
+
"hidden_size": 4096,
|
| 17 |
+
"initializer_range": 0.02,
|
| 18 |
+
"intermediate_size": 12288,
|
| 19 |
+
"max_position_embeddings": 8192,
|
| 20 |
+
"max_window_layers": 36,
|
| 21 |
+
"model_type": "qwen3",
|
| 22 |
+
"num_attention_heads": 32,
|
| 23 |
+
"num_category": 8,
|
| 24 |
+
"num_hidden_layers": 36,
|
| 25 |
+
"num_key_value_heads": 8,
|
| 26 |
+
"num_query_category": 9,
|
| 27 |
+
"num_query_risk_level": 3,
|
| 28 |
+
"num_risk_level": 3,
|
| 29 |
+
"quantization": {
|
| 30 |
+
"group_size": 32,
|
| 31 |
+
"bits": 4,
|
| 32 |
+
"mode": "mxfp4"
|
| 33 |
+
},
|
| 34 |
+
"quantization_config": {
|
| 35 |
+
"group_size": 32,
|
| 36 |
+
"bits": 4,
|
| 37 |
+
"mode": "mxfp4"
|
| 38 |
+
},
|
| 39 |
+
"query_category_map": {
|
| 40 |
+
"0": "Violent",
|
| 41 |
+
"1": "Sexual Content",
|
| 42 |
+
"2": "Self-Harm",
|
| 43 |
+
"3": "Political",
|
| 44 |
+
"4": "PII",
|
| 45 |
+
"5": "Copyright",
|
| 46 |
+
"6": "Illegal Acts",
|
| 47 |
+
"7": "Unethical",
|
| 48 |
+
"8": "Jailbreak"
|
| 49 |
+
},
|
| 50 |
+
"query_risk_level_map": {
|
| 51 |
+
"0": "Safe",
|
| 52 |
+
"1": "Unsafe",
|
| 53 |
+
"2": "Controversial"
|
| 54 |
+
},
|
| 55 |
+
"response_category_map": {
|
| 56 |
+
"0": "Violent",
|
| 57 |
+
"1": "Sexual Content",
|
| 58 |
+
"2": "Self-Harm",
|
| 59 |
+
"3": "Political",
|
| 60 |
+
"4": "PII",
|
| 61 |
+
"5": "Copyright",
|
| 62 |
+
"6": "Illegal Acts",
|
| 63 |
+
"7": "Unethical"
|
| 64 |
+
},
|
| 65 |
+
"response_risk_level_map": {
|
| 66 |
+
"0": "Safe",
|
| 67 |
+
"1": "Unsafe",
|
| 68 |
+
"2": "Controversial"
|
| 69 |
+
},
|
| 70 |
+
"rms_norm_eps": 1e-06,
|
| 71 |
+
"rope_scaling": null,
|
| 72 |
+
"rope_theta": 1000000,
|
| 73 |
+
"sliding_window": null,
|
| 74 |
+
"tie_word_embeddings": false,
|
| 75 |
+
"torch_dtype": "bfloat16",
|
| 76 |
+
"transformers_version": "4.55.0",
|
| 77 |
+
"use_cache": false,
|
| 78 |
+
"use_sliding_window": false,
|
| 79 |
+
"vocab_size": 151936
|
| 80 |
+
}
|
configuration_qwen3.py
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2024 The Qwen team, Alibaba Group and the HuggingFace Inc. team. All rights reserved.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
"""Qwen3 model configuration"""
|
| 16 |
+
|
| 17 |
+
from transformers.configuration_utils import PretrainedConfig, layer_type_validation
|
| 18 |
+
from transformers.modeling_rope_utils import rope_config_validation
|
| 19 |
+
from transformers.utils import logging
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
logger = logging.get_logger(__name__)
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class Qwen3Config(PretrainedConfig):
|
| 26 |
+
r"""
|
| 27 |
+
This is the configuration class to store the configuration of a [`Qwen3Model`]. It is used to instantiate a
|
| 28 |
+
Qwen3 model according to the specified arguments, defining the model architecture. Instantiating a configuration
|
| 29 |
+
with the defaults will yield a similar configuration to that of
|
| 30 |
+
Qwen3-8B [Qwen/Qwen3-8B](https://huggingface.co/Qwen/Qwen3-8B).
|
| 31 |
+
|
| 32 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 33 |
+
documentation from [`PretrainedConfig`] for more information.
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
Args:
|
| 37 |
+
vocab_size (`int`, *optional*, defaults to 151936):
|
| 38 |
+
Vocabulary size of the Qwen3 model. Defines the number of different tokens that can be represented by the
|
| 39 |
+
`inputs_ids` passed when calling [`Qwen3Model`]
|
| 40 |
+
hidden_size (`int`, *optional*, defaults to 4096):
|
| 41 |
+
Dimension of the hidden representations.
|
| 42 |
+
intermediate_size (`int`, *optional*, defaults to 22016):
|
| 43 |
+
Dimension of the MLP representations.
|
| 44 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
| 45 |
+
Number of hidden layers in the Transformer encoder.
|
| 46 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
| 47 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
| 48 |
+
num_key_value_heads (`int`, *optional*, defaults to 32):
|
| 49 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
| 50 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
| 51 |
+
`num_key_value_heads=1` the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
| 52 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
| 53 |
+
by meanpooling all the original heads within that group. For more details, check out [this
|
| 54 |
+
paper](https://huggingface.co/papers/2305.13245). If it is not specified, will default to `32`.
|
| 55 |
+
head_dim (`int`, *optional*, defaults to 128):
|
| 56 |
+
The attention head dimension.
|
| 57 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
| 58 |
+
The non-linear activation function (function or string) in the decoder.
|
| 59 |
+
max_position_embeddings (`int`, *optional*, defaults to 32768):
|
| 60 |
+
The maximum sequence length that this model might ever be used with.
|
| 61 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
| 62 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
| 63 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-06):
|
| 64 |
+
The epsilon used by the rms normalization layers.
|
| 65 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
| 66 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
| 67 |
+
relevant if `config.is_decoder=True`.
|
| 68 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
| 69 |
+
Whether the model's input and output word embeddings should be tied.
|
| 70 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
| 71 |
+
The base period of the RoPE embeddings.
|
| 72 |
+
rope_scaling (`Dict`, *optional*):
|
| 73 |
+
Dictionary containing the scaling configuration for the RoPE embeddings. NOTE: if you apply new rope type
|
| 74 |
+
and you expect the model to work on longer `max_position_embeddings`, we recommend you to update this value
|
| 75 |
+
accordingly.
|
| 76 |
+
Expected contents:
|
| 77 |
+
`rope_type` (`str`):
|
| 78 |
+
The sub-variant of RoPE to use. Can be one of ['default', 'linear', 'dynamic', 'yarn', 'longrope',
|
| 79 |
+
'llama3'], with 'default' being the original RoPE implementation.
|
| 80 |
+
`factor` (`float`, *optional*):
|
| 81 |
+
Used with all rope types except 'default'. The scaling factor to apply to the RoPE embeddings. In
|
| 82 |
+
most scaling types, a `factor` of x will enable the model to handle sequences of length x *
|
| 83 |
+
original maximum pre-trained length.
|
| 84 |
+
`original_max_position_embeddings` (`int`, *optional*):
|
| 85 |
+
Used with 'dynamic', 'longrope' and 'llama3'. The original max position embeddings used during
|
| 86 |
+
pretraining.
|
| 87 |
+
`attention_factor` (`float`, *optional*):
|
| 88 |
+
Used with 'yarn' and 'longrope'. The scaling factor to be applied on the attention
|
| 89 |
+
computation. If unspecified, it defaults to value recommended by the implementation, using the
|
| 90 |
+
`factor` field to infer the suggested value.
|
| 91 |
+
`beta_fast` (`float`, *optional*):
|
| 92 |
+
Only used with 'yarn'. Parameter to set the boundary for extrapolation (only) in the linear
|
| 93 |
+
ramp function. If unspecified, it defaults to 32.
|
| 94 |
+
`beta_slow` (`float`, *optional*):
|
| 95 |
+
Only used with 'yarn'. Parameter to set the boundary for interpolation (only) in the linear
|
| 96 |
+
ramp function. If unspecified, it defaults to 1.
|
| 97 |
+
`short_factor` (`list[float]`, *optional*):
|
| 98 |
+
Only used with 'longrope'. The scaling factor to be applied to short contexts (<
|
| 99 |
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
| 100 |
+
size divided by the number of attention heads divided by 2
|
| 101 |
+
`long_factor` (`list[float]`, *optional*):
|
| 102 |
+
Only used with 'longrope'. The scaling factor to be applied to long contexts (<
|
| 103 |
+
`original_max_position_embeddings`). Must be a list of numbers with the same length as the hidden
|
| 104 |
+
size divided by the number of attention heads divided by 2
|
| 105 |
+
`low_freq_factor` (`float`, *optional*):
|
| 106 |
+
Only used with 'llama3'. Scaling factor applied to low frequency components of the RoPE
|
| 107 |
+
`high_freq_factor` (`float`, *optional*):
|
| 108 |
+
Only used with 'llama3'. Scaling factor applied to high frequency components of the RoPE
|
| 109 |
+
attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
|
| 110 |
+
Whether to use a bias in the query, key, value and output projection layers during self-attention.
|
| 111 |
+
use_sliding_window (`bool`, *optional*, defaults to `False`):
|
| 112 |
+
Whether to use sliding window attention.
|
| 113 |
+
sliding_window (`int`, *optional*, defaults to 4096):
|
| 114 |
+
Sliding window attention (SWA) window size. If not specified, will default to `4096`.
|
| 115 |
+
max_window_layers (`int`, *optional*, defaults to 28):
|
| 116 |
+
The number of layers using full attention. The first `max_window_layers` layers will use full attention, while any
|
| 117 |
+
additional layer afterwards will use SWA (Sliding Window Attention).
|
| 118 |
+
layer_types (`list`, *optional*):
|
| 119 |
+
Attention pattern for each layer.
|
| 120 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
| 121 |
+
The dropout ratio for the attention probabilities.
|
| 122 |
+
|
| 123 |
+
```python
|
| 124 |
+
>>> from transformers import Qwen3Model, Qwen3Config
|
| 125 |
+
|
| 126 |
+
>>> # Initializing a Qwen3 style configuration
|
| 127 |
+
>>> configuration = Qwen3Config()
|
| 128 |
+
|
| 129 |
+
>>> # Initializing a model from the Qwen3-8B style configuration
|
| 130 |
+
>>> model = Qwen3Model(configuration)
|
| 131 |
+
|
| 132 |
+
>>> # Accessing the model configuration
|
| 133 |
+
>>> configuration = model.config
|
| 134 |
+
```"""
|
| 135 |
+
|
| 136 |
+
model_type = "qwen3"
|
| 137 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 138 |
+
|
| 139 |
+
# Default tensor parallel plan for base model `Qwen3`
|
| 140 |
+
base_model_tp_plan = {
|
| 141 |
+
"layers.*.self_attn.q_proj": "colwise",
|
| 142 |
+
"layers.*.self_attn.k_proj": "colwise",
|
| 143 |
+
"layers.*.self_attn.v_proj": "colwise",
|
| 144 |
+
"layers.*.self_attn.o_proj": "rowwise",
|
| 145 |
+
"layers.*.mlp.gate_proj": "colwise",
|
| 146 |
+
"layers.*.mlp.up_proj": "colwise",
|
| 147 |
+
"layers.*.mlp.down_proj": "rowwise",
|
| 148 |
+
}
|
| 149 |
+
base_model_pp_plan = {
|
| 150 |
+
"embed_tokens": (["input_ids"], ["inputs_embeds"]),
|
| 151 |
+
"layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
|
| 152 |
+
"norm": (["hidden_states"], ["hidden_states"]),
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
def __init__(
|
| 156 |
+
self,
|
| 157 |
+
vocab_size=151936,
|
| 158 |
+
hidden_size=4096,
|
| 159 |
+
intermediate_size=22016,
|
| 160 |
+
num_hidden_layers=32,
|
| 161 |
+
num_attention_heads=32,
|
| 162 |
+
num_key_value_heads=32,
|
| 163 |
+
head_dim=128,
|
| 164 |
+
hidden_act="silu",
|
| 165 |
+
max_position_embeddings=32768,
|
| 166 |
+
initializer_range=0.02,
|
| 167 |
+
rms_norm_eps=1e-6,
|
| 168 |
+
use_cache=True,
|
| 169 |
+
tie_word_embeddings=False,
|
| 170 |
+
rope_theta=10000.0,
|
| 171 |
+
rope_scaling=None,
|
| 172 |
+
attention_bias=False,
|
| 173 |
+
use_sliding_window=False,
|
| 174 |
+
sliding_window=4096,
|
| 175 |
+
max_window_layers=28,
|
| 176 |
+
layer_types=None,
|
| 177 |
+
attention_dropout=0.0,
|
| 178 |
+
**kwargs,
|
| 179 |
+
):
|
| 180 |
+
self.vocab_size = vocab_size
|
| 181 |
+
self.max_position_embeddings = max_position_embeddings
|
| 182 |
+
self.hidden_size = hidden_size
|
| 183 |
+
self.intermediate_size = intermediate_size
|
| 184 |
+
self.num_hidden_layers = num_hidden_layers
|
| 185 |
+
self.num_attention_heads = num_attention_heads
|
| 186 |
+
self.use_sliding_window = use_sliding_window
|
| 187 |
+
self.sliding_window = sliding_window if self.use_sliding_window else None
|
| 188 |
+
self.max_window_layers = max_window_layers
|
| 189 |
+
|
| 190 |
+
# for backward compatibility
|
| 191 |
+
if num_key_value_heads is None:
|
| 192 |
+
num_key_value_heads = num_attention_heads
|
| 193 |
+
|
| 194 |
+
self.num_key_value_heads = num_key_value_heads
|
| 195 |
+
self.head_dim = head_dim
|
| 196 |
+
self.hidden_act = hidden_act
|
| 197 |
+
self.initializer_range = initializer_range
|
| 198 |
+
self.rms_norm_eps = rms_norm_eps
|
| 199 |
+
self.use_cache = use_cache
|
| 200 |
+
self.rope_theta = rope_theta
|
| 201 |
+
self.rope_scaling = rope_scaling
|
| 202 |
+
self.attention_bias = attention_bias
|
| 203 |
+
self.attention_dropout = attention_dropout
|
| 204 |
+
# Validate the correctness of rotary position embeddings parameters
|
| 205 |
+
# BC: if there is a 'type' field, move it to 'rope_type'.
|
| 206 |
+
if self.rope_scaling is not None and "type" in self.rope_scaling:
|
| 207 |
+
self.rope_scaling["rope_type"] = self.rope_scaling["type"]
|
| 208 |
+
rope_config_validation(self)
|
| 209 |
+
|
| 210 |
+
self.layer_types = layer_types
|
| 211 |
+
if self.layer_types is None:
|
| 212 |
+
self.layer_types = [
|
| 213 |
+
"sliding_attention"
|
| 214 |
+
if self.sliding_window is not None and i >= self.max_window_layers
|
| 215 |
+
else "full_attention"
|
| 216 |
+
for i in range(self.num_hidden_layers)
|
| 217 |
+
]
|
| 218 |
+
layer_type_validation(self.layer_types)
|
| 219 |
+
|
| 220 |
+
super().__init__(
|
| 221 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 222 |
+
**kwargs,
|
| 223 |
+
)
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
__all__ = ["Qwen3Config"]
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"do_sample": false,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
151645,
|
| 6 |
+
151643
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 151643,
|
| 9 |
+
"transformers_version": "4.55.0"
|
| 10 |
+
}
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a89de59e3808b0e949abc10d3e1aec567719d9302067fc9009e0a7de3b53b13d
|
| 3 |
+
size 4351854945
|
model.safetensors.index.json
ADDED
|
@@ -0,0 +1,661 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_size": 4351780864,
|
| 4 |
+
"total_parameters": 8190735360
|
| 5 |
+
},
|
| 6 |
+
"weight_map": {
|
| 7 |
+
"lm_head.scales": "model.safetensors",
|
| 8 |
+
"lm_head.weight": "model.safetensors",
|
| 9 |
+
"model.embed_tokens.scales": "model.safetensors",
|
| 10 |
+
"model.embed_tokens.weight": "model.safetensors",
|
| 11 |
+
"model.layers.0.input_layernorm.weight": "model.safetensors",
|
| 12 |
+
"model.layers.0.mlp.down_proj.scales": "model.safetensors",
|
| 13 |
+
"model.layers.0.mlp.down_proj.weight": "model.safetensors",
|
| 14 |
+
"model.layers.0.mlp.gate_proj.scales": "model.safetensors",
|
| 15 |
+
"model.layers.0.mlp.gate_proj.weight": "model.safetensors",
|
| 16 |
+
"model.layers.0.mlp.up_proj.scales": "model.safetensors",
|
| 17 |
+
"model.layers.0.mlp.up_proj.weight": "model.safetensors",
|
| 18 |
+
"model.layers.0.post_attention_layernorm.weight": "model.safetensors",
|
| 19 |
+
"model.layers.0.self_attn.k_norm.weight": "model.safetensors",
|
| 20 |
+
"model.layers.0.self_attn.k_proj.scales": "model.safetensors",
|
| 21 |
+
"model.layers.0.self_attn.k_proj.weight": "model.safetensors",
|
| 22 |
+
"model.layers.0.self_attn.o_proj.scales": "model.safetensors",
|
| 23 |
+
"model.layers.0.self_attn.o_proj.weight": "model.safetensors",
|
| 24 |
+
"model.layers.0.self_attn.q_norm.weight": "model.safetensors",
|
| 25 |
+
"model.layers.0.self_attn.q_proj.scales": "model.safetensors",
|
| 26 |
+
"model.layers.0.self_attn.q_proj.weight": "model.safetensors",
|
| 27 |
+
"model.layers.0.self_attn.v_proj.scales": "model.safetensors",
|
| 28 |
+
"model.layers.0.self_attn.v_proj.weight": "model.safetensors",
|
| 29 |
+
"model.layers.1.input_layernorm.weight": "model.safetensors",
|
| 30 |
+
"model.layers.1.mlp.down_proj.scales": "model.safetensors",
|
| 31 |
+
"model.layers.1.mlp.down_proj.weight": "model.safetensors",
|
| 32 |
+
"model.layers.1.mlp.gate_proj.scales": "model.safetensors",
|
| 33 |
+
"model.layers.1.mlp.gate_proj.weight": "model.safetensors",
|
| 34 |
+
"model.layers.1.mlp.up_proj.scales": "model.safetensors",
|
| 35 |
+
"model.layers.1.mlp.up_proj.weight": "model.safetensors",
|
| 36 |
+
"model.layers.1.post_attention_layernorm.weight": "model.safetensors",
|
| 37 |
+
"model.layers.1.self_attn.k_norm.weight": "model.safetensors",
|
| 38 |
+
"model.layers.1.self_attn.k_proj.scales": "model.safetensors",
|
| 39 |
+
"model.layers.1.self_attn.k_proj.weight": "model.safetensors",
|
| 40 |
+
"model.layers.1.self_attn.o_proj.scales": "model.safetensors",
|
| 41 |
+
"model.layers.1.self_attn.o_proj.weight": "model.safetensors",
|
| 42 |
+
"model.layers.1.self_attn.q_norm.weight": "model.safetensors",
|
| 43 |
+
"model.layers.1.self_attn.q_proj.scales": "model.safetensors",
|
| 44 |
+
"model.layers.1.self_attn.q_proj.weight": "model.safetensors",
|
| 45 |
+
"model.layers.1.self_attn.v_proj.scales": "model.safetensors",
|
| 46 |
+
"model.layers.1.self_attn.v_proj.weight": "model.safetensors",
|
| 47 |
+
"model.layers.10.input_layernorm.weight": "model.safetensors",
|
| 48 |
+
"model.layers.10.mlp.down_proj.scales": "model.safetensors",
|
| 49 |
+
"model.layers.10.mlp.down_proj.weight": "model.safetensors",
|
| 50 |
+
"model.layers.10.mlp.gate_proj.scales": "model.safetensors",
|
| 51 |
+
"model.layers.10.mlp.gate_proj.weight": "model.safetensors",
|
| 52 |
+
"model.layers.10.mlp.up_proj.scales": "model.safetensors",
|
| 53 |
+
"model.layers.10.mlp.up_proj.weight": "model.safetensors",
|
| 54 |
+
"model.layers.10.post_attention_layernorm.weight": "model.safetensors",
|
| 55 |
+
"model.layers.10.self_attn.k_norm.weight": "model.safetensors",
|
| 56 |
+
"model.layers.10.self_attn.k_proj.scales": "model.safetensors",
|
| 57 |
+
"model.layers.10.self_attn.k_proj.weight": "model.safetensors",
|
| 58 |
+
"model.layers.10.self_attn.o_proj.scales": "model.safetensors",
|
| 59 |
+
"model.layers.10.self_attn.o_proj.weight": "model.safetensors",
|
| 60 |
+
"model.layers.10.self_attn.q_norm.weight": "model.safetensors",
|
| 61 |
+
"model.layers.10.self_attn.q_proj.scales": "model.safetensors",
|
| 62 |
+
"model.layers.10.self_attn.q_proj.weight": "model.safetensors",
|
| 63 |
+
"model.layers.10.self_attn.v_proj.scales": "model.safetensors",
|
| 64 |
+
"model.layers.10.self_attn.v_proj.weight": "model.safetensors",
|
| 65 |
+
"model.layers.11.input_layernorm.weight": "model.safetensors",
|
| 66 |
+
"model.layers.11.mlp.down_proj.scales": "model.safetensors",
|
| 67 |
+
"model.layers.11.mlp.down_proj.weight": "model.safetensors",
|
| 68 |
+
"model.layers.11.mlp.gate_proj.scales": "model.safetensors",
|
| 69 |
+
"model.layers.11.mlp.gate_proj.weight": "model.safetensors",
|
| 70 |
+
"model.layers.11.mlp.up_proj.scales": "model.safetensors",
|
| 71 |
+
"model.layers.11.mlp.up_proj.weight": "model.safetensors",
|
| 72 |
+
"model.layers.11.post_attention_layernorm.weight": "model.safetensors",
|
| 73 |
+
"model.layers.11.self_attn.k_norm.weight": "model.safetensors",
|
| 74 |
+
"model.layers.11.self_attn.k_proj.scales": "model.safetensors",
|
| 75 |
+
"model.layers.11.self_attn.k_proj.weight": "model.safetensors",
|
| 76 |
+
"model.layers.11.self_attn.o_proj.scales": "model.safetensors",
|
| 77 |
+
"model.layers.11.self_attn.o_proj.weight": "model.safetensors",
|
| 78 |
+
"model.layers.11.self_attn.q_norm.weight": "model.safetensors",
|
| 79 |
+
"model.layers.11.self_attn.q_proj.scales": "model.safetensors",
|
| 80 |
+
"model.layers.11.self_attn.q_proj.weight": "model.safetensors",
|
| 81 |
+
"model.layers.11.self_attn.v_proj.scales": "model.safetensors",
|
| 82 |
+
"model.layers.11.self_attn.v_proj.weight": "model.safetensors",
|
| 83 |
+
"model.layers.12.input_layernorm.weight": "model.safetensors",
|
| 84 |
+
"model.layers.12.mlp.down_proj.scales": "model.safetensors",
|
| 85 |
+
"model.layers.12.mlp.down_proj.weight": "model.safetensors",
|
| 86 |
+
"model.layers.12.mlp.gate_proj.scales": "model.safetensors",
|
| 87 |
+
"model.layers.12.mlp.gate_proj.weight": "model.safetensors",
|
| 88 |
+
"model.layers.12.mlp.up_proj.scales": "model.safetensors",
|
| 89 |
+
"model.layers.12.mlp.up_proj.weight": "model.safetensors",
|
| 90 |
+
"model.layers.12.post_attention_layernorm.weight": "model.safetensors",
|
| 91 |
+
"model.layers.12.self_attn.k_norm.weight": "model.safetensors",
|
| 92 |
+
"model.layers.12.self_attn.k_proj.scales": "model.safetensors",
|
| 93 |
+
"model.layers.12.self_attn.k_proj.weight": "model.safetensors",
|
| 94 |
+
"model.layers.12.self_attn.o_proj.scales": "model.safetensors",
|
| 95 |
+
"model.layers.12.self_attn.o_proj.weight": "model.safetensors",
|
| 96 |
+
"model.layers.12.self_attn.q_norm.weight": "model.safetensors",
|
| 97 |
+
"model.layers.12.self_attn.q_proj.scales": "model.safetensors",
|
| 98 |
+
"model.layers.12.self_attn.q_proj.weight": "model.safetensors",
|
| 99 |
+
"model.layers.12.self_attn.v_proj.scales": "model.safetensors",
|
| 100 |
+
"model.layers.12.self_attn.v_proj.weight": "model.safetensors",
|
| 101 |
+
"model.layers.13.input_layernorm.weight": "model.safetensors",
|
| 102 |
+
"model.layers.13.mlp.down_proj.scales": "model.safetensors",
|
| 103 |
+
"model.layers.13.mlp.down_proj.weight": "model.safetensors",
|
| 104 |
+
"model.layers.13.mlp.gate_proj.scales": "model.safetensors",
|
| 105 |
+
"model.layers.13.mlp.gate_proj.weight": "model.safetensors",
|
| 106 |
+
"model.layers.13.mlp.up_proj.scales": "model.safetensors",
|
| 107 |
+
"model.layers.13.mlp.up_proj.weight": "model.safetensors",
|
| 108 |
+
"model.layers.13.post_attention_layernorm.weight": "model.safetensors",
|
| 109 |
+
"model.layers.13.self_attn.k_norm.weight": "model.safetensors",
|
| 110 |
+
"model.layers.13.self_attn.k_proj.scales": "model.safetensors",
|
| 111 |
+
"model.layers.13.self_attn.k_proj.weight": "model.safetensors",
|
| 112 |
+
"model.layers.13.self_attn.o_proj.scales": "model.safetensors",
|
| 113 |
+
"model.layers.13.self_attn.o_proj.weight": "model.safetensors",
|
| 114 |
+
"model.layers.13.self_attn.q_norm.weight": "model.safetensors",
|
| 115 |
+
"model.layers.13.self_attn.q_proj.scales": "model.safetensors",
|
| 116 |
+
"model.layers.13.self_attn.q_proj.weight": "model.safetensors",
|
| 117 |
+
"model.layers.13.self_attn.v_proj.scales": "model.safetensors",
|
| 118 |
+
"model.layers.13.self_attn.v_proj.weight": "model.safetensors",
|
| 119 |
+
"model.layers.14.input_layernorm.weight": "model.safetensors",
|
| 120 |
+
"model.layers.14.mlp.down_proj.scales": "model.safetensors",
|
| 121 |
+
"model.layers.14.mlp.down_proj.weight": "model.safetensors",
|
| 122 |
+
"model.layers.14.mlp.gate_proj.scales": "model.safetensors",
|
| 123 |
+
"model.layers.14.mlp.gate_proj.weight": "model.safetensors",
|
| 124 |
+
"model.layers.14.mlp.up_proj.scales": "model.safetensors",
|
| 125 |
+
"model.layers.14.mlp.up_proj.weight": "model.safetensors",
|
| 126 |
+
"model.layers.14.post_attention_layernorm.weight": "model.safetensors",
|
| 127 |
+
"model.layers.14.self_attn.k_norm.weight": "model.safetensors",
|
| 128 |
+
"model.layers.14.self_attn.k_proj.scales": "model.safetensors",
|
| 129 |
+
"model.layers.14.self_attn.k_proj.weight": "model.safetensors",
|
| 130 |
+
"model.layers.14.self_attn.o_proj.scales": "model.safetensors",
|
| 131 |
+
"model.layers.14.self_attn.o_proj.weight": "model.safetensors",
|
| 132 |
+
"model.layers.14.self_attn.q_norm.weight": "model.safetensors",
|
| 133 |
+
"model.layers.14.self_attn.q_proj.scales": "model.safetensors",
|
| 134 |
+
"model.layers.14.self_attn.q_proj.weight": "model.safetensors",
|
| 135 |
+
"model.layers.14.self_attn.v_proj.scales": "model.safetensors",
|
| 136 |
+
"model.layers.14.self_attn.v_proj.weight": "model.safetensors",
|
| 137 |
+
"model.layers.15.input_layernorm.weight": "model.safetensors",
|
| 138 |
+
"model.layers.15.mlp.down_proj.scales": "model.safetensors",
|
| 139 |
+
"model.layers.15.mlp.down_proj.weight": "model.safetensors",
|
| 140 |
+
"model.layers.15.mlp.gate_proj.scales": "model.safetensors",
|
| 141 |
+
"model.layers.15.mlp.gate_proj.weight": "model.safetensors",
|
| 142 |
+
"model.layers.15.mlp.up_proj.scales": "model.safetensors",
|
| 143 |
+
"model.layers.15.mlp.up_proj.weight": "model.safetensors",
|
| 144 |
+
"model.layers.15.post_attention_layernorm.weight": "model.safetensors",
|
| 145 |
+
"model.layers.15.self_attn.k_norm.weight": "model.safetensors",
|
| 146 |
+
"model.layers.15.self_attn.k_proj.scales": "model.safetensors",
|
| 147 |
+
"model.layers.15.self_attn.k_proj.weight": "model.safetensors",
|
| 148 |
+
"model.layers.15.self_attn.o_proj.scales": "model.safetensors",
|
| 149 |
+
"model.layers.15.self_attn.o_proj.weight": "model.safetensors",
|
| 150 |
+
"model.layers.15.self_attn.q_norm.weight": "model.safetensors",
|
| 151 |
+
"model.layers.15.self_attn.q_proj.scales": "model.safetensors",
|
| 152 |
+
"model.layers.15.self_attn.q_proj.weight": "model.safetensors",
|
| 153 |
+
"model.layers.15.self_attn.v_proj.scales": "model.safetensors",
|
| 154 |
+
"model.layers.15.self_attn.v_proj.weight": "model.safetensors",
|
| 155 |
+
"model.layers.16.input_layernorm.weight": "model.safetensors",
|
| 156 |
+
"model.layers.16.mlp.down_proj.scales": "model.safetensors",
|
| 157 |
+
"model.layers.16.mlp.down_proj.weight": "model.safetensors",
|
| 158 |
+
"model.layers.16.mlp.gate_proj.scales": "model.safetensors",
|
| 159 |
+
"model.layers.16.mlp.gate_proj.weight": "model.safetensors",
|
| 160 |
+
"model.layers.16.mlp.up_proj.scales": "model.safetensors",
|
| 161 |
+
"model.layers.16.mlp.up_proj.weight": "model.safetensors",
|
| 162 |
+
"model.layers.16.post_attention_layernorm.weight": "model.safetensors",
|
| 163 |
+
"model.layers.16.self_attn.k_norm.weight": "model.safetensors",
|
| 164 |
+
"model.layers.16.self_attn.k_proj.scales": "model.safetensors",
|
| 165 |
+
"model.layers.16.self_attn.k_proj.weight": "model.safetensors",
|
| 166 |
+
"model.layers.16.self_attn.o_proj.scales": "model.safetensors",
|
| 167 |
+
"model.layers.16.self_attn.o_proj.weight": "model.safetensors",
|
| 168 |
+
"model.layers.16.self_attn.q_norm.weight": "model.safetensors",
|
| 169 |
+
"model.layers.16.self_attn.q_proj.scales": "model.safetensors",
|
| 170 |
+
"model.layers.16.self_attn.q_proj.weight": "model.safetensors",
|
| 171 |
+
"model.layers.16.self_attn.v_proj.scales": "model.safetensors",
|
| 172 |
+
"model.layers.16.self_attn.v_proj.weight": "model.safetensors",
|
| 173 |
+
"model.layers.17.input_layernorm.weight": "model.safetensors",
|
| 174 |
+
"model.layers.17.mlp.down_proj.scales": "model.safetensors",
|
| 175 |
+
"model.layers.17.mlp.down_proj.weight": "model.safetensors",
|
| 176 |
+
"model.layers.17.mlp.gate_proj.scales": "model.safetensors",
|
| 177 |
+
"model.layers.17.mlp.gate_proj.weight": "model.safetensors",
|
| 178 |
+
"model.layers.17.mlp.up_proj.scales": "model.safetensors",
|
| 179 |
+
"model.layers.17.mlp.up_proj.weight": "model.safetensors",
|
| 180 |
+
"model.layers.17.post_attention_layernorm.weight": "model.safetensors",
|
| 181 |
+
"model.layers.17.self_attn.k_norm.weight": "model.safetensors",
|
| 182 |
+
"model.layers.17.self_attn.k_proj.scales": "model.safetensors",
|
| 183 |
+
"model.layers.17.self_attn.k_proj.weight": "model.safetensors",
|
| 184 |
+
"model.layers.17.self_attn.o_proj.scales": "model.safetensors",
|
| 185 |
+
"model.layers.17.self_attn.o_proj.weight": "model.safetensors",
|
| 186 |
+
"model.layers.17.self_attn.q_norm.weight": "model.safetensors",
|
| 187 |
+
"model.layers.17.self_attn.q_proj.scales": "model.safetensors",
|
| 188 |
+
"model.layers.17.self_attn.q_proj.weight": "model.safetensors",
|
| 189 |
+
"model.layers.17.self_attn.v_proj.scales": "model.safetensors",
|
| 190 |
+
"model.layers.17.self_attn.v_proj.weight": "model.safetensors",
|
| 191 |
+
"model.layers.18.input_layernorm.weight": "model.safetensors",
|
| 192 |
+
"model.layers.18.mlp.down_proj.scales": "model.safetensors",
|
| 193 |
+
"model.layers.18.mlp.down_proj.weight": "model.safetensors",
|
| 194 |
+
"model.layers.18.mlp.gate_proj.scales": "model.safetensors",
|
| 195 |
+
"model.layers.18.mlp.gate_proj.weight": "model.safetensors",
|
| 196 |
+
"model.layers.18.mlp.up_proj.scales": "model.safetensors",
|
| 197 |
+
"model.layers.18.mlp.up_proj.weight": "model.safetensors",
|
| 198 |
+
"model.layers.18.post_attention_layernorm.weight": "model.safetensors",
|
| 199 |
+
"model.layers.18.self_attn.k_norm.weight": "model.safetensors",
|
| 200 |
+
"model.layers.18.self_attn.k_proj.scales": "model.safetensors",
|
| 201 |
+
"model.layers.18.self_attn.k_proj.weight": "model.safetensors",
|
| 202 |
+
"model.layers.18.self_attn.o_proj.scales": "model.safetensors",
|
| 203 |
+
"model.layers.18.self_attn.o_proj.weight": "model.safetensors",
|
| 204 |
+
"model.layers.18.self_attn.q_norm.weight": "model.safetensors",
|
| 205 |
+
"model.layers.18.self_attn.q_proj.scales": "model.safetensors",
|
| 206 |
+
"model.layers.18.self_attn.q_proj.weight": "model.safetensors",
|
| 207 |
+
"model.layers.18.self_attn.v_proj.scales": "model.safetensors",
|
| 208 |
+
"model.layers.18.self_attn.v_proj.weight": "model.safetensors",
|
| 209 |
+
"model.layers.19.input_layernorm.weight": "model.safetensors",
|
| 210 |
+
"model.layers.19.mlp.down_proj.scales": "model.safetensors",
|
| 211 |
+
"model.layers.19.mlp.down_proj.weight": "model.safetensors",
|
| 212 |
+
"model.layers.19.mlp.gate_proj.scales": "model.safetensors",
|
| 213 |
+
"model.layers.19.mlp.gate_proj.weight": "model.safetensors",
|
| 214 |
+
"model.layers.19.mlp.up_proj.scales": "model.safetensors",
|
| 215 |
+
"model.layers.19.mlp.up_proj.weight": "model.safetensors",
|
| 216 |
+
"model.layers.19.post_attention_layernorm.weight": "model.safetensors",
|
| 217 |
+
"model.layers.19.self_attn.k_norm.weight": "model.safetensors",
|
| 218 |
+
"model.layers.19.self_attn.k_proj.scales": "model.safetensors",
|
| 219 |
+
"model.layers.19.self_attn.k_proj.weight": "model.safetensors",
|
| 220 |
+
"model.layers.19.self_attn.o_proj.scales": "model.safetensors",
|
| 221 |
+
"model.layers.19.self_attn.o_proj.weight": "model.safetensors",
|
| 222 |
+
"model.layers.19.self_attn.q_norm.weight": "model.safetensors",
|
| 223 |
+
"model.layers.19.self_attn.q_proj.scales": "model.safetensors",
|
| 224 |
+
"model.layers.19.self_attn.q_proj.weight": "model.safetensors",
|
| 225 |
+
"model.layers.19.self_attn.v_proj.scales": "model.safetensors",
|
| 226 |
+
"model.layers.19.self_attn.v_proj.weight": "model.safetensors",
|
| 227 |
+
"model.layers.2.input_layernorm.weight": "model.safetensors",
|
| 228 |
+
"model.layers.2.mlp.down_proj.scales": "model.safetensors",
|
| 229 |
+
"model.layers.2.mlp.down_proj.weight": "model.safetensors",
|
| 230 |
+
"model.layers.2.mlp.gate_proj.scales": "model.safetensors",
|
| 231 |
+
"model.layers.2.mlp.gate_proj.weight": "model.safetensors",
|
| 232 |
+
"model.layers.2.mlp.up_proj.scales": "model.safetensors",
|
| 233 |
+
"model.layers.2.mlp.up_proj.weight": "model.safetensors",
|
| 234 |
+
"model.layers.2.post_attention_layernorm.weight": "model.safetensors",
|
| 235 |
+
"model.layers.2.self_attn.k_norm.weight": "model.safetensors",
|
| 236 |
+
"model.layers.2.self_attn.k_proj.scales": "model.safetensors",
|
| 237 |
+
"model.layers.2.self_attn.k_proj.weight": "model.safetensors",
|
| 238 |
+
"model.layers.2.self_attn.o_proj.scales": "model.safetensors",
|
| 239 |
+
"model.layers.2.self_attn.o_proj.weight": "model.safetensors",
|
| 240 |
+
"model.layers.2.self_attn.q_norm.weight": "model.safetensors",
|
| 241 |
+
"model.layers.2.self_attn.q_proj.scales": "model.safetensors",
|
| 242 |
+
"model.layers.2.self_attn.q_proj.weight": "model.safetensors",
|
| 243 |
+
"model.layers.2.self_attn.v_proj.scales": "model.safetensors",
|
| 244 |
+
"model.layers.2.self_attn.v_proj.weight": "model.safetensors",
|
| 245 |
+
"model.layers.20.input_layernorm.weight": "model.safetensors",
|
| 246 |
+
"model.layers.20.mlp.down_proj.scales": "model.safetensors",
|
| 247 |
+
"model.layers.20.mlp.down_proj.weight": "model.safetensors",
|
| 248 |
+
"model.layers.20.mlp.gate_proj.scales": "model.safetensors",
|
| 249 |
+
"model.layers.20.mlp.gate_proj.weight": "model.safetensors",
|
| 250 |
+
"model.layers.20.mlp.up_proj.scales": "model.safetensors",
|
| 251 |
+
"model.layers.20.mlp.up_proj.weight": "model.safetensors",
|
| 252 |
+
"model.layers.20.post_attention_layernorm.weight": "model.safetensors",
|
| 253 |
+
"model.layers.20.self_attn.k_norm.weight": "model.safetensors",
|
| 254 |
+
"model.layers.20.self_attn.k_proj.scales": "model.safetensors",
|
| 255 |
+
"model.layers.20.self_attn.k_proj.weight": "model.safetensors",
|
| 256 |
+
"model.layers.20.self_attn.o_proj.scales": "model.safetensors",
|
| 257 |
+
"model.layers.20.self_attn.o_proj.weight": "model.safetensors",
|
| 258 |
+
"model.layers.20.self_attn.q_norm.weight": "model.safetensors",
|
| 259 |
+
"model.layers.20.self_attn.q_proj.scales": "model.safetensors",
|
| 260 |
+
"model.layers.20.self_attn.q_proj.weight": "model.safetensors",
|
| 261 |
+
"model.layers.20.self_attn.v_proj.scales": "model.safetensors",
|
| 262 |
+
"model.layers.20.self_attn.v_proj.weight": "model.safetensors",
|
| 263 |
+
"model.layers.21.input_layernorm.weight": "model.safetensors",
|
| 264 |
+
"model.layers.21.mlp.down_proj.scales": "model.safetensors",
|
| 265 |
+
"model.layers.21.mlp.down_proj.weight": "model.safetensors",
|
| 266 |
+
"model.layers.21.mlp.gate_proj.scales": "model.safetensors",
|
| 267 |
+
"model.layers.21.mlp.gate_proj.weight": "model.safetensors",
|
| 268 |
+
"model.layers.21.mlp.up_proj.scales": "model.safetensors",
|
| 269 |
+
"model.layers.21.mlp.up_proj.weight": "model.safetensors",
|
| 270 |
+
"model.layers.21.post_attention_layernorm.weight": "model.safetensors",
|
| 271 |
+
"model.layers.21.self_attn.k_norm.weight": "model.safetensors",
|
| 272 |
+
"model.layers.21.self_attn.k_proj.scales": "model.safetensors",
|
| 273 |
+
"model.layers.21.self_attn.k_proj.weight": "model.safetensors",
|
| 274 |
+
"model.layers.21.self_attn.o_proj.scales": "model.safetensors",
|
| 275 |
+
"model.layers.21.self_attn.o_proj.weight": "model.safetensors",
|
| 276 |
+
"model.layers.21.self_attn.q_norm.weight": "model.safetensors",
|
| 277 |
+
"model.layers.21.self_attn.q_proj.scales": "model.safetensors",
|
| 278 |
+
"model.layers.21.self_attn.q_proj.weight": "model.safetensors",
|
| 279 |
+
"model.layers.21.self_attn.v_proj.scales": "model.safetensors",
|
| 280 |
+
"model.layers.21.self_attn.v_proj.weight": "model.safetensors",
|
| 281 |
+
"model.layers.22.input_layernorm.weight": "model.safetensors",
|
| 282 |
+
"model.layers.22.mlp.down_proj.scales": "model.safetensors",
|
| 283 |
+
"model.layers.22.mlp.down_proj.weight": "model.safetensors",
|
| 284 |
+
"model.layers.22.mlp.gate_proj.scales": "model.safetensors",
|
| 285 |
+
"model.layers.22.mlp.gate_proj.weight": "model.safetensors",
|
| 286 |
+
"model.layers.22.mlp.up_proj.scales": "model.safetensors",
|
| 287 |
+
"model.layers.22.mlp.up_proj.weight": "model.safetensors",
|
| 288 |
+
"model.layers.22.post_attention_layernorm.weight": "model.safetensors",
|
| 289 |
+
"model.layers.22.self_attn.k_norm.weight": "model.safetensors",
|
| 290 |
+
"model.layers.22.self_attn.k_proj.scales": "model.safetensors",
|
| 291 |
+
"model.layers.22.self_attn.k_proj.weight": "model.safetensors",
|
| 292 |
+
"model.layers.22.self_attn.o_proj.scales": "model.safetensors",
|
| 293 |
+
"model.layers.22.self_attn.o_proj.weight": "model.safetensors",
|
| 294 |
+
"model.layers.22.self_attn.q_norm.weight": "model.safetensors",
|
| 295 |
+
"model.layers.22.self_attn.q_proj.scales": "model.safetensors",
|
| 296 |
+
"model.layers.22.self_attn.q_proj.weight": "model.safetensors",
|
| 297 |
+
"model.layers.22.self_attn.v_proj.scales": "model.safetensors",
|
| 298 |
+
"model.layers.22.self_attn.v_proj.weight": "model.safetensors",
|
| 299 |
+
"model.layers.23.input_layernorm.weight": "model.safetensors",
|
| 300 |
+
"model.layers.23.mlp.down_proj.scales": "model.safetensors",
|
| 301 |
+
"model.layers.23.mlp.down_proj.weight": "model.safetensors",
|
| 302 |
+
"model.layers.23.mlp.gate_proj.scales": "model.safetensors",
|
| 303 |
+
"model.layers.23.mlp.gate_proj.weight": "model.safetensors",
|
| 304 |
+
"model.layers.23.mlp.up_proj.scales": "model.safetensors",
|
| 305 |
+
"model.layers.23.mlp.up_proj.weight": "model.safetensors",
|
| 306 |
+
"model.layers.23.post_attention_layernorm.weight": "model.safetensors",
|
| 307 |
+
"model.layers.23.self_attn.k_norm.weight": "model.safetensors",
|
| 308 |
+
"model.layers.23.self_attn.k_proj.scales": "model.safetensors",
|
| 309 |
+
"model.layers.23.self_attn.k_proj.weight": "model.safetensors",
|
| 310 |
+
"model.layers.23.self_attn.o_proj.scales": "model.safetensors",
|
| 311 |
+
"model.layers.23.self_attn.o_proj.weight": "model.safetensors",
|
| 312 |
+
"model.layers.23.self_attn.q_norm.weight": "model.safetensors",
|
| 313 |
+
"model.layers.23.self_attn.q_proj.scales": "model.safetensors",
|
| 314 |
+
"model.layers.23.self_attn.q_proj.weight": "model.safetensors",
|
| 315 |
+
"model.layers.23.self_attn.v_proj.scales": "model.safetensors",
|
| 316 |
+
"model.layers.23.self_attn.v_proj.weight": "model.safetensors",
|
| 317 |
+
"model.layers.24.input_layernorm.weight": "model.safetensors",
|
| 318 |
+
"model.layers.24.mlp.down_proj.scales": "model.safetensors",
|
| 319 |
+
"model.layers.24.mlp.down_proj.weight": "model.safetensors",
|
| 320 |
+
"model.layers.24.mlp.gate_proj.scales": "model.safetensors",
|
| 321 |
+
"model.layers.24.mlp.gate_proj.weight": "model.safetensors",
|
| 322 |
+
"model.layers.24.mlp.up_proj.scales": "model.safetensors",
|
| 323 |
+
"model.layers.24.mlp.up_proj.weight": "model.safetensors",
|
| 324 |
+
"model.layers.24.post_attention_layernorm.weight": "model.safetensors",
|
| 325 |
+
"model.layers.24.self_attn.k_norm.weight": "model.safetensors",
|
| 326 |
+
"model.layers.24.self_attn.k_proj.scales": "model.safetensors",
|
| 327 |
+
"model.layers.24.self_attn.k_proj.weight": "model.safetensors",
|
| 328 |
+
"model.layers.24.self_attn.o_proj.scales": "model.safetensors",
|
| 329 |
+
"model.layers.24.self_attn.o_proj.weight": "model.safetensors",
|
| 330 |
+
"model.layers.24.self_attn.q_norm.weight": "model.safetensors",
|
| 331 |
+
"model.layers.24.self_attn.q_proj.scales": "model.safetensors",
|
| 332 |
+
"model.layers.24.self_attn.q_proj.weight": "model.safetensors",
|
| 333 |
+
"model.layers.24.self_attn.v_proj.scales": "model.safetensors",
|
| 334 |
+
"model.layers.24.self_attn.v_proj.weight": "model.safetensors",
|
| 335 |
+
"model.layers.25.input_layernorm.weight": "model.safetensors",
|
| 336 |
+
"model.layers.25.mlp.down_proj.scales": "model.safetensors",
|
| 337 |
+
"model.layers.25.mlp.down_proj.weight": "model.safetensors",
|
| 338 |
+
"model.layers.25.mlp.gate_proj.scales": "model.safetensors",
|
| 339 |
+
"model.layers.25.mlp.gate_proj.weight": "model.safetensors",
|
| 340 |
+
"model.layers.25.mlp.up_proj.scales": "model.safetensors",
|
| 341 |
+
"model.layers.25.mlp.up_proj.weight": "model.safetensors",
|
| 342 |
+
"model.layers.25.post_attention_layernorm.weight": "model.safetensors",
|
| 343 |
+
"model.layers.25.self_attn.k_norm.weight": "model.safetensors",
|
| 344 |
+
"model.layers.25.self_attn.k_proj.scales": "model.safetensors",
|
| 345 |
+
"model.layers.25.self_attn.k_proj.weight": "model.safetensors",
|
| 346 |
+
"model.layers.25.self_attn.o_proj.scales": "model.safetensors",
|
| 347 |
+
"model.layers.25.self_attn.o_proj.weight": "model.safetensors",
|
| 348 |
+
"model.layers.25.self_attn.q_norm.weight": "model.safetensors",
|
| 349 |
+
"model.layers.25.self_attn.q_proj.scales": "model.safetensors",
|
| 350 |
+
"model.layers.25.self_attn.q_proj.weight": "model.safetensors",
|
| 351 |
+
"model.layers.25.self_attn.v_proj.scales": "model.safetensors",
|
| 352 |
+
"model.layers.25.self_attn.v_proj.weight": "model.safetensors",
|
| 353 |
+
"model.layers.26.input_layernorm.weight": "model.safetensors",
|
| 354 |
+
"model.layers.26.mlp.down_proj.scales": "model.safetensors",
|
| 355 |
+
"model.layers.26.mlp.down_proj.weight": "model.safetensors",
|
| 356 |
+
"model.layers.26.mlp.gate_proj.scales": "model.safetensors",
|
| 357 |
+
"model.layers.26.mlp.gate_proj.weight": "model.safetensors",
|
| 358 |
+
"model.layers.26.mlp.up_proj.scales": "model.safetensors",
|
| 359 |
+
"model.layers.26.mlp.up_proj.weight": "model.safetensors",
|
| 360 |
+
"model.layers.26.post_attention_layernorm.weight": "model.safetensors",
|
| 361 |
+
"model.layers.26.self_attn.k_norm.weight": "model.safetensors",
|
| 362 |
+
"model.layers.26.self_attn.k_proj.scales": "model.safetensors",
|
| 363 |
+
"model.layers.26.self_attn.k_proj.weight": "model.safetensors",
|
| 364 |
+
"model.layers.26.self_attn.o_proj.scales": "model.safetensors",
|
| 365 |
+
"model.layers.26.self_attn.o_proj.weight": "model.safetensors",
|
| 366 |
+
"model.layers.26.self_attn.q_norm.weight": "model.safetensors",
|
| 367 |
+
"model.layers.26.self_attn.q_proj.scales": "model.safetensors",
|
| 368 |
+
"model.layers.26.self_attn.q_proj.weight": "model.safetensors",
|
| 369 |
+
"model.layers.26.self_attn.v_proj.scales": "model.safetensors",
|
| 370 |
+
"model.layers.26.self_attn.v_proj.weight": "model.safetensors",
|
| 371 |
+
"model.layers.27.input_layernorm.weight": "model.safetensors",
|
| 372 |
+
"model.layers.27.mlp.down_proj.scales": "model.safetensors",
|
| 373 |
+
"model.layers.27.mlp.down_proj.weight": "model.safetensors",
|
| 374 |
+
"model.layers.27.mlp.gate_proj.scales": "model.safetensors",
|
| 375 |
+
"model.layers.27.mlp.gate_proj.weight": "model.safetensors",
|
| 376 |
+
"model.layers.27.mlp.up_proj.scales": "model.safetensors",
|
| 377 |
+
"model.layers.27.mlp.up_proj.weight": "model.safetensors",
|
| 378 |
+
"model.layers.27.post_attention_layernorm.weight": "model.safetensors",
|
| 379 |
+
"model.layers.27.self_attn.k_norm.weight": "model.safetensors",
|
| 380 |
+
"model.layers.27.self_attn.k_proj.scales": "model.safetensors",
|
| 381 |
+
"model.layers.27.self_attn.k_proj.weight": "model.safetensors",
|
| 382 |
+
"model.layers.27.self_attn.o_proj.scales": "model.safetensors",
|
| 383 |
+
"model.layers.27.self_attn.o_proj.weight": "model.safetensors",
|
| 384 |
+
"model.layers.27.self_attn.q_norm.weight": "model.safetensors",
|
| 385 |
+
"model.layers.27.self_attn.q_proj.scales": "model.safetensors",
|
| 386 |
+
"model.layers.27.self_attn.q_proj.weight": "model.safetensors",
|
| 387 |
+
"model.layers.27.self_attn.v_proj.scales": "model.safetensors",
|
| 388 |
+
"model.layers.27.self_attn.v_proj.weight": "model.safetensors",
|
| 389 |
+
"model.layers.28.input_layernorm.weight": "model.safetensors",
|
| 390 |
+
"model.layers.28.mlp.down_proj.scales": "model.safetensors",
|
| 391 |
+
"model.layers.28.mlp.down_proj.weight": "model.safetensors",
|
| 392 |
+
"model.layers.28.mlp.gate_proj.scales": "model.safetensors",
|
| 393 |
+
"model.layers.28.mlp.gate_proj.weight": "model.safetensors",
|
| 394 |
+
"model.layers.28.mlp.up_proj.scales": "model.safetensors",
|
| 395 |
+
"model.layers.28.mlp.up_proj.weight": "model.safetensors",
|
| 396 |
+
"model.layers.28.post_attention_layernorm.weight": "model.safetensors",
|
| 397 |
+
"model.layers.28.self_attn.k_norm.weight": "model.safetensors",
|
| 398 |
+
"model.layers.28.self_attn.k_proj.scales": "model.safetensors",
|
| 399 |
+
"model.layers.28.self_attn.k_proj.weight": "model.safetensors",
|
| 400 |
+
"model.layers.28.self_attn.o_proj.scales": "model.safetensors",
|
| 401 |
+
"model.layers.28.self_attn.o_proj.weight": "model.safetensors",
|
| 402 |
+
"model.layers.28.self_attn.q_norm.weight": "model.safetensors",
|
| 403 |
+
"model.layers.28.self_attn.q_proj.scales": "model.safetensors",
|
| 404 |
+
"model.layers.28.self_attn.q_proj.weight": "model.safetensors",
|
| 405 |
+
"model.layers.28.self_attn.v_proj.scales": "model.safetensors",
|
| 406 |
+
"model.layers.28.self_attn.v_proj.weight": "model.safetensors",
|
| 407 |
+
"model.layers.29.input_layernorm.weight": "model.safetensors",
|
| 408 |
+
"model.layers.29.mlp.down_proj.scales": "model.safetensors",
|
| 409 |
+
"model.layers.29.mlp.down_proj.weight": "model.safetensors",
|
| 410 |
+
"model.layers.29.mlp.gate_proj.scales": "model.safetensors",
|
| 411 |
+
"model.layers.29.mlp.gate_proj.weight": "model.safetensors",
|
| 412 |
+
"model.layers.29.mlp.up_proj.scales": "model.safetensors",
|
| 413 |
+
"model.layers.29.mlp.up_proj.weight": "model.safetensors",
|
| 414 |
+
"model.layers.29.post_attention_layernorm.weight": "model.safetensors",
|
| 415 |
+
"model.layers.29.self_attn.k_norm.weight": "model.safetensors",
|
| 416 |
+
"model.layers.29.self_attn.k_proj.scales": "model.safetensors",
|
| 417 |
+
"model.layers.29.self_attn.k_proj.weight": "model.safetensors",
|
| 418 |
+
"model.layers.29.self_attn.o_proj.scales": "model.safetensors",
|
| 419 |
+
"model.layers.29.self_attn.o_proj.weight": "model.safetensors",
|
| 420 |
+
"model.layers.29.self_attn.q_norm.weight": "model.safetensors",
|
| 421 |
+
"model.layers.29.self_attn.q_proj.scales": "model.safetensors",
|
| 422 |
+
"model.layers.29.self_attn.q_proj.weight": "model.safetensors",
|
| 423 |
+
"model.layers.29.self_attn.v_proj.scales": "model.safetensors",
|
| 424 |
+
"model.layers.29.self_attn.v_proj.weight": "model.safetensors",
|
| 425 |
+
"model.layers.3.input_layernorm.weight": "model.safetensors",
|
| 426 |
+
"model.layers.3.mlp.down_proj.scales": "model.safetensors",
|
| 427 |
+
"model.layers.3.mlp.down_proj.weight": "model.safetensors",
|
| 428 |
+
"model.layers.3.mlp.gate_proj.scales": "model.safetensors",
|
| 429 |
+
"model.layers.3.mlp.gate_proj.weight": "model.safetensors",
|
| 430 |
+
"model.layers.3.mlp.up_proj.scales": "model.safetensors",
|
| 431 |
+
"model.layers.3.mlp.up_proj.weight": "model.safetensors",
|
| 432 |
+
"model.layers.3.post_attention_layernorm.weight": "model.safetensors",
|
| 433 |
+
"model.layers.3.self_attn.k_norm.weight": "model.safetensors",
|
| 434 |
+
"model.layers.3.self_attn.k_proj.scales": "model.safetensors",
|
| 435 |
+
"model.layers.3.self_attn.k_proj.weight": "model.safetensors",
|
| 436 |
+
"model.layers.3.self_attn.o_proj.scales": "model.safetensors",
|
| 437 |
+
"model.layers.3.self_attn.o_proj.weight": "model.safetensors",
|
| 438 |
+
"model.layers.3.self_attn.q_norm.weight": "model.safetensors",
|
| 439 |
+
"model.layers.3.self_attn.q_proj.scales": "model.safetensors",
|
| 440 |
+
"model.layers.3.self_attn.q_proj.weight": "model.safetensors",
|
| 441 |
+
"model.layers.3.self_attn.v_proj.scales": "model.safetensors",
|
| 442 |
+
"model.layers.3.self_attn.v_proj.weight": "model.safetensors",
|
| 443 |
+
"model.layers.30.input_layernorm.weight": "model.safetensors",
|
| 444 |
+
"model.layers.30.mlp.down_proj.scales": "model.safetensors",
|
| 445 |
+
"model.layers.30.mlp.down_proj.weight": "model.safetensors",
|
| 446 |
+
"model.layers.30.mlp.gate_proj.scales": "model.safetensors",
|
| 447 |
+
"model.layers.30.mlp.gate_proj.weight": "model.safetensors",
|
| 448 |
+
"model.layers.30.mlp.up_proj.scales": "model.safetensors",
|
| 449 |
+
"model.layers.30.mlp.up_proj.weight": "model.safetensors",
|
| 450 |
+
"model.layers.30.post_attention_layernorm.weight": "model.safetensors",
|
| 451 |
+
"model.layers.30.self_attn.k_norm.weight": "model.safetensors",
|
| 452 |
+
"model.layers.30.self_attn.k_proj.scales": "model.safetensors",
|
| 453 |
+
"model.layers.30.self_attn.k_proj.weight": "model.safetensors",
|
| 454 |
+
"model.layers.30.self_attn.o_proj.scales": "model.safetensors",
|
| 455 |
+
"model.layers.30.self_attn.o_proj.weight": "model.safetensors",
|
| 456 |
+
"model.layers.30.self_attn.q_norm.weight": "model.safetensors",
|
| 457 |
+
"model.layers.30.self_attn.q_proj.scales": "model.safetensors",
|
| 458 |
+
"model.layers.30.self_attn.q_proj.weight": "model.safetensors",
|
| 459 |
+
"model.layers.30.self_attn.v_proj.scales": "model.safetensors",
|
| 460 |
+
"model.layers.30.self_attn.v_proj.weight": "model.safetensors",
|
| 461 |
+
"model.layers.31.input_layernorm.weight": "model.safetensors",
|
| 462 |
+
"model.layers.31.mlp.down_proj.scales": "model.safetensors",
|
| 463 |
+
"model.layers.31.mlp.down_proj.weight": "model.safetensors",
|
| 464 |
+
"model.layers.31.mlp.gate_proj.scales": "model.safetensors",
|
| 465 |
+
"model.layers.31.mlp.gate_proj.weight": "model.safetensors",
|
| 466 |
+
"model.layers.31.mlp.up_proj.scales": "model.safetensors",
|
| 467 |
+
"model.layers.31.mlp.up_proj.weight": "model.safetensors",
|
| 468 |
+
"model.layers.31.post_attention_layernorm.weight": "model.safetensors",
|
| 469 |
+
"model.layers.31.self_attn.k_norm.weight": "model.safetensors",
|
| 470 |
+
"model.layers.31.self_attn.k_proj.scales": "model.safetensors",
|
| 471 |
+
"model.layers.31.self_attn.k_proj.weight": "model.safetensors",
|
| 472 |
+
"model.layers.31.self_attn.o_proj.scales": "model.safetensors",
|
| 473 |
+
"model.layers.31.self_attn.o_proj.weight": "model.safetensors",
|
| 474 |
+
"model.layers.31.self_attn.q_norm.weight": "model.safetensors",
|
| 475 |
+
"model.layers.31.self_attn.q_proj.scales": "model.safetensors",
|
| 476 |
+
"model.layers.31.self_attn.q_proj.weight": "model.safetensors",
|
| 477 |
+
"model.layers.31.self_attn.v_proj.scales": "model.safetensors",
|
| 478 |
+
"model.layers.31.self_attn.v_proj.weight": "model.safetensors",
|
| 479 |
+
"model.layers.32.input_layernorm.weight": "model.safetensors",
|
| 480 |
+
"model.layers.32.mlp.down_proj.scales": "model.safetensors",
|
| 481 |
+
"model.layers.32.mlp.down_proj.weight": "model.safetensors",
|
| 482 |
+
"model.layers.32.mlp.gate_proj.scales": "model.safetensors",
|
| 483 |
+
"model.layers.32.mlp.gate_proj.weight": "model.safetensors",
|
| 484 |
+
"model.layers.32.mlp.up_proj.scales": "model.safetensors",
|
| 485 |
+
"model.layers.32.mlp.up_proj.weight": "model.safetensors",
|
| 486 |
+
"model.layers.32.post_attention_layernorm.weight": "model.safetensors",
|
| 487 |
+
"model.layers.32.self_attn.k_norm.weight": "model.safetensors",
|
| 488 |
+
"model.layers.32.self_attn.k_proj.scales": "model.safetensors",
|
| 489 |
+
"model.layers.32.self_attn.k_proj.weight": "model.safetensors",
|
| 490 |
+
"model.layers.32.self_attn.o_proj.scales": "model.safetensors",
|
| 491 |
+
"model.layers.32.self_attn.o_proj.weight": "model.safetensors",
|
| 492 |
+
"model.layers.32.self_attn.q_norm.weight": "model.safetensors",
|
| 493 |
+
"model.layers.32.self_attn.q_proj.scales": "model.safetensors",
|
| 494 |
+
"model.layers.32.self_attn.q_proj.weight": "model.safetensors",
|
| 495 |
+
"model.layers.32.self_attn.v_proj.scales": "model.safetensors",
|
| 496 |
+
"model.layers.32.self_attn.v_proj.weight": "model.safetensors",
|
| 497 |
+
"model.layers.33.input_layernorm.weight": "model.safetensors",
|
| 498 |
+
"model.layers.33.mlp.down_proj.scales": "model.safetensors",
|
| 499 |
+
"model.layers.33.mlp.down_proj.weight": "model.safetensors",
|
| 500 |
+
"model.layers.33.mlp.gate_proj.scales": "model.safetensors",
|
| 501 |
+
"model.layers.33.mlp.gate_proj.weight": "model.safetensors",
|
| 502 |
+
"model.layers.33.mlp.up_proj.scales": "model.safetensors",
|
| 503 |
+
"model.layers.33.mlp.up_proj.weight": "model.safetensors",
|
| 504 |
+
"model.layers.33.post_attention_layernorm.weight": "model.safetensors",
|
| 505 |
+
"model.layers.33.self_attn.k_norm.weight": "model.safetensors",
|
| 506 |
+
"model.layers.33.self_attn.k_proj.scales": "model.safetensors",
|
| 507 |
+
"model.layers.33.self_attn.k_proj.weight": "model.safetensors",
|
| 508 |
+
"model.layers.33.self_attn.o_proj.scales": "model.safetensors",
|
| 509 |
+
"model.layers.33.self_attn.o_proj.weight": "model.safetensors",
|
| 510 |
+
"model.layers.33.self_attn.q_norm.weight": "model.safetensors",
|
| 511 |
+
"model.layers.33.self_attn.q_proj.scales": "model.safetensors",
|
| 512 |
+
"model.layers.33.self_attn.q_proj.weight": "model.safetensors",
|
| 513 |
+
"model.layers.33.self_attn.v_proj.scales": "model.safetensors",
|
| 514 |
+
"model.layers.33.self_attn.v_proj.weight": "model.safetensors",
|
| 515 |
+
"model.layers.34.input_layernorm.weight": "model.safetensors",
|
| 516 |
+
"model.layers.34.mlp.down_proj.scales": "model.safetensors",
|
| 517 |
+
"model.layers.34.mlp.down_proj.weight": "model.safetensors",
|
| 518 |
+
"model.layers.34.mlp.gate_proj.scales": "model.safetensors",
|
| 519 |
+
"model.layers.34.mlp.gate_proj.weight": "model.safetensors",
|
| 520 |
+
"model.layers.34.mlp.up_proj.scales": "model.safetensors",
|
| 521 |
+
"model.layers.34.mlp.up_proj.weight": "model.safetensors",
|
| 522 |
+
"model.layers.34.post_attention_layernorm.weight": "model.safetensors",
|
| 523 |
+
"model.layers.34.self_attn.k_norm.weight": "model.safetensors",
|
| 524 |
+
"model.layers.34.self_attn.k_proj.scales": "model.safetensors",
|
| 525 |
+
"model.layers.34.self_attn.k_proj.weight": "model.safetensors",
|
| 526 |
+
"model.layers.34.self_attn.o_proj.scales": "model.safetensors",
|
| 527 |
+
"model.layers.34.self_attn.o_proj.weight": "model.safetensors",
|
| 528 |
+
"model.layers.34.self_attn.q_norm.weight": "model.safetensors",
|
| 529 |
+
"model.layers.34.self_attn.q_proj.scales": "model.safetensors",
|
| 530 |
+
"model.layers.34.self_attn.q_proj.weight": "model.safetensors",
|
| 531 |
+
"model.layers.34.self_attn.v_proj.scales": "model.safetensors",
|
| 532 |
+
"model.layers.34.self_attn.v_proj.weight": "model.safetensors",
|
| 533 |
+
"model.layers.35.input_layernorm.weight": "model.safetensors",
|
| 534 |
+
"model.layers.35.mlp.down_proj.scales": "model.safetensors",
|
| 535 |
+
"model.layers.35.mlp.down_proj.weight": "model.safetensors",
|
| 536 |
+
"model.layers.35.mlp.gate_proj.scales": "model.safetensors",
|
| 537 |
+
"model.layers.35.mlp.gate_proj.weight": "model.safetensors",
|
| 538 |
+
"model.layers.35.mlp.up_proj.scales": "model.safetensors",
|
| 539 |
+
"model.layers.35.mlp.up_proj.weight": "model.safetensors",
|
| 540 |
+
"model.layers.35.post_attention_layernorm.weight": "model.safetensors",
|
| 541 |
+
"model.layers.35.self_attn.k_norm.weight": "model.safetensors",
|
| 542 |
+
"model.layers.35.self_attn.k_proj.scales": "model.safetensors",
|
| 543 |
+
"model.layers.35.self_attn.k_proj.weight": "model.safetensors",
|
| 544 |
+
"model.layers.35.self_attn.o_proj.scales": "model.safetensors",
|
| 545 |
+
"model.layers.35.self_attn.o_proj.weight": "model.safetensors",
|
| 546 |
+
"model.layers.35.self_attn.q_norm.weight": "model.safetensors",
|
| 547 |
+
"model.layers.35.self_attn.q_proj.scales": "model.safetensors",
|
| 548 |
+
"model.layers.35.self_attn.q_proj.weight": "model.safetensors",
|
| 549 |
+
"model.layers.35.self_attn.v_proj.scales": "model.safetensors",
|
| 550 |
+
"model.layers.35.self_attn.v_proj.weight": "model.safetensors",
|
| 551 |
+
"model.layers.4.input_layernorm.weight": "model.safetensors",
|
| 552 |
+
"model.layers.4.mlp.down_proj.scales": "model.safetensors",
|
| 553 |
+
"model.layers.4.mlp.down_proj.weight": "model.safetensors",
|
| 554 |
+
"model.layers.4.mlp.gate_proj.scales": "model.safetensors",
|
| 555 |
+
"model.layers.4.mlp.gate_proj.weight": "model.safetensors",
|
| 556 |
+
"model.layers.4.mlp.up_proj.scales": "model.safetensors",
|
| 557 |
+
"model.layers.4.mlp.up_proj.weight": "model.safetensors",
|
| 558 |
+
"model.layers.4.post_attention_layernorm.weight": "model.safetensors",
|
| 559 |
+
"model.layers.4.self_attn.k_norm.weight": "model.safetensors",
|
| 560 |
+
"model.layers.4.self_attn.k_proj.scales": "model.safetensors",
|
| 561 |
+
"model.layers.4.self_attn.k_proj.weight": "model.safetensors",
|
| 562 |
+
"model.layers.4.self_attn.o_proj.scales": "model.safetensors",
|
| 563 |
+
"model.layers.4.self_attn.o_proj.weight": "model.safetensors",
|
| 564 |
+
"model.layers.4.self_attn.q_norm.weight": "model.safetensors",
|
| 565 |
+
"model.layers.4.self_attn.q_proj.scales": "model.safetensors",
|
| 566 |
+
"model.layers.4.self_attn.q_proj.weight": "model.safetensors",
|
| 567 |
+
"model.layers.4.self_attn.v_proj.scales": "model.safetensors",
|
| 568 |
+
"model.layers.4.self_attn.v_proj.weight": "model.safetensors",
|
| 569 |
+
"model.layers.5.input_layernorm.weight": "model.safetensors",
|
| 570 |
+
"model.layers.5.mlp.down_proj.scales": "model.safetensors",
|
| 571 |
+
"model.layers.5.mlp.down_proj.weight": "model.safetensors",
|
| 572 |
+
"model.layers.5.mlp.gate_proj.scales": "model.safetensors",
|
| 573 |
+
"model.layers.5.mlp.gate_proj.weight": "model.safetensors",
|
| 574 |
+
"model.layers.5.mlp.up_proj.scales": "model.safetensors",
|
| 575 |
+
"model.layers.5.mlp.up_proj.weight": "model.safetensors",
|
| 576 |
+
"model.layers.5.post_attention_layernorm.weight": "model.safetensors",
|
| 577 |
+
"model.layers.5.self_attn.k_norm.weight": "model.safetensors",
|
| 578 |
+
"model.layers.5.self_attn.k_proj.scales": "model.safetensors",
|
| 579 |
+
"model.layers.5.self_attn.k_proj.weight": "model.safetensors",
|
| 580 |
+
"model.layers.5.self_attn.o_proj.scales": "model.safetensors",
|
| 581 |
+
"model.layers.5.self_attn.o_proj.weight": "model.safetensors",
|
| 582 |
+
"model.layers.5.self_attn.q_norm.weight": "model.safetensors",
|
| 583 |
+
"model.layers.5.self_attn.q_proj.scales": "model.safetensors",
|
| 584 |
+
"model.layers.5.self_attn.q_proj.weight": "model.safetensors",
|
| 585 |
+
"model.layers.5.self_attn.v_proj.scales": "model.safetensors",
|
| 586 |
+
"model.layers.5.self_attn.v_proj.weight": "model.safetensors",
|
| 587 |
+
"model.layers.6.input_layernorm.weight": "model.safetensors",
|
| 588 |
+
"model.layers.6.mlp.down_proj.scales": "model.safetensors",
|
| 589 |
+
"model.layers.6.mlp.down_proj.weight": "model.safetensors",
|
| 590 |
+
"model.layers.6.mlp.gate_proj.scales": "model.safetensors",
|
| 591 |
+
"model.layers.6.mlp.gate_proj.weight": "model.safetensors",
|
| 592 |
+
"model.layers.6.mlp.up_proj.scales": "model.safetensors",
|
| 593 |
+
"model.layers.6.mlp.up_proj.weight": "model.safetensors",
|
| 594 |
+
"model.layers.6.post_attention_layernorm.weight": "model.safetensors",
|
| 595 |
+
"model.layers.6.self_attn.k_norm.weight": "model.safetensors",
|
| 596 |
+
"model.layers.6.self_attn.k_proj.scales": "model.safetensors",
|
| 597 |
+
"model.layers.6.self_attn.k_proj.weight": "model.safetensors",
|
| 598 |
+
"model.layers.6.self_attn.o_proj.scales": "model.safetensors",
|
| 599 |
+
"model.layers.6.self_attn.o_proj.weight": "model.safetensors",
|
| 600 |
+
"model.layers.6.self_attn.q_norm.weight": "model.safetensors",
|
| 601 |
+
"model.layers.6.self_attn.q_proj.scales": "model.safetensors",
|
| 602 |
+
"model.layers.6.self_attn.q_proj.weight": "model.safetensors",
|
| 603 |
+
"model.layers.6.self_attn.v_proj.scales": "model.safetensors",
|
| 604 |
+
"model.layers.6.self_attn.v_proj.weight": "model.safetensors",
|
| 605 |
+
"model.layers.7.input_layernorm.weight": "model.safetensors",
|
| 606 |
+
"model.layers.7.mlp.down_proj.scales": "model.safetensors",
|
| 607 |
+
"model.layers.7.mlp.down_proj.weight": "model.safetensors",
|
| 608 |
+
"model.layers.7.mlp.gate_proj.scales": "model.safetensors",
|
| 609 |
+
"model.layers.7.mlp.gate_proj.weight": "model.safetensors",
|
| 610 |
+
"model.layers.7.mlp.up_proj.scales": "model.safetensors",
|
| 611 |
+
"model.layers.7.mlp.up_proj.weight": "model.safetensors",
|
| 612 |
+
"model.layers.7.post_attention_layernorm.weight": "model.safetensors",
|
| 613 |
+
"model.layers.7.self_attn.k_norm.weight": "model.safetensors",
|
| 614 |
+
"model.layers.7.self_attn.k_proj.scales": "model.safetensors",
|
| 615 |
+
"model.layers.7.self_attn.k_proj.weight": "model.safetensors",
|
| 616 |
+
"model.layers.7.self_attn.o_proj.scales": "model.safetensors",
|
| 617 |
+
"model.layers.7.self_attn.o_proj.weight": "model.safetensors",
|
| 618 |
+
"model.layers.7.self_attn.q_norm.weight": "model.safetensors",
|
| 619 |
+
"model.layers.7.self_attn.q_proj.scales": "model.safetensors",
|
| 620 |
+
"model.layers.7.self_attn.q_proj.weight": "model.safetensors",
|
| 621 |
+
"model.layers.7.self_attn.v_proj.scales": "model.safetensors",
|
| 622 |
+
"model.layers.7.self_attn.v_proj.weight": "model.safetensors",
|
| 623 |
+
"model.layers.8.input_layernorm.weight": "model.safetensors",
|
| 624 |
+
"model.layers.8.mlp.down_proj.scales": "model.safetensors",
|
| 625 |
+
"model.layers.8.mlp.down_proj.weight": "model.safetensors",
|
| 626 |
+
"model.layers.8.mlp.gate_proj.scales": "model.safetensors",
|
| 627 |
+
"model.layers.8.mlp.gate_proj.weight": "model.safetensors",
|
| 628 |
+
"model.layers.8.mlp.up_proj.scales": "model.safetensors",
|
| 629 |
+
"model.layers.8.mlp.up_proj.weight": "model.safetensors",
|
| 630 |
+
"model.layers.8.post_attention_layernorm.weight": "model.safetensors",
|
| 631 |
+
"model.layers.8.self_attn.k_norm.weight": "model.safetensors",
|
| 632 |
+
"model.layers.8.self_attn.k_proj.scales": "model.safetensors",
|
| 633 |
+
"model.layers.8.self_attn.k_proj.weight": "model.safetensors",
|
| 634 |
+
"model.layers.8.self_attn.o_proj.scales": "model.safetensors",
|
| 635 |
+
"model.layers.8.self_attn.o_proj.weight": "model.safetensors",
|
| 636 |
+
"model.layers.8.self_attn.q_norm.weight": "model.safetensors",
|
| 637 |
+
"model.layers.8.self_attn.q_proj.scales": "model.safetensors",
|
| 638 |
+
"model.layers.8.self_attn.q_proj.weight": "model.safetensors",
|
| 639 |
+
"model.layers.8.self_attn.v_proj.scales": "model.safetensors",
|
| 640 |
+
"model.layers.8.self_attn.v_proj.weight": "model.safetensors",
|
| 641 |
+
"model.layers.9.input_layernorm.weight": "model.safetensors",
|
| 642 |
+
"model.layers.9.mlp.down_proj.scales": "model.safetensors",
|
| 643 |
+
"model.layers.9.mlp.down_proj.weight": "model.safetensors",
|
| 644 |
+
"model.layers.9.mlp.gate_proj.scales": "model.safetensors",
|
| 645 |
+
"model.layers.9.mlp.gate_proj.weight": "model.safetensors",
|
| 646 |
+
"model.layers.9.mlp.up_proj.scales": "model.safetensors",
|
| 647 |
+
"model.layers.9.mlp.up_proj.weight": "model.safetensors",
|
| 648 |
+
"model.layers.9.post_attention_layernorm.weight": "model.safetensors",
|
| 649 |
+
"model.layers.9.self_attn.k_norm.weight": "model.safetensors",
|
| 650 |
+
"model.layers.9.self_attn.k_proj.scales": "model.safetensors",
|
| 651 |
+
"model.layers.9.self_attn.k_proj.weight": "model.safetensors",
|
| 652 |
+
"model.layers.9.self_attn.o_proj.scales": "model.safetensors",
|
| 653 |
+
"model.layers.9.self_attn.o_proj.weight": "model.safetensors",
|
| 654 |
+
"model.layers.9.self_attn.q_norm.weight": "model.safetensors",
|
| 655 |
+
"model.layers.9.self_attn.q_proj.scales": "model.safetensors",
|
| 656 |
+
"model.layers.9.self_attn.q_proj.weight": "model.safetensors",
|
| 657 |
+
"model.layers.9.self_attn.v_proj.scales": "model.safetensors",
|
| 658 |
+
"model.layers.9.self_attn.v_proj.weight": "model.safetensors",
|
| 659 |
+
"model.norm.weight": "model.safetensors"
|
| 660 |
+
}
|
| 661 |
+
}
|
modeling_qwen3_guard.py
ADDED
|
@@ -0,0 +1,643 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2025 The Qwen team, Alibaba Group and the HuggingFace Inc. team. All rights reserved.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
|
| 16 |
+
from typing import Callable, Optional, Union, Tuple, Generator, List, Dict
|
| 17 |
+
|
| 18 |
+
import torch
|
| 19 |
+
from torch import nn
|
| 20 |
+
import torch.nn.functional as F
|
| 21 |
+
from transformers.activations import ACT2FN
|
| 22 |
+
from transformers.cache_utils import Cache, DynamicCache
|
| 23 |
+
from transformers.generation import GenerationMixin
|
| 24 |
+
from transformers.integrations import use_kernel_forward_from_hub
|
| 25 |
+
from transformers.masking_utils import create_causal_mask, create_sliding_window_causal_mask
|
| 26 |
+
from transformers.modeling_flash_attention_utils import FlashAttentionKwargs
|
| 27 |
+
from transformers.modeling_layers import (
|
| 28 |
+
GenericForQuestionAnswering,
|
| 29 |
+
GenericForSequenceClassification,
|
| 30 |
+
GenericForTokenClassification,
|
| 31 |
+
GradientCheckpointingLayer,
|
| 32 |
+
)
|
| 33 |
+
from transformers.modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast
|
| 34 |
+
from transformers.modeling_rope_utils import ROPE_INIT_FUNCTIONS, dynamic_rope_update
|
| 35 |
+
from transformers.modeling_utils import ALL_ATTENTION_FUNCTIONS, PreTrainedModel
|
| 36 |
+
from transformers.processing_utils import Unpack
|
| 37 |
+
from transformers.utils import TransformersKwargs, auto_docstring, can_return_tuple
|
| 38 |
+
from transformers.utils.deprecation import deprecate_kwarg
|
| 39 |
+
from transformers.utils.generic import check_model_inputs
|
| 40 |
+
from .configuration_qwen3 import Qwen3Config
|
| 41 |
+
|
| 42 |
+
from dataclasses import dataclass, field
|
| 43 |
+
|
| 44 |
+
@dataclass
|
| 45 |
+
class GuardLogitsOutputWithPast:
|
| 46 |
+
risk_level_logits: torch.FloatTensor = None
|
| 47 |
+
category_logits: torch.FloatTensor = None
|
| 48 |
+
query_risk_level_logits: torch.FloatTensor = None
|
| 49 |
+
query_category_logits: torch.FloatTensor = None
|
| 50 |
+
loss: Optional[torch.FloatTensor] = None
|
| 51 |
+
past_key_values: Optional[Tuple[Tuple[torch.FloatTensor]]] = None
|
| 52 |
+
hidden_states: Optional[Tuple[torch.FloatTensor, ...]] = None
|
| 53 |
+
attentions: Optional[Tuple[torch.FloatTensor, ...]] = None
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
@use_kernel_forward_from_hub("RMSNorm")
|
| 57 |
+
class Qwen3RMSNorm(nn.Module):
|
| 58 |
+
def __init__(self, hidden_size, eps: float = 1e-6) -> None:
|
| 59 |
+
"""
|
| 60 |
+
Qwen3RMSNorm is equivalent to T5LayerNorm
|
| 61 |
+
"""
|
| 62 |
+
super().__init__()
|
| 63 |
+
self.weight = nn.Parameter(torch.ones(hidden_size))
|
| 64 |
+
self.variance_epsilon = eps
|
| 65 |
+
|
| 66 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
| 67 |
+
input_dtype = hidden_states.dtype
|
| 68 |
+
hidden_states = hidden_states.to(torch.float32)
|
| 69 |
+
variance = hidden_states.pow(2).mean(-1, keepdim=True)
|
| 70 |
+
hidden_states = hidden_states * torch.rsqrt(variance + self.variance_epsilon)
|
| 71 |
+
return self.weight * hidden_states.to(input_dtype)
|
| 72 |
+
|
| 73 |
+
def extra_repr(self):
|
| 74 |
+
return f"{tuple(self.weight.shape)}, eps={self.variance_epsilon}"
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
class Qwen3MLP(nn.Module):
|
| 78 |
+
def __init__(self, config):
|
| 79 |
+
super().__init__()
|
| 80 |
+
self.config = config
|
| 81 |
+
self.hidden_size = config.hidden_size
|
| 82 |
+
self.intermediate_size = config.intermediate_size
|
| 83 |
+
self.gate_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 84 |
+
self.up_proj = nn.Linear(self.hidden_size, self.intermediate_size, bias=False)
|
| 85 |
+
self.down_proj = nn.Linear(self.intermediate_size, self.hidden_size, bias=False)
|
| 86 |
+
self.act_fn = ACT2FN[config.hidden_act]
|
| 87 |
+
|
| 88 |
+
def forward(self, x):
|
| 89 |
+
down_proj = self.down_proj(self.act_fn(self.gate_proj(x)) * self.up_proj(x))
|
| 90 |
+
return down_proj
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def rotate_half(x):
|
| 94 |
+
"""Rotates half the hidden dims of the input."""
|
| 95 |
+
x1 = x[..., : x.shape[-1] // 2]
|
| 96 |
+
x2 = x[..., x.shape[-1] // 2 :]
|
| 97 |
+
return torch.cat((-x2, x1), dim=-1)
|
| 98 |
+
|
| 99 |
+
|
| 100 |
+
def apply_rotary_pos_emb(q, k, cos, sin, position_ids=None, unsqueeze_dim=1):
|
| 101 |
+
"""Applies Rotary Position Embedding to the query and key tensors.
|
| 102 |
+
|
| 103 |
+
Args:
|
| 104 |
+
q (`torch.Tensor`): The query tensor.
|
| 105 |
+
k (`torch.Tensor`): The key tensor.
|
| 106 |
+
cos (`torch.Tensor`): The cosine part of the rotary embedding.
|
| 107 |
+
sin (`torch.Tensor`): The sine part of the rotary embedding.
|
| 108 |
+
position_ids (`torch.Tensor`, *optional*):
|
| 109 |
+
Deprecated and unused.
|
| 110 |
+
unsqueeze_dim (`int`, *optional*, defaults to 1):
|
| 111 |
+
The 'unsqueeze_dim' argument specifies the dimension along which to unsqueeze cos[position_ids] and
|
| 112 |
+
sin[position_ids] so that they can be properly broadcasted to the dimensions of q and k. For example, note
|
| 113 |
+
that cos[position_ids] and sin[position_ids] have the shape [batch_size, seq_len, head_dim]. Then, if q and
|
| 114 |
+
k have the shape [batch_size, heads, seq_len, head_dim], then setting unsqueeze_dim=1 makes
|
| 115 |
+
cos[position_ids] and sin[position_ids] broadcastable to the shapes of q and k. Similarly, if q and k have
|
| 116 |
+
the shape [batch_size, seq_len, heads, head_dim], then set unsqueeze_dim=2.
|
| 117 |
+
Returns:
|
| 118 |
+
`tuple(torch.Tensor)` comprising of the query and key tensors rotated using the Rotary Position Embedding.
|
| 119 |
+
"""
|
| 120 |
+
cos = cos.unsqueeze(unsqueeze_dim)
|
| 121 |
+
sin = sin.unsqueeze(unsqueeze_dim)
|
| 122 |
+
q_embed = (q * cos) + (rotate_half(q) * sin)
|
| 123 |
+
k_embed = (k * cos) + (rotate_half(k) * sin)
|
| 124 |
+
return q_embed, k_embed
|
| 125 |
+
|
| 126 |
+
|
| 127 |
+
def repeat_kv(hidden_states: torch.Tensor, n_rep: int) -> torch.Tensor:
|
| 128 |
+
"""
|
| 129 |
+
This is the equivalent of torch.repeat_interleave(x, dim=1, repeats=n_rep). The hidden states go from (batch,
|
| 130 |
+
num_key_value_heads, seqlen, head_dim) to (batch, num_attention_heads, seqlen, head_dim)
|
| 131 |
+
"""
|
| 132 |
+
batch, num_key_value_heads, slen, head_dim = hidden_states.shape
|
| 133 |
+
if n_rep == 1:
|
| 134 |
+
return hidden_states
|
| 135 |
+
hidden_states = hidden_states[:, :, None, :, :].expand(batch, num_key_value_heads, n_rep, slen, head_dim)
|
| 136 |
+
return hidden_states.reshape(batch, num_key_value_heads * n_rep, slen, head_dim)
|
| 137 |
+
|
| 138 |
+
|
| 139 |
+
def eager_attention_forward(
|
| 140 |
+
module: nn.Module,
|
| 141 |
+
query: torch.Tensor,
|
| 142 |
+
key: torch.Tensor,
|
| 143 |
+
value: torch.Tensor,
|
| 144 |
+
attention_mask: Optional[torch.Tensor],
|
| 145 |
+
scaling: float,
|
| 146 |
+
dropout: float = 0.0,
|
| 147 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 148 |
+
):
|
| 149 |
+
key_states = repeat_kv(key, module.num_key_value_groups)
|
| 150 |
+
value_states = repeat_kv(value, module.num_key_value_groups)
|
| 151 |
+
|
| 152 |
+
attn_weights = torch.matmul(query, key_states.transpose(2, 3)) * scaling
|
| 153 |
+
if attention_mask is not None:
|
| 154 |
+
causal_mask = attention_mask[:, :, :, : key_states.shape[-2]]
|
| 155 |
+
attn_weights = attn_weights + causal_mask
|
| 156 |
+
|
| 157 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query.dtype)
|
| 158 |
+
attn_weights = nn.functional.dropout(attn_weights, p=dropout, training=module.training)
|
| 159 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
| 160 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
| 161 |
+
|
| 162 |
+
return attn_output, attn_weights
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
class Qwen3Attention(nn.Module):
|
| 166 |
+
"""Multi-headed attention from 'Attention Is All You Need' paper"""
|
| 167 |
+
|
| 168 |
+
def __init__(self, config: Qwen3Config, layer_idx: int):
|
| 169 |
+
super().__init__()
|
| 170 |
+
self.config = config
|
| 171 |
+
self.layer_idx = layer_idx
|
| 172 |
+
self.head_dim = getattr(config, "head_dim", config.hidden_size // config.num_attention_heads)
|
| 173 |
+
self.num_key_value_groups = config.num_attention_heads // config.num_key_value_heads
|
| 174 |
+
self.scaling = self.head_dim**-0.5
|
| 175 |
+
self.attention_dropout = config.attention_dropout
|
| 176 |
+
self.is_causal = True
|
| 177 |
+
|
| 178 |
+
self.q_proj = nn.Linear(
|
| 179 |
+
config.hidden_size, config.num_attention_heads * self.head_dim, bias=config.attention_bias
|
| 180 |
+
)
|
| 181 |
+
self.k_proj = nn.Linear(
|
| 182 |
+
config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
|
| 183 |
+
)
|
| 184 |
+
self.v_proj = nn.Linear(
|
| 185 |
+
config.hidden_size, config.num_key_value_heads * self.head_dim, bias=config.attention_bias
|
| 186 |
+
)
|
| 187 |
+
self.o_proj = nn.Linear(
|
| 188 |
+
config.num_attention_heads * self.head_dim, config.hidden_size, bias=config.attention_bias
|
| 189 |
+
)
|
| 190 |
+
self.q_norm = Qwen3RMSNorm(self.head_dim, eps=config.rms_norm_eps) # unlike olmo, only on the head dim!
|
| 191 |
+
self.k_norm = Qwen3RMSNorm(self.head_dim, eps=config.rms_norm_eps) # thus post q_norm does not need reshape
|
| 192 |
+
self.sliding_window = config.sliding_window if config.layer_types[layer_idx] == "sliding_attention" else None
|
| 193 |
+
|
| 194 |
+
@deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
|
| 195 |
+
def forward(
|
| 196 |
+
self,
|
| 197 |
+
hidden_states: torch.Tensor,
|
| 198 |
+
position_embeddings: tuple[torch.Tensor, torch.Tensor],
|
| 199 |
+
attention_mask: Optional[torch.Tensor],
|
| 200 |
+
past_key_values: Optional[Cache] = None,
|
| 201 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 202 |
+
**kwargs: Unpack[FlashAttentionKwargs],
|
| 203 |
+
) -> tuple[torch.Tensor, Optional[torch.Tensor]]:
|
| 204 |
+
input_shape = hidden_states.shape[:-1]
|
| 205 |
+
hidden_shape = (*input_shape, -1, self.head_dim)
|
| 206 |
+
|
| 207 |
+
query_states = self.q_norm(self.q_proj(hidden_states).view(hidden_shape)).transpose(1, 2)
|
| 208 |
+
key_states = self.k_norm(self.k_proj(hidden_states).view(hidden_shape)).transpose(1, 2)
|
| 209 |
+
value_states = self.v_proj(hidden_states).view(hidden_shape).transpose(1, 2)
|
| 210 |
+
|
| 211 |
+
cos, sin = position_embeddings
|
| 212 |
+
query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin)
|
| 213 |
+
|
| 214 |
+
if past_key_values is not None:
|
| 215 |
+
# sin and cos are specific to RoPE models; cache_position needed for the static cache
|
| 216 |
+
cache_kwargs = {"sin": sin, "cos": cos, "cache_position": cache_position}
|
| 217 |
+
key_states, value_states = past_key_values.update(key_states, value_states, self.layer_idx, cache_kwargs)
|
| 218 |
+
|
| 219 |
+
attention_interface: Callable = eager_attention_forward
|
| 220 |
+
if self.config._attn_implementation != "eager":
|
| 221 |
+
attention_interface = ALL_ATTENTION_FUNCTIONS[self.config._attn_implementation]
|
| 222 |
+
|
| 223 |
+
attn_output, attn_weights = attention_interface(
|
| 224 |
+
self,
|
| 225 |
+
query_states,
|
| 226 |
+
key_states,
|
| 227 |
+
value_states,
|
| 228 |
+
attention_mask,
|
| 229 |
+
dropout=0.0 if not self.training else self.attention_dropout,
|
| 230 |
+
scaling=self.scaling,
|
| 231 |
+
sliding_window=self.sliding_window, # diff with Llama
|
| 232 |
+
**kwargs,
|
| 233 |
+
)
|
| 234 |
+
|
| 235 |
+
attn_output = attn_output.reshape(*input_shape, -1).contiguous()
|
| 236 |
+
attn_output = self.o_proj(attn_output)
|
| 237 |
+
return attn_output, attn_weights
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
class Qwen3DecoderLayer(GradientCheckpointingLayer):
|
| 241 |
+
def __init__(self, config: Qwen3Config, layer_idx: int):
|
| 242 |
+
super().__init__()
|
| 243 |
+
self.hidden_size = config.hidden_size
|
| 244 |
+
|
| 245 |
+
self.self_attn = Qwen3Attention(config=config, layer_idx=layer_idx)
|
| 246 |
+
|
| 247 |
+
self.mlp = Qwen3MLP(config)
|
| 248 |
+
self.input_layernorm = Qwen3RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 249 |
+
self.post_attention_layernorm = Qwen3RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 250 |
+
self.attention_type = config.layer_types[layer_idx]
|
| 251 |
+
|
| 252 |
+
@deprecate_kwarg("past_key_value", new_name="past_key_values", version="4.58")
|
| 253 |
+
def forward(
|
| 254 |
+
self,
|
| 255 |
+
hidden_states: torch.Tensor,
|
| 256 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 257 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 258 |
+
past_key_values: Optional[Cache] = None,
|
| 259 |
+
use_cache: Optional[bool] = False,
|
| 260 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 261 |
+
position_embeddings: Optional[tuple[torch.Tensor, torch.Tensor]] = None, # necessary, but kept here for BC
|
| 262 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 263 |
+
) -> torch.Tensor:
|
| 264 |
+
residual = hidden_states
|
| 265 |
+
hidden_states = self.input_layernorm(hidden_states)
|
| 266 |
+
# Self Attention
|
| 267 |
+
hidden_states, _ = self.self_attn(
|
| 268 |
+
hidden_states=hidden_states,
|
| 269 |
+
attention_mask=attention_mask,
|
| 270 |
+
position_ids=position_ids,
|
| 271 |
+
past_key_values=past_key_values,
|
| 272 |
+
use_cache=use_cache,
|
| 273 |
+
cache_position=cache_position,
|
| 274 |
+
position_embeddings=position_embeddings,
|
| 275 |
+
**kwargs,
|
| 276 |
+
)
|
| 277 |
+
hidden_states = residual + hidden_states
|
| 278 |
+
|
| 279 |
+
# Fully Connected
|
| 280 |
+
residual = hidden_states
|
| 281 |
+
hidden_states = self.post_attention_layernorm(hidden_states)
|
| 282 |
+
hidden_states = self.mlp(hidden_states)
|
| 283 |
+
hidden_states = residual + hidden_states
|
| 284 |
+
return hidden_states
|
| 285 |
+
|
| 286 |
+
|
| 287 |
+
@auto_docstring
|
| 288 |
+
class Qwen3PreTrainedModel(PreTrainedModel):
|
| 289 |
+
config: Qwen3Config
|
| 290 |
+
base_model_prefix = "model"
|
| 291 |
+
supports_gradient_checkpointing = True
|
| 292 |
+
_no_split_modules = ["Qwen3DecoderLayer"]
|
| 293 |
+
_skip_keys_device_placement = ["past_key_values"]
|
| 294 |
+
_supports_flash_attn = True
|
| 295 |
+
_supports_sdpa = True
|
| 296 |
+
_supports_flex_attn = True
|
| 297 |
+
|
| 298 |
+
_can_compile_fullgraph = True
|
| 299 |
+
_supports_attention_backend = True
|
| 300 |
+
_can_record_outputs = {
|
| 301 |
+
"hidden_states": Qwen3DecoderLayer,
|
| 302 |
+
"attentions": Qwen3Attention,
|
| 303 |
+
}
|
| 304 |
+
|
| 305 |
+
|
| 306 |
+
class Qwen3RotaryEmbedding(nn.Module):
|
| 307 |
+
inv_freq: torch.Tensor # fix linting for `register_buffer`
|
| 308 |
+
|
| 309 |
+
def __init__(self, config: Qwen3Config, device=None):
|
| 310 |
+
super().__init__()
|
| 311 |
+
# BC: "rope_type" was originally "type"
|
| 312 |
+
if hasattr(config, "rope_scaling") and isinstance(config.rope_scaling, dict):
|
| 313 |
+
self.rope_type = config.rope_scaling.get("rope_type", config.rope_scaling.get("type"))
|
| 314 |
+
else:
|
| 315 |
+
self.rope_type = "default"
|
| 316 |
+
self.max_seq_len_cached = config.max_position_embeddings
|
| 317 |
+
self.original_max_seq_len = config.max_position_embeddings
|
| 318 |
+
|
| 319 |
+
self.config = config
|
| 320 |
+
self.rope_init_fn = ROPE_INIT_FUNCTIONS[self.rope_type]
|
| 321 |
+
|
| 322 |
+
inv_freq, self.attention_scaling = self.rope_init_fn(self.config, device)
|
| 323 |
+
self.register_buffer("inv_freq", inv_freq, persistent=False)
|
| 324 |
+
self.original_inv_freq = self.inv_freq
|
| 325 |
+
|
| 326 |
+
@torch.no_grad()
|
| 327 |
+
@dynamic_rope_update # power user: used with advanced RoPE types (e.g. dynamic rope)
|
| 328 |
+
def forward(self, x, position_ids):
|
| 329 |
+
inv_freq_expanded = self.inv_freq[None, :, None].float().expand(position_ids.shape[0], -1, 1).to(x.device)
|
| 330 |
+
position_ids_expanded = position_ids[:, None, :].float()
|
| 331 |
+
|
| 332 |
+
device_type = x.device.type if isinstance(x.device.type, str) and x.device.type != "mps" else "cpu"
|
| 333 |
+
with torch.autocast(device_type=device_type, enabled=False): # Force float32
|
| 334 |
+
freqs = (inv_freq_expanded.float() @ position_ids_expanded.float()).transpose(1, 2)
|
| 335 |
+
emb = torch.cat((freqs, freqs), dim=-1)
|
| 336 |
+
cos = emb.cos() * self.attention_scaling
|
| 337 |
+
sin = emb.sin() * self.attention_scaling
|
| 338 |
+
|
| 339 |
+
return cos.to(dtype=x.dtype), sin.to(dtype=x.dtype)
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
@auto_docstring
|
| 343 |
+
class Qwen3Model(Qwen3PreTrainedModel):
|
| 344 |
+
def __init__(self, config: Qwen3Config):
|
| 345 |
+
super().__init__(config)
|
| 346 |
+
self.padding_idx = config.pad_token_id
|
| 347 |
+
self.vocab_size = config.vocab_size
|
| 348 |
+
|
| 349 |
+
self.embed_tokens = nn.Embedding(config.vocab_size, config.hidden_size, self.padding_idx)
|
| 350 |
+
self.layers = nn.ModuleList(
|
| 351 |
+
[Qwen3DecoderLayer(config, layer_idx) for layer_idx in range(config.num_hidden_layers)]
|
| 352 |
+
)
|
| 353 |
+
self.norm = Qwen3RMSNorm(config.hidden_size, eps=config.rms_norm_eps)
|
| 354 |
+
self.rotary_emb = Qwen3RotaryEmbedding(config=config)
|
| 355 |
+
self.gradient_checkpointing = False
|
| 356 |
+
self.has_sliding_layers = "sliding_attention" in self.config.layer_types
|
| 357 |
+
|
| 358 |
+
# Initialize weights and apply final processing
|
| 359 |
+
self.post_init()
|
| 360 |
+
|
| 361 |
+
@check_model_inputs
|
| 362 |
+
@auto_docstring
|
| 363 |
+
def forward(
|
| 364 |
+
self,
|
| 365 |
+
input_ids: Optional[torch.LongTensor] = None,
|
| 366 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 367 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 368 |
+
past_key_values: Optional[Cache] = None,
|
| 369 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
| 370 |
+
use_cache: Optional[bool] = None,
|
| 371 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 372 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 373 |
+
) -> BaseModelOutputWithPast:
|
| 374 |
+
if (input_ids is None) ^ (inputs_embeds is not None):
|
| 375 |
+
raise ValueError("You must specify exactly one of input_ids or inputs_embeds")
|
| 376 |
+
|
| 377 |
+
if inputs_embeds is None:
|
| 378 |
+
inputs_embeds = self.embed_tokens(input_ids)
|
| 379 |
+
|
| 380 |
+
if use_cache and past_key_values is None:
|
| 381 |
+
past_key_values = DynamicCache(config=self.config)
|
| 382 |
+
|
| 383 |
+
if cache_position is None:
|
| 384 |
+
past_seen_tokens = past_key_values.get_seq_length() if past_key_values is not None else 0
|
| 385 |
+
cache_position = torch.arange(
|
| 386 |
+
past_seen_tokens, past_seen_tokens + inputs_embeds.shape[1], device=inputs_embeds.device
|
| 387 |
+
)
|
| 388 |
+
|
| 389 |
+
if position_ids is None:
|
| 390 |
+
position_ids = cache_position.unsqueeze(0)
|
| 391 |
+
|
| 392 |
+
# It may already have been prepared by e.g. `generate`
|
| 393 |
+
if not isinstance(causal_mask_mapping := attention_mask, dict):
|
| 394 |
+
# Prepare mask arguments
|
| 395 |
+
mask_kwargs = {
|
| 396 |
+
"config": self.config,
|
| 397 |
+
"input_embeds": inputs_embeds,
|
| 398 |
+
"attention_mask": attention_mask,
|
| 399 |
+
"cache_position": cache_position,
|
| 400 |
+
"past_key_values": past_key_values,
|
| 401 |
+
"position_ids": position_ids,
|
| 402 |
+
}
|
| 403 |
+
# Create the masks
|
| 404 |
+
causal_mask_mapping = {
|
| 405 |
+
"full_attention": create_causal_mask(**mask_kwargs),
|
| 406 |
+
}
|
| 407 |
+
# The sliding window alternating layers are not always activated depending on the config
|
| 408 |
+
if self.has_sliding_layers:
|
| 409 |
+
causal_mask_mapping["sliding_attention"] = create_sliding_window_causal_mask(**mask_kwargs)
|
| 410 |
+
|
| 411 |
+
hidden_states = inputs_embeds
|
| 412 |
+
|
| 413 |
+
# create position embeddings to be shared across the decoder layers
|
| 414 |
+
position_embeddings = self.rotary_emb(hidden_states, position_ids)
|
| 415 |
+
|
| 416 |
+
for decoder_layer in self.layers[: self.config.num_hidden_layers]:
|
| 417 |
+
hidden_states = decoder_layer(
|
| 418 |
+
hidden_states,
|
| 419 |
+
attention_mask=causal_mask_mapping[decoder_layer.attention_type],
|
| 420 |
+
position_ids=position_ids,
|
| 421 |
+
past_key_values=past_key_values,
|
| 422 |
+
use_cache=use_cache,
|
| 423 |
+
cache_position=cache_position,
|
| 424 |
+
position_embeddings=position_embeddings,
|
| 425 |
+
**kwargs,
|
| 426 |
+
)
|
| 427 |
+
|
| 428 |
+
hidden_states = self.norm(hidden_states)
|
| 429 |
+
return BaseModelOutputWithPast(
|
| 430 |
+
last_hidden_state=hidden_states,
|
| 431 |
+
past_key_values=past_key_values if use_cache else None,
|
| 432 |
+
)
|
| 433 |
+
|
| 434 |
+
|
| 435 |
+
@auto_docstring
|
| 436 |
+
class Qwen3ForGuardModel(Qwen3PreTrainedModel):
|
| 437 |
+
|
| 438 |
+
def __init__(self, config):
|
| 439 |
+
super().__init__(config)
|
| 440 |
+
self.model = Qwen3Model(config)
|
| 441 |
+
self.vocab_size = config.vocab_size
|
| 442 |
+
|
| 443 |
+
self.risk_level_category_pre = nn.Linear(config.hidden_size, config.guard_inner_size, bias=False)
|
| 444 |
+
self.risk_level_category_layernorm = Qwen3RMSNorm(config.guard_inner_size, eps=config.rms_norm_eps)
|
| 445 |
+
self.risk_level_head = nn.Linear(config.guard_inner_size, config.num_risk_level, bias=False)
|
| 446 |
+
self.category_head = nn.Linear(config.guard_inner_size, config.num_category, bias=False)
|
| 447 |
+
|
| 448 |
+
self.query_risk_level_category_pre = nn.Linear(config.hidden_size, config.guard_inner_size, bias=False)
|
| 449 |
+
self.query_risk_level_category_layernorm = Qwen3RMSNorm(config.guard_inner_size, eps=config.rms_norm_eps)
|
| 450 |
+
self.query_risk_level_head = nn.Linear(config.guard_inner_size, config.num_query_risk_level, bias=False)
|
| 451 |
+
self.query_category_head = nn.Linear(config.guard_inner_size, config.num_query_category, bias=False)
|
| 452 |
+
|
| 453 |
+
response_risk_level_map = config.response_risk_level_map
|
| 454 |
+
self.response_risk_level_map = {int(k): v for k, v in response_risk_level_map.items()}
|
| 455 |
+
response_category_map = config.response_category_map
|
| 456 |
+
self.response_category_map = {int(k): v for k, v in response_category_map.items()}
|
| 457 |
+
|
| 458 |
+
query_risk_level_map = config.query_risk_level_map
|
| 459 |
+
self.query_risk_level_map = {int(k): v for k, v in query_risk_level_map.items()}
|
| 460 |
+
query_category_map = config.query_category_map
|
| 461 |
+
self.query_category_map = {int(k): v for k, v in query_category_map.items()}
|
| 462 |
+
|
| 463 |
+
# Initialize weights and apply final processing
|
| 464 |
+
self.post_init()
|
| 465 |
+
|
| 466 |
+
@can_return_tuple
|
| 467 |
+
@auto_docstring
|
| 468 |
+
def forward(
|
| 469 |
+
self,
|
| 470 |
+
input_ids: Optional[torch.LongTensor] = None,
|
| 471 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 472 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 473 |
+
past_key_values: Optional[Cache] = None,
|
| 474 |
+
inputs_embeds: Optional[torch.FloatTensor] = None,
|
| 475 |
+
labels: Optional[torch.LongTensor] = None,
|
| 476 |
+
use_cache: Optional[bool] = None,
|
| 477 |
+
cache_position: Optional[torch.LongTensor] = None,
|
| 478 |
+
logits_to_keep: Union[int, torch.Tensor] = 0,
|
| 479 |
+
**kwargs: Unpack[TransformersKwargs],
|
| 480 |
+
) -> GuardLogitsOutputWithPast:
|
| 481 |
+
r"""
|
| 482 |
+
labels (`torch.LongTensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 483 |
+
Labels for computing the masked language modeling loss. Indices should either be in `[0, ...,
|
| 484 |
+
config.vocab_size]` or -100 (see `input_ids` docstring). Tokens with indices set to `-100` are ignored
|
| 485 |
+
(masked), the loss is only computed for the tokens with labels in `[0, ..., config.vocab_size]`.
|
| 486 |
+
|
| 487 |
+
```"""
|
| 488 |
+
outputs: BaseModelOutputWithPast = self.model(
|
| 489 |
+
input_ids=input_ids,
|
| 490 |
+
attention_mask=attention_mask,
|
| 491 |
+
position_ids=position_ids,
|
| 492 |
+
past_key_values=past_key_values,
|
| 493 |
+
inputs_embeds=inputs_embeds,
|
| 494 |
+
use_cache=use_cache,
|
| 495 |
+
cache_position=cache_position,
|
| 496 |
+
**kwargs,
|
| 497 |
+
)
|
| 498 |
+
|
| 499 |
+
hidden_states = outputs.last_hidden_state
|
| 500 |
+
# Only compute necessary logits, and do not upcast them to float if we are not computing the loss
|
| 501 |
+
slice_indices = slice(-logits_to_keep, None) if isinstance(logits_to_keep, int) else logits_to_keep
|
| 502 |
+
# modify the mapping here
|
| 503 |
+
risk_level_category_x = self.risk_level_category_pre(hidden_states[:, slice_indices, :])
|
| 504 |
+
risk_level_category_x = self.risk_level_category_layernorm(risk_level_category_x)
|
| 505 |
+
|
| 506 |
+
risk_level_logits = self.risk_level_head(risk_level_category_x)
|
| 507 |
+
category_logits = self.category_head(risk_level_category_x)
|
| 508 |
+
|
| 509 |
+
query_risk_level_category_x = self.query_risk_level_category_pre(hidden_states[:, slice_indices, :])
|
| 510 |
+
query_risk_level_category_x = self.query_risk_level_category_layernorm(query_risk_level_category_x)
|
| 511 |
+
|
| 512 |
+
query_risk_level_logits = self.query_risk_level_head(query_risk_level_category_x)
|
| 513 |
+
query_category_logits = self.query_category_head(query_risk_level_category_x)
|
| 514 |
+
|
| 515 |
+
loss = None
|
| 516 |
+
return GuardLogitsOutputWithPast(
|
| 517 |
+
loss=loss,
|
| 518 |
+
risk_level_logits=risk_level_logits,
|
| 519 |
+
category_logits=category_logits,
|
| 520 |
+
query_risk_level_logits=query_risk_level_logits,
|
| 521 |
+
query_category_logits=query_category_logits,
|
| 522 |
+
past_key_values=outputs.past_key_values,
|
| 523 |
+
hidden_states=outputs.hidden_states,
|
| 524 |
+
attentions=outputs.attentions,
|
| 525 |
+
)
|
| 526 |
+
|
| 527 |
+
|
| 528 |
+
@torch.no_grad()
|
| 529 |
+
def stream_generate(
|
| 530 |
+
self,
|
| 531 |
+
input_ids: torch.LongTensor
|
| 532 |
+
) -> Generator[Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor], Optional[torch.LongTensor], None]:
|
| 533 |
+
|
| 534 |
+
seq_length = len(input_ids)
|
| 535 |
+
causal_mask = torch.tril(torch.ones((seq_length, seq_length), device=self.device, dtype=torch.bool))
|
| 536 |
+
causal_mask = causal_mask.unsqueeze(0).unsqueeze(0)
|
| 537 |
+
|
| 538 |
+
past_key_values = None
|
| 539 |
+
current_input_ids = input_ids
|
| 540 |
+
|
| 541 |
+
while True:
|
| 542 |
+
outputs = self.forward(
|
| 543 |
+
input_ids=current_input_ids.unsqueeze(0),
|
| 544 |
+
attention_mask=causal_mask,
|
| 545 |
+
past_key_values=past_key_values
|
| 546 |
+
)
|
| 547 |
+
past_key_values = outputs.past_key_values
|
| 548 |
+
logits_tuple = (
|
| 549 |
+
outputs.risk_level_logits,
|
| 550 |
+
outputs.category_logits,
|
| 551 |
+
outputs.query_risk_level_logits,
|
| 552 |
+
outputs.query_category_logits,
|
| 553 |
+
)
|
| 554 |
+
next_token_id = yield logits_tuple
|
| 555 |
+
|
| 556 |
+
if next_token_id is None:
|
| 557 |
+
break
|
| 558 |
+
current_input_ids = torch.cat([current_input_ids, torch.tensor([next_token_id],device=self.device)])
|
| 559 |
+
cur_len = causal_mask.shape[2]
|
| 560 |
+
new_causal_mask = torch.zeros((1, cur_len+1, cur_len+1), device=causal_mask.device, dtype=torch.bool)
|
| 561 |
+
new_causal_mask[:, :cur_len, :cur_len] = causal_mask.squeeze(0)
|
| 562 |
+
new_causal_mask[:, cur_len, :cur_len+1] = True
|
| 563 |
+
causal_mask = new_causal_mask.unsqueeze(0)
|
| 564 |
+
|
| 565 |
+
|
| 566 |
+
@torch.no_grad()
|
| 567 |
+
def stream_moderate_from_ids(
|
| 568 |
+
self,
|
| 569 |
+
token_ids: torch.LongTensor,
|
| 570 |
+
role: str,
|
| 571 |
+
stream_state: Optional[Generator] = None
|
| 572 |
+
) -> Tuple[Dict, Generator]:
|
| 573 |
+
"""
|
| 574 |
+
Incrementally processes token_ids to evaluate the risk of the latest tokens.
|
| 575 |
+
Args:
|
| 576 |
+
token_ids (torch.LongTensor): The token IDs to process.
|
| 577 |
+
- For the first call (when `stream_state` is None), this should be the
|
| 578 |
+
full sequence of token IDs for the initial prompt.
|
| 579 |
+
- For subsequent calls, this should ONLY be the new, incremental token id.
|
| 580 |
+
Shape should be (1).
|
| 581 |
+
role (str): The role of the speaker for the provided `token_ids`.
|
| 582 |
+
Must be 'user' or 'assistant'.
|
| 583 |
+
stream_state (Generator, optional): The state from the previous call to
|
| 584 |
+
this function. Pass `None` to start a
|
| 585 |
+
new conversation stream.
|
| 586 |
+
|
| 587 |
+
Returns:
|
| 588 |
+
Tuple[Dict, Generator]: A tuple containing:
|
| 589 |
+
- A dictionary with the prediction results for the *last token* processed.
|
| 590 |
+
- The updated stream_state generator to be passed to the next call.
|
| 591 |
+
"""
|
| 592 |
+
token_ids = token_ids.to(self.device)
|
| 593 |
+
|
| 594 |
+
if stream_state is None:
|
| 595 |
+
stream_state = self.stream_generate(token_ids)
|
| 596 |
+
logits_tuple = next(stream_state)
|
| 597 |
+
else:
|
| 598 |
+
logits_tuple = stream_state.send(token_ids)
|
| 599 |
+
if role == "user":
|
| 600 |
+
risk_level_logits = logits_tuple[2]
|
| 601 |
+
category_logits = logits_tuple[3]
|
| 602 |
+
elif role == "assistant":
|
| 603 |
+
risk_level_logits = logits_tuple[0]
|
| 604 |
+
category_logits = logits_tuple[1]
|
| 605 |
+
else:
|
| 606 |
+
raise ValueError("Role must be either 'user' or 'assistant'")
|
| 607 |
+
risk_probs = F.softmax(risk_level_logits.squeeze(1), dim=-1)
|
| 608 |
+
pred_risk_prob, pred_risk_idx = torch.max(risk_probs, dim=-1)
|
| 609 |
+
category_probs = F.softmax(category_logits.squeeze(1), dim=-1)
|
| 610 |
+
pred_cat_prob, pred_cat_idx = torch.max(category_probs, dim=-1)
|
| 611 |
+
|
| 612 |
+
if role == "user":
|
| 613 |
+
result = {
|
| 614 |
+
"risk_level": [self.query_risk_level_map[int(i)] for i in pred_risk_idx[0]],
|
| 615 |
+
"risk_prob": [round(float(i),2) for i in pred_risk_prob[0]],
|
| 616 |
+
"category": [self.query_category_map[int(i)] for i in pred_cat_idx[0]],
|
| 617 |
+
"category_prob": [round(float(i),2) for i in pred_cat_prob[0]]
|
| 618 |
+
}
|
| 619 |
+
else:
|
| 620 |
+
result = {
|
| 621 |
+
"risk_level": [self.response_risk_level_map[int(i)] for i in pred_risk_idx[0]],
|
| 622 |
+
"risk_prob": [round(float(i),2) for i in pred_risk_prob[0]],
|
| 623 |
+
"category": [self.response_category_map[int(i)] for i in pred_cat_idx[0]],
|
| 624 |
+
"category_prob": [round(float(i),2) for i in pred_cat_prob[0]]
|
| 625 |
+
}
|
| 626 |
+
|
| 627 |
+
return result, stream_state
|
| 628 |
+
|
| 629 |
+
@torch.no_grad()
|
| 630 |
+
def close_stream(self, stream_state: Optional[Generator]) -> None:
|
| 631 |
+
if stream_state is not None:
|
| 632 |
+
try:
|
| 633 |
+
stream_state.send(None)
|
| 634 |
+
except StopIteration:
|
| 635 |
+
pass
|
| 636 |
+
finally:
|
| 637 |
+
stream_state.close()
|
| 638 |
+
|
| 639 |
+
__all__ = [
|
| 640 |
+
"Qwen3PreTrainedModel",
|
| 641 |
+
"Qwen3Model",
|
| 642 |
+
"Qwen3ForGuardModel",
|
| 643 |
+
]
|
refs/local
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
local
|
refs/main
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
local
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<|im_start|>",
|
| 4 |
+
"<|im_end|>",
|
| 5 |
+
"<|object_ref_start|>",
|
| 6 |
+
"<|object_ref_end|>",
|
| 7 |
+
"<|box_start|>",
|
| 8 |
+
"<|box_end|>",
|
| 9 |
+
"<|quad_start|>",
|
| 10 |
+
"<|quad_end|>",
|
| 11 |
+
"<|vision_start|>",
|
| 12 |
+
"<|vision_end|>",
|
| 13 |
+
"<|vision_pad|>",
|
| 14 |
+
"<|image_pad|>",
|
| 15 |
+
"<|video_pad|>"
|
| 16 |
+
],
|
| 17 |
+
"eos_token": {
|
| 18 |
+
"content": "<|im_end|>",
|
| 19 |
+
"lstrip": false,
|
| 20 |
+
"normalized": false,
|
| 21 |
+
"rstrip": false,
|
| 22 |
+
"single_word": false
|
| 23 |
+
},
|
| 24 |
+
"pad_token": {
|
| 25 |
+
"content": "<|endoftext|>",
|
| 26 |
+
"lstrip": false,
|
| 27 |
+
"normalized": false,
|
| 28 |
+
"rstrip": false,
|
| 29 |
+
"single_word": false
|
| 30 |
+
}
|
| 31 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aeb13307a71acd8fe81861d94ad54ab689df773318809eed3cbe794b4492dae4
|
| 3 |
+
size 11422654
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_prefix_space": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"151643": {
|
| 6 |
+
"content": "<|endoftext|>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"151644": {
|
| 14 |
+
"content": "<|im_start|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"151645": {
|
| 22 |
+
"content": "<|im_end|>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"151646": {
|
| 30 |
+
"content": "<|object_ref_start|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"151647": {
|
| 38 |
+
"content": "<|object_ref_end|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"151648": {
|
| 46 |
+
"content": "<|box_start|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"151649": {
|
| 54 |
+
"content": "<|box_end|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"151650": {
|
| 62 |
+
"content": "<|quad_start|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"151651": {
|
| 70 |
+
"content": "<|quad_end|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"151652": {
|
| 78 |
+
"content": "<|vision_start|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"151653": {
|
| 86 |
+
"content": "<|vision_end|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"151654": {
|
| 94 |
+
"content": "<|vision_pad|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"151655": {
|
| 102 |
+
"content": "<|image_pad|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"151656": {
|
| 110 |
+
"content": "<|video_pad|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"151657": {
|
| 118 |
+
"content": "<tool_call>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": false
|
| 124 |
+
},
|
| 125 |
+
"151658": {
|
| 126 |
+
"content": "</tool_call>",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": false
|
| 132 |
+
},
|
| 133 |
+
"151659": {
|
| 134 |
+
"content": "<|fim_prefix|>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": false
|
| 140 |
+
},
|
| 141 |
+
"151660": {
|
| 142 |
+
"content": "<|fim_middle|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": false
|
| 148 |
+
},
|
| 149 |
+
"151661": {
|
| 150 |
+
"content": "<|fim_suffix|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": false
|
| 156 |
+
},
|
| 157 |
+
"151662": {
|
| 158 |
+
"content": "<|fim_pad|>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": false
|
| 164 |
+
},
|
| 165 |
+
"151663": {
|
| 166 |
+
"content": "<|repo_name|>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": false
|
| 172 |
+
},
|
| 173 |
+
"151664": {
|
| 174 |
+
"content": "<|file_sep|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": false
|
| 180 |
+
},
|
| 181 |
+
"151665": {
|
| 182 |
+
"content": "<tool_response>",
|
| 183 |
+
"lstrip": false,
|
| 184 |
+
"normalized": false,
|
| 185 |
+
"rstrip": false,
|
| 186 |
+
"single_word": false,
|
| 187 |
+
"special": false
|
| 188 |
+
},
|
| 189 |
+
"151666": {
|
| 190 |
+
"content": "</tool_response>",
|
| 191 |
+
"lstrip": false,
|
| 192 |
+
"normalized": false,
|
| 193 |
+
"rstrip": false,
|
| 194 |
+
"single_word": false,
|
| 195 |
+
"special": false
|
| 196 |
+
},
|
| 197 |
+
"151667": {
|
| 198 |
+
"content": "<think>",
|
| 199 |
+
"lstrip": false,
|
| 200 |
+
"normalized": false,
|
| 201 |
+
"rstrip": false,
|
| 202 |
+
"single_word": false,
|
| 203 |
+
"special": false
|
| 204 |
+
},
|
| 205 |
+
"151668": {
|
| 206 |
+
"content": "</think>",
|
| 207 |
+
"lstrip": false,
|
| 208 |
+
"normalized": false,
|
| 209 |
+
"rstrip": false,
|
| 210 |
+
"single_word": false,
|
| 211 |
+
"special": false
|
| 212 |
+
}
|
| 213 |
+
},
|
| 214 |
+
"additional_special_tokens": [
|
| 215 |
+
"<|im_start|>",
|
| 216 |
+
"<|im_end|>",
|
| 217 |
+
"<|object_ref_start|>",
|
| 218 |
+
"<|object_ref_end|>",
|
| 219 |
+
"<|box_start|>",
|
| 220 |
+
"<|box_end|>",
|
| 221 |
+
"<|quad_start|>",
|
| 222 |
+
"<|quad_end|>",
|
| 223 |
+
"<|vision_start|>",
|
| 224 |
+
"<|vision_end|>",
|
| 225 |
+
"<|vision_pad|>",
|
| 226 |
+
"<|image_pad|>",
|
| 227 |
+
"<|video_pad|>"
|
| 228 |
+
],
|
| 229 |
+
"bos_token": null,
|
| 230 |
+
"clean_up_tokenization_spaces": false,
|
| 231 |
+
"eos_token": "<|im_end|>",
|
| 232 |
+
"errors": "replace",
|
| 233 |
+
"extra_special_tokens": {},
|
| 234 |
+
"model_max_length": 131072,
|
| 235 |
+
"pad_token": "<|endoftext|>",
|
| 236 |
+
"split_special_tokens": false,
|
| 237 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 238 |
+
"unk_token": null
|
| 239 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|