Instructions to use harshit2312/Nanbeige4.2-3B-mlx-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use harshit2312/Nanbeige4.2-3B-mlx-8bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("harshit2312/Nanbeige4.2-3B-mlx-8bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use harshit2312/Nanbeige4.2-3B-mlx-8bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "harshit2312/Nanbeige4.2-3B-mlx-8bit"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "harshit2312/Nanbeige4.2-3B-mlx-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use harshit2312/Nanbeige4.2-3B-mlx-8bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "harshit2312/Nanbeige4.2-3B-mlx-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "harshit2312/Nanbeige4.2-3B-mlx-8bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "harshit2312/Nanbeige4.2-3B-mlx-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use harshit2312/Nanbeige4.2-3B-mlx-8bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "harshit2312/Nanbeige4.2-3B-mlx-8bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default harshit2312/Nanbeige4.2-3B-mlx-8bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use harshit2312/Nanbeige4.2-3B-mlx-8bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "harshit2312/Nanbeige4.2-3B-mlx-8bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "harshit2312/Nanbeige4.2-3B-mlx-8bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Add Nanbeige4.2-3B 8-bit MLX conversion + arch module
Browse files- .gitattributes +1 -0
- README.md +70 -0
- chat_template.jinja +195 -0
- config.json +44 -0
- generation_config.json +10 -0
- model.safetensors +3 -0
- model.safetensors.index.json +521 -0
- nanbeige.py +197 -0
- tokenizer.json +3 -0
- tokenizer_config.json +17 -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,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
- zh
|
| 6 |
+
library_name: mlx
|
| 7 |
+
pipeline_tag: text-generation
|
| 8 |
+
tags:
|
| 9 |
+
- llm
|
| 10 |
+
- nanbeige
|
| 11 |
+
- mlx
|
| 12 |
+
base_model: Nanbeige/Nanbeige4.2-3B
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# harshit2312/Nanbeige4.2-3B-mlx-8bit
|
| 16 |
+
|
| 17 |
+
This is an **8-bit MLX** conversion of [Nanbeige/Nanbeige4.2-3B](https://huggingface.co/Nanbeige/Nanbeige4.2-3B),
|
| 18 |
+
for running on Apple Silicon. Converted from the official weights with
|
| 19 |
+
[mlx-lm](https://github.com/ml-explore/mlx-lm) **0.31.3** (8-bit, group size 64).
|
| 20 |
+
|
| 21 |
+
## ⚠️ Requires a custom architecture module
|
| 22 |
+
|
| 23 |
+
Nanbeige4.2 is a **looped / recurrent-depth transformer** (`num_loops: 2` — the decoder
|
| 24 |
+
stack is executed twice, each pass with its own KV cache). Stock `mlx-lm` does **not**
|
| 25 |
+
ship a `nanbeige` architecture, so loading this repo directly will fail with
|
| 26 |
+
`Model type nanbeige not supported`. Install the bundled `nanbeige.py` into your mlx-lm first:
|
| 27 |
+
|
| 28 |
+
```python
|
| 29 |
+
import os, shutil, mlx_lm
|
| 30 |
+
from huggingface_hub import hf_hub_download
|
| 31 |
+
|
| 32 |
+
src = hf_hub_download("harshit2312/Nanbeige4.2-3B-mlx-8bit", "nanbeige.py")
|
| 33 |
+
dst = os.path.join(os.path.dirname(mlx_lm.__file__), "models", "nanbeige.py")
|
| 34 |
+
shutil.copy(src, dst)
|
| 35 |
+
print("installed nanbeige architecture ->", dst)
|
| 36 |
+
```
|
| 37 |
+
|
| 38 |
+
## Use with mlx
|
| 39 |
+
|
| 40 |
+
```bash
|
| 41 |
+
pip install mlx-lm
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
from mlx_lm import load, generate
|
| 46 |
+
|
| 47 |
+
model, tokenizer = load("harshit2312/Nanbeige4.2-3B-mlx-8bit")
|
| 48 |
+
|
| 49 |
+
messages = [{"role": "user", "content": "What is unified memory on Apple Silicon?"}]
|
| 50 |
+
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
|
| 51 |
+
|
| 52 |
+
response = generate(model, tokenizer, prompt=prompt, verbose=True, max_tokens=512)
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
> Note: Nanbeige4.2-3B is a **reasoning model** — its chat template opens the assistant
|
| 56 |
+
> turn with a `<think>` block, so responses begin with visible chain-of-thought.
|
| 57 |
+
|
| 58 |
+
## Verification
|
| 59 |
+
|
| 60 |
+
The MLX architecture port was validated against the official HuggingFace implementation
|
| 61 |
+
(fp32, eager attention): **40/40 greedy tokens matched**, with the MLX token being the
|
| 62 |
+
reference's argmax at every position.
|
| 63 |
+
|
| 64 |
+
## Conversion details
|
| 65 |
+
|
| 66 |
+
| | |
|
| 67 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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
|
| 3 |
+
{%- macro visible_text(content) -%}
|
| 4 |
+
{%- if content is string -%}
|
| 5 |
+
{{- content }}
|
| 6 |
+
{%- elif content is iterable and content is not mapping -%}
|
| 7 |
+
{%- for item in content -%}
|
| 8 |
+
{%- if item is mapping and item.type == 'text' -%}
|
| 9 |
+
{{- item.text }}
|
| 10 |
+
{%- elif item is string -%}
|
| 11 |
+
{{- item }}
|
| 12 |
+
{%- elif item is mapping and item.type in ['image', 'image_url', 'video', 'video_url', 'audio', 'audio_url', 'input_audio'] -%}
|
| 13 |
+
{%- set media_type = item.type | replace('_url', '') | replace('input_', '') -%}
|
| 14 |
+
{{- "<reminder>You are unable to process this " ~ media_type ~ " because you don't have multi-modal input ability. Try different methods.</reminder>" }}
|
| 15 |
+
{%- endif -%}
|
| 16 |
+
{%- endfor -%}
|
| 17 |
+
{%- else -%}
|
| 18 |
+
{{- content }}
|
| 19 |
+
{%- endif -%}
|
| 20 |
+
{%- endmacro -%}
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
{%- set tool_call_format = tool_call_format if tool_call_format is defined else 'xml' %}
|
| 24 |
+
{%- if tools %}
|
| 25 |
+
{{- '<|im_start|>system\n' }}
|
| 26 |
+
{%- if messages|length > 0 and messages[0].get('role', '') == 'system' %}
|
| 27 |
+
{{- visible_text(messages[0].content) + '\n\n' }}
|
| 28 |
+
{%- else %}
|
| 29 |
+
{{- '你是一位工具函数调用专家,你会得到一个问题和一组可能的工具函数。根据问题,你需要进行一个或多个函数/工具调用以实现目的,请尽量尝试探索通过工具解决问题。\n如果没有一个函数可以使用,请直接使用自然语言回复用户。\n如果给定的问题缺少函数所需的参数,请使用自然语言进行提问,向用户询问必要信息。\n如果调用结果已经足够回答用户问题,请对历史结果进行总结,使用自然语言回复用户。' }}
|
| 30 |
+
{%- endif %}
|
| 31 |
+
|
| 32 |
+
{{- "# 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>" }}
|
| 33 |
+
{%- for tool in tools %}
|
| 34 |
+
{{- "\n" }}
|
| 35 |
+
{{- tool | tojson }}
|
| 36 |
+
{%- endfor %}
|
| 37 |
+
|
| 38 |
+
{%- if tool_call_format == 'json' %}
|
| 39 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n" }}
|
| 40 |
+
{{- '<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n' }}
|
| 41 |
+
{%- else %}
|
| 42 |
+
{{- "\n</tools>\n\nFor each function call, output the function name and arguments within the following XML format:\n" }}
|
| 43 |
+
{{- '<tool_call>
|
| 44 |
+
<function=example_function_name>
|
| 45 |
+
<parameter=example_parameter_1>
|
| 46 |
+
value_1
|
| 47 |
+
</parameter>
|
| 48 |
+
<parameter=example_parameter_2>
|
| 49 |
+
This is the value for the second parameter
|
| 50 |
+
that can span
|
| 51 |
+
multiple lines
|
| 52 |
+
</parameter>
|
| 53 |
+
</function>
|
| 54 |
+
</tool_call><|im_end|>\n' }}
|
| 55 |
+
{%- endif %}
|
| 56 |
+
|
| 57 |
+
{%- else %}
|
| 58 |
+
{%- if messages|length > 0 and messages[0].get('role', '') == 'system' %}
|
| 59 |
+
{{- '<|im_start|>system\n' + visible_text(messages[0].content) + '<|im_end|>\n' }}
|
| 60 |
+
{%- else %}
|
| 61 |
+
{{- '<|im_start|>system\n你是南北阁,一款由BOSS直聘自主研发并训练的专业大语言模型。<|im_end|>\n' }}
|
| 62 |
+
{%- endif %}
|
| 63 |
+
{%- endif %}
|
| 64 |
+
|
| 65 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 66 |
+
{%- for message in messages[::-1] %}
|
| 67 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 68 |
+
{%- if ns.multi_step_tool and message.get('role', '') == "user" and visible_text(message.content) is string and not(visible_text(message.content).startswith('<tool_response>') and visible_text(message.content).endswith('</tool_response>')) %}
|
| 69 |
+
{%- set ns.multi_step_tool = false %}
|
| 70 |
+
{%- set ns.last_query_index = index %}
|
| 71 |
+
{%- endif %}
|
| 72 |
+
{%- endfor %}
|
| 73 |
+
|
| 74 |
+
{%- for message in messages %}
|
| 75 |
+
{%- if visible_text(message.content) is string %}
|
| 76 |
+
{%- set content = visible_text(message.content) %}
|
| 77 |
+
{%- else %}
|
| 78 |
+
{%- set content = '' %}
|
| 79 |
+
{%- endif %}
|
| 80 |
+
|
| 81 |
+
{%- if message.get('role', '') == "system" %}
|
| 82 |
+
{%- if not loop.first %}
|
| 83 |
+
{{- raise_exception('System message must be at the beginning.') }}
|
| 84 |
+
{%- endif %}
|
| 85 |
+
|
| 86 |
+
{%- elif message.get('role', '') == "assistant" %}
|
| 87 |
+
{%- set reasoning_content = '' %}
|
| 88 |
+
{%- if message.reasoning_content is string %}
|
| 89 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 90 |
+
{%- else %}
|
| 91 |
+
{%- if '</think>' in content %}
|
| 92 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 93 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 94 |
+
{%- endif %}
|
| 95 |
+
{%- endif %}
|
| 96 |
+
{%- set reasoning_content = reasoning_content|trim %}
|
| 97 |
+
|
| 98 |
+
{%- if (preserve_thinking is defined and preserve_thinking is false) and (loop.index0 < ns.last_query_index) %}
|
| 99 |
+
{{- '<|im_start|>' + message.get('role', '') + '\n<think>\n\n</think>\n\n' + content }}
|
| 100 |
+
{%- else %}
|
| 101 |
+
{{- '<|im_start|>' + message.get('role', '') + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 102 |
+
{%- endif %}
|
| 103 |
+
|
| 104 |
+
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 105 |
+
{%- if tool_call_format == 'json' %}
|
| 106 |
+
{%- for tool_call in message.tool_calls %}
|
| 107 |
+
{%- if (loop.first and content) or (not loop.first) %}
|
| 108 |
+
{{- '\n' }}
|
| 109 |
+
{%- endif %}
|
| 110 |
+
{%- if tool_call.function %}
|
| 111 |
+
{%- set tool_call = tool_call.function %}
|
| 112 |
+
{%- endif %}
|
| 113 |
+
{{- '<tool_call>\n{"name": "' }}
|
| 114 |
+
{{- tool_call.name }}
|
| 115 |
+
{{- '", "arguments": ' }}
|
| 116 |
+
{%- if tool_call.arguments is string %}
|
| 117 |
+
{{- tool_call.arguments }}
|
| 118 |
+
{%- else %}
|
| 119 |
+
{{- tool_call.arguments | tojson }}
|
| 120 |
+
{%- endif %}
|
| 121 |
+
{{- '}\n</tool_call>' }}
|
| 122 |
+
{%- endfor %}
|
| 123 |
+
{%- else %}
|
| 124 |
+
{%- for tool_call in message.tool_calls %}
|
| 125 |
+
{%- if tool_call.function is defined %}
|
| 126 |
+
{%- set tool_call = tool_call.function %}
|
| 127 |
+
{%- endif %}
|
| 128 |
+
|
| 129 |
+
{%- if loop.first %}
|
| 130 |
+
{%- if content|trim %}
|
| 131 |
+
{{- '
|
| 132 |
+
|
| 133 |
+
<tool_call>
|
| 134 |
+
<function=' + tool_call.name + '>
|
| 135 |
+
' }}
|
| 136 |
+
{%- else %}
|
| 137 |
+
{{- '<tool_call>
|
| 138 |
+
<function=' + tool_call.name + '>
|
| 139 |
+
' }}
|
| 140 |
+
{%- endif %}
|
| 141 |
+
{%- else %}
|
| 142 |
+
{{- '
|
| 143 |
+
<tool_call>
|
| 144 |
+
<function=' + tool_call.name + '>
|
| 145 |
+
' }}
|
| 146 |
+
{%- endif %}
|
| 147 |
+
|
| 148 |
+
{%- if tool_call.arguments is defined %}
|
| 149 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 150 |
+
{{- '<parameter=' + args_name + '>
|
| 151 |
+
' }}
|
| 152 |
+
{%- set args_value = args_value | string if args_value is string else args_value | tojson | safe %}
|
| 153 |
+
{{- args_value }}
|
| 154 |
+
{{- '
|
| 155 |
+
</parameter>
|
| 156 |
+
' }}
|
| 157 |
+
{%- endfor %}
|
| 158 |
+
{%- endif %}
|
| 159 |
+
{{- '</function>
|
| 160 |
+
</tool_call>' }}
|
| 161 |
+
{%- endfor %}
|
| 162 |
+
{%- endif %}
|
| 163 |
+
{%- endif %}
|
| 164 |
+
{{- '<|im_end|>\n' }}
|
| 165 |
+
|
| 166 |
+
{%- elif message.get('role', '') == "tool" %}
|
| 167 |
+
{%- if loop.previtem and loop.previtem.get('role', '') != "tool" %}
|
| 168 |
+
{{- '<|im_start|>user' }}
|
| 169 |
+
{%- endif %}
|
| 170 |
+
{{- '\n<tool_response>\n' }}
|
| 171 |
+
{{- content }}
|
| 172 |
+
{{- '\n</tool_response>' }}
|
| 173 |
+
{%- if loop.last or loop.nextitem.get('role', '') != "tool" %}
|
| 174 |
+
{{- '<|im_end|>\n' }}
|
| 175 |
+
{%- endif %}
|
| 176 |
+
{%- elif message.get('role', '') != '' %}
|
| 177 |
+
{{- '<|im_start|>' + message.get('role', '') + '\n' + content + '<|im_end|>' + '\n' }}
|
| 178 |
+
{%- endif %}
|
| 179 |
+
{%- endfor %}
|
| 180 |
+
|
| 181 |
+
{%- if add_generation_prompt %}
|
| 182 |
+
{{- '<|im_start|>assistant\n' }}
|
| 183 |
+
|
| 184 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 185 |
+
{{- '<think>
|
| 186 |
+
|
| 187 |
+
</think>
|
| 188 |
+
|
| 189 |
+
' }}
|
| 190 |
+
{%- else %}
|
| 191 |
+
{{- '<think>
|
| 192 |
+
' }}
|
| 193 |
+
{%- endif %}
|
| 194 |
+
|
| 195 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"NanbeigeForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"bos_token_id": 166100,
|
| 8 |
+
"eos_token_id": 166101,
|
| 9 |
+
"head_dim": 128,
|
| 10 |
+
"hidden_act": "silu",
|
| 11 |
+
"hidden_size": 3072,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"intermediate_size": 10752,
|
| 14 |
+
"kv_channels": 128,
|
| 15 |
+
"loop_loss_weights": [],
|
| 16 |
+
"max_length": null,
|
| 17 |
+
"max_position_embeddings": 262144,
|
| 18 |
+
"model_type": "nanbeige",
|
| 19 |
+
"num_attention_heads": 48,
|
| 20 |
+
"num_hidden_layers": 22,
|
| 21 |
+
"num_key_value_heads": 8,
|
| 22 |
+
"num_loops": 2,
|
| 23 |
+
"pad_token_id": 0,
|
| 24 |
+
"pretraining_tp": 1,
|
| 25 |
+
"quantization": {
|
| 26 |
+
"group_size": 64,
|
| 27 |
+
"bits": 8,
|
| 28 |
+
"mode": "affine"
|
| 29 |
+
},
|
| 30 |
+
"quantization_config": {
|
| 31 |
+
"group_size": 64,
|
| 32 |
+
"bits": 8,
|
| 33 |
+
"mode": "affine"
|
| 34 |
+
},
|
| 35 |
+
"rms_norm_eps": 1e-05,
|
| 36 |
+
"rope_scaling": null,
|
| 37 |
+
"rope_theta": 70000000,
|
| 38 |
+
"skip_loop_final_norm": false,
|
| 39 |
+
"tie_word_embeddings": false,
|
| 40 |
+
"torch_dtype": "bfloat16",
|
| 41 |
+
"transformers_version": "4.42.4",
|
| 42 |
+
"use_cache": true,
|
| 43 |
+
"vocab_size": 166144
|
| 44 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 166100,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": 166101,
|
| 5 |
+
"pad_token_id": 0,
|
| 6 |
+
"temperature": 0.6,
|
| 7 |
+
"top_k": 20,
|
| 8 |
+
"top_p": 0.95,
|
| 9 |
+
"transformers_version": "4.51.0"
|
| 10 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:154ca95b1cdec0a85c69e375d29dd24f871d9f90c1185daca8cff5e161ec3e16
|
| 3 |
+
size 4430601408
|
model.safetensors.index.json
ADDED
|
@@ -0,0 +1,521 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
| 7 |
+
"lm_head.biases": "model.safetensors",
|
| 8 |
+
"lm_head.scales": "model.safetensors",
|
| 9 |
+
"lm_head.weight": "model.safetensors",
|
| 10 |
+
"model.embed_tokens.biases": "model.safetensors",
|
| 11 |
+
"model.embed_tokens.scales": "model.safetensors",
|
| 12 |
+
"model.embed_tokens.weight": "model.safetensors",
|
| 13 |
+
"model.layers.0.input_layernorm.weight": "model.safetensors",
|
| 14 |
+
"model.layers.0.mlp.down_proj.biases": "model.safetensors",
|
| 15 |
+
"model.layers.0.mlp.down_proj.scales": "model.safetensors",
|
| 16 |
+
"model.layers.0.mlp.down_proj.weight": "model.safetensors",
|
| 17 |
+
"model.layers.0.mlp.gate_proj.biases": "model.safetensors",
|
| 18 |
+
"model.layers.0.mlp.gate_proj.scales": "model.safetensors",
|
| 19 |
+
"model.layers.0.mlp.gate_proj.weight": "model.safetensors",
|
| 20 |
+
"model.layers.0.mlp.up_proj.biases": "model.safetensors",
|
| 21 |
+
"model.layers.0.mlp.up_proj.scales": "model.safetensors",
|
| 22 |
+
"model.layers.0.mlp.up_proj.weight": "model.safetensors",
|
| 23 |
+
"model.layers.0.post_attention_layernorm.weight": "model.safetensors",
|
| 24 |
+
"model.layers.0.self_attn.k_proj.biases": "model.safetensors",
|
| 25 |
+
"model.layers.0.self_attn.k_proj.scales": "model.safetensors",
|
| 26 |
+
"model.layers.0.self_attn.k_proj.weight": "model.safetensors",
|
| 27 |
+
"model.layers.0.self_attn.o_proj.biases": "model.safetensors",
|
| 28 |
+
"model.layers.0.self_attn.o_proj.scales": "model.safetensors",
|
| 29 |
+
"model.layers.0.self_attn.o_proj.weight": "model.safetensors",
|
| 30 |
+
"model.layers.0.self_attn.q_proj.biases": "model.safetensors",
|
| 31 |
+
"model.layers.0.self_attn.q_proj.scales": "model.safetensors",
|
| 32 |
+
"model.layers.0.self_attn.q_proj.weight": "model.safetensors",
|
| 33 |
+
"model.layers.0.self_attn.v_proj.biases": "model.safetensors",
|
| 34 |
+
"model.layers.0.self_attn.v_proj.scales": "model.safetensors",
|
| 35 |
+
"model.layers.0.self_attn.v_proj.weight": "model.safetensors",
|
| 36 |
+
"model.layers.1.input_layernorm.weight": "model.safetensors",
|
| 37 |
+
"model.layers.1.mlp.down_proj.biases": "model.safetensors",
|
| 38 |
+
"model.layers.1.mlp.down_proj.scales": "model.safetensors",
|
| 39 |
+
"model.layers.1.mlp.down_proj.weight": "model.safetensors",
|
| 40 |
+
"model.layers.1.mlp.gate_proj.biases": "model.safetensors",
|
| 41 |
+
"model.layers.1.mlp.gate_proj.scales": "model.safetensors",
|
| 42 |
+
"model.layers.1.mlp.gate_proj.weight": "model.safetensors",
|
| 43 |
+
"model.layers.1.mlp.up_proj.biases": "model.safetensors",
|
| 44 |
+
"model.layers.1.mlp.up_proj.scales": "model.safetensors",
|
| 45 |
+
"model.layers.1.mlp.up_proj.weight": "model.safetensors",
|
| 46 |
+
"model.layers.1.post_attention_layernorm.weight": "model.safetensors",
|
| 47 |
+
"model.layers.1.self_attn.k_proj.biases": "model.safetensors",
|
| 48 |
+
"model.layers.1.self_attn.k_proj.scales": "model.safetensors",
|
| 49 |
+
"model.layers.1.self_attn.k_proj.weight": "model.safetensors",
|
| 50 |
+
"model.layers.1.self_attn.o_proj.biases": "model.safetensors",
|
| 51 |
+
"model.layers.1.self_attn.o_proj.scales": "model.safetensors",
|
| 52 |
+
"model.layers.1.self_attn.o_proj.weight": "model.safetensors",
|
| 53 |
+
"model.layers.1.self_attn.q_proj.biases": "model.safetensors",
|
| 54 |
+
"model.layers.1.self_attn.q_proj.scales": "model.safetensors",
|
| 55 |
+
"model.layers.1.self_attn.q_proj.weight": "model.safetensors",
|
| 56 |
+
"model.layers.1.self_attn.v_proj.biases": "model.safetensors",
|
| 57 |
+
"model.layers.1.self_attn.v_proj.scales": "model.safetensors",
|
| 58 |
+
"model.layers.1.self_attn.v_proj.weight": "model.safetensors",
|
| 59 |
+
"model.layers.10.input_layernorm.weight": "model.safetensors",
|
| 60 |
+
"model.layers.10.mlp.down_proj.biases": "model.safetensors",
|
| 61 |
+
"model.layers.10.mlp.down_proj.scales": "model.safetensors",
|
| 62 |
+
"model.layers.10.mlp.down_proj.weight": "model.safetensors",
|
| 63 |
+
"model.layers.10.mlp.gate_proj.biases": "model.safetensors",
|
| 64 |
+
"model.layers.10.mlp.gate_proj.scales": "model.safetensors",
|
| 65 |
+
"model.layers.10.mlp.gate_proj.weight": "model.safetensors",
|
| 66 |
+
"model.layers.10.mlp.up_proj.biases": "model.safetensors",
|
| 67 |
+
"model.layers.10.mlp.up_proj.scales": "model.safetensors",
|
| 68 |
+
"model.layers.10.mlp.up_proj.weight": "model.safetensors",
|
| 69 |
+
"model.layers.10.post_attention_layernorm.weight": "model.safetensors",
|
| 70 |
+
"model.layers.10.self_attn.k_proj.biases": "model.safetensors",
|
| 71 |
+
"model.layers.10.self_attn.k_proj.scales": "model.safetensors",
|
| 72 |
+
"model.layers.10.self_attn.k_proj.weight": "model.safetensors",
|
| 73 |
+
"model.layers.10.self_attn.o_proj.biases": "model.safetensors",
|
| 74 |
+
"model.layers.10.self_attn.o_proj.scales": "model.safetensors",
|
| 75 |
+
"model.layers.10.self_attn.o_proj.weight": "model.safetensors",
|
| 76 |
+
"model.layers.10.self_attn.q_proj.biases": "model.safetensors",
|
| 77 |
+
"model.layers.10.self_attn.q_proj.scales": "model.safetensors",
|
| 78 |
+
"model.layers.10.self_attn.q_proj.weight": "model.safetensors",
|
| 79 |
+
"model.layers.10.self_attn.v_proj.biases": "model.safetensors",
|
| 80 |
+
"model.layers.10.self_attn.v_proj.scales": "model.safetensors",
|
| 81 |
+
"model.layers.10.self_attn.v_proj.weight": "model.safetensors",
|
| 82 |
+
"model.layers.11.input_layernorm.weight": "model.safetensors",
|
| 83 |
+
"model.layers.11.mlp.down_proj.biases": "model.safetensors",
|
| 84 |
+
"model.layers.11.mlp.down_proj.scales": "model.safetensors",
|
| 85 |
+
"model.layers.11.mlp.down_proj.weight": "model.safetensors",
|
| 86 |
+
"model.layers.11.mlp.gate_proj.biases": "model.safetensors",
|
| 87 |
+
"model.layers.11.mlp.gate_proj.scales": "model.safetensors",
|
| 88 |
+
"model.layers.11.mlp.gate_proj.weight": "model.safetensors",
|
| 89 |
+
"model.layers.11.mlp.up_proj.biases": "model.safetensors",
|
| 90 |
+
"model.layers.11.mlp.up_proj.scales": "model.safetensors",
|
| 91 |
+
"model.layers.11.mlp.up_proj.weight": "model.safetensors",
|
| 92 |
+
"model.layers.11.post_attention_layernorm.weight": "model.safetensors",
|
| 93 |
+
"model.layers.11.self_attn.k_proj.biases": "model.safetensors",
|
| 94 |
+
"model.layers.11.self_attn.k_proj.scales": "model.safetensors",
|
| 95 |
+
"model.layers.11.self_attn.k_proj.weight": "model.safetensors",
|
| 96 |
+
"model.layers.11.self_attn.o_proj.biases": "model.safetensors",
|
| 97 |
+
"model.layers.11.self_attn.o_proj.scales": "model.safetensors",
|
| 98 |
+
"model.layers.11.self_attn.o_proj.weight": "model.safetensors",
|
| 99 |
+
"model.layers.11.self_attn.q_proj.biases": "model.safetensors",
|
| 100 |
+
"model.layers.11.self_attn.q_proj.scales": "model.safetensors",
|
| 101 |
+
"model.layers.11.self_attn.q_proj.weight": "model.safetensors",
|
| 102 |
+
"model.layers.11.self_attn.v_proj.biases": "model.safetensors",
|
| 103 |
+
"model.layers.11.self_attn.v_proj.scales": "model.safetensors",
|
| 104 |
+
"model.layers.11.self_attn.v_proj.weight": "model.safetensors",
|
| 105 |
+
"model.layers.12.input_layernorm.weight": "model.safetensors",
|
| 106 |
+
"model.layers.12.mlp.down_proj.biases": "model.safetensors",
|
| 107 |
+
"model.layers.12.mlp.down_proj.scales": "model.safetensors",
|
| 108 |
+
"model.layers.12.mlp.down_proj.weight": "model.safetensors",
|
| 109 |
+
"model.layers.12.mlp.gate_proj.biases": "model.safetensors",
|
| 110 |
+
"model.layers.12.mlp.gate_proj.scales": "model.safetensors",
|
| 111 |
+
"model.layers.12.mlp.gate_proj.weight": "model.safetensors",
|
| 112 |
+
"model.layers.12.mlp.up_proj.biases": "model.safetensors",
|
| 113 |
+
"model.layers.12.mlp.up_proj.scales": "model.safetensors",
|
| 114 |
+
"model.layers.12.mlp.up_proj.weight": "model.safetensors",
|
| 115 |
+
"model.layers.12.post_attention_layernorm.weight": "model.safetensors",
|
| 116 |
+
"model.layers.12.self_attn.k_proj.biases": "model.safetensors",
|
| 117 |
+
"model.layers.12.self_attn.k_proj.scales": "model.safetensors",
|
| 118 |
+
"model.layers.12.self_attn.k_proj.weight": "model.safetensors",
|
| 119 |
+
"model.layers.12.self_attn.o_proj.biases": "model.safetensors",
|
| 120 |
+
"model.layers.12.self_attn.o_proj.scales": "model.safetensors",
|
| 121 |
+
"model.layers.12.self_attn.o_proj.weight": "model.safetensors",
|
| 122 |
+
"model.layers.12.self_attn.q_proj.biases": "model.safetensors",
|
| 123 |
+
"model.layers.12.self_attn.q_proj.scales": "model.safetensors",
|
| 124 |
+
"model.layers.12.self_attn.q_proj.weight": "model.safetensors",
|
| 125 |
+
"model.layers.12.self_attn.v_proj.biases": "model.safetensors",
|
| 126 |
+
"model.layers.12.self_attn.v_proj.scales": "model.safetensors",
|
| 127 |
+
"model.layers.12.self_attn.v_proj.weight": "model.safetensors",
|
| 128 |
+
"model.layers.13.input_layernorm.weight": "model.safetensors",
|
| 129 |
+
"model.layers.13.mlp.down_proj.biases": "model.safetensors",
|
| 130 |
+
"model.layers.13.mlp.down_proj.scales": "model.safetensors",
|
| 131 |
+
"model.layers.13.mlp.down_proj.weight": "model.safetensors",
|
| 132 |
+
"model.layers.13.mlp.gate_proj.biases": "model.safetensors",
|
| 133 |
+
"model.layers.13.mlp.gate_proj.scales": "model.safetensors",
|
| 134 |
+
"model.layers.13.mlp.gate_proj.weight": "model.safetensors",
|
| 135 |
+
"model.layers.13.mlp.up_proj.biases": "model.safetensors",
|
| 136 |
+
"model.layers.13.mlp.up_proj.scales": "model.safetensors",
|
| 137 |
+
"model.layers.13.mlp.up_proj.weight": "model.safetensors",
|
| 138 |
+
"model.layers.13.post_attention_layernorm.weight": "model.safetensors",
|
| 139 |
+
"model.layers.13.self_attn.k_proj.biases": "model.safetensors",
|
| 140 |
+
"model.layers.13.self_attn.k_proj.scales": "model.safetensors",
|
| 141 |
+
"model.layers.13.self_attn.k_proj.weight": "model.safetensors",
|
| 142 |
+
"model.layers.13.self_attn.o_proj.biases": "model.safetensors",
|
| 143 |
+
"model.layers.13.self_attn.o_proj.scales": "model.safetensors",
|
| 144 |
+
"model.layers.13.self_attn.o_proj.weight": "model.safetensors",
|
| 145 |
+
"model.layers.13.self_attn.q_proj.biases": "model.safetensors",
|
| 146 |
+
"model.layers.13.self_attn.q_proj.scales": "model.safetensors",
|
| 147 |
+
"model.layers.13.self_attn.q_proj.weight": "model.safetensors",
|
| 148 |
+
"model.layers.13.self_attn.v_proj.biases": "model.safetensors",
|
| 149 |
+
"model.layers.13.self_attn.v_proj.scales": "model.safetensors",
|
| 150 |
+
"model.layers.13.self_attn.v_proj.weight": "model.safetensors",
|
| 151 |
+
"model.layers.14.input_layernorm.weight": "model.safetensors",
|
| 152 |
+
"model.layers.14.mlp.down_proj.biases": "model.safetensors",
|
| 153 |
+
"model.layers.14.mlp.down_proj.scales": "model.safetensors",
|
| 154 |
+
"model.layers.14.mlp.down_proj.weight": "model.safetensors",
|
| 155 |
+
"model.layers.14.mlp.gate_proj.biases": "model.safetensors",
|
| 156 |
+
"model.layers.14.mlp.gate_proj.scales": "model.safetensors",
|
| 157 |
+
"model.layers.14.mlp.gate_proj.weight": "model.safetensors",
|
| 158 |
+
"model.layers.14.mlp.up_proj.biases": "model.safetensors",
|
| 159 |
+
"model.layers.14.mlp.up_proj.scales": "model.safetensors",
|
| 160 |
+
"model.layers.14.mlp.up_proj.weight": "model.safetensors",
|
| 161 |
+
"model.layers.14.post_attention_layernorm.weight": "model.safetensors",
|
| 162 |
+
"model.layers.14.self_attn.k_proj.biases": "model.safetensors",
|
| 163 |
+
"model.layers.14.self_attn.k_proj.scales": "model.safetensors",
|
| 164 |
+
"model.layers.14.self_attn.k_proj.weight": "model.safetensors",
|
| 165 |
+
"model.layers.14.self_attn.o_proj.biases": "model.safetensors",
|
| 166 |
+
"model.layers.14.self_attn.o_proj.scales": "model.safetensors",
|
| 167 |
+
"model.layers.14.self_attn.o_proj.weight": "model.safetensors",
|
| 168 |
+
"model.layers.14.self_attn.q_proj.biases": "model.safetensors",
|
| 169 |
+
"model.layers.14.self_attn.q_proj.scales": "model.safetensors",
|
| 170 |
+
"model.layers.14.self_attn.q_proj.weight": "model.safetensors",
|
| 171 |
+
"model.layers.14.self_attn.v_proj.biases": "model.safetensors",
|
| 172 |
+
"model.layers.14.self_attn.v_proj.scales": "model.safetensors",
|
| 173 |
+
"model.layers.14.self_attn.v_proj.weight": "model.safetensors",
|
| 174 |
+
"model.layers.15.input_layernorm.weight": "model.safetensors",
|
| 175 |
+
"model.layers.15.mlp.down_proj.biases": "model.safetensors",
|
| 176 |
+
"model.layers.15.mlp.down_proj.scales": "model.safetensors",
|
| 177 |
+
"model.layers.15.mlp.down_proj.weight": "model.safetensors",
|
| 178 |
+
"model.layers.15.mlp.gate_proj.biases": "model.safetensors",
|
| 179 |
+
"model.layers.15.mlp.gate_proj.scales": "model.safetensors",
|
| 180 |
+
"model.layers.15.mlp.gate_proj.weight": "model.safetensors",
|
| 181 |
+
"model.layers.15.mlp.up_proj.biases": "model.safetensors",
|
| 182 |
+
"model.layers.15.mlp.up_proj.scales": "model.safetensors",
|
| 183 |
+
"model.layers.15.mlp.up_proj.weight": "model.safetensors",
|
| 184 |
+
"model.layers.15.post_attention_layernorm.weight": "model.safetensors",
|
| 185 |
+
"model.layers.15.self_attn.k_proj.biases": "model.safetensors",
|
| 186 |
+
"model.layers.15.self_attn.k_proj.scales": "model.safetensors",
|
| 187 |
+
"model.layers.15.self_attn.k_proj.weight": "model.safetensors",
|
| 188 |
+
"model.layers.15.self_attn.o_proj.biases": "model.safetensors",
|
| 189 |
+
"model.layers.15.self_attn.o_proj.scales": "model.safetensors",
|
| 190 |
+
"model.layers.15.self_attn.o_proj.weight": "model.safetensors",
|
| 191 |
+
"model.layers.15.self_attn.q_proj.biases": "model.safetensors",
|
| 192 |
+
"model.layers.15.self_attn.q_proj.scales": "model.safetensors",
|
| 193 |
+
"model.layers.15.self_attn.q_proj.weight": "model.safetensors",
|
| 194 |
+
"model.layers.15.self_attn.v_proj.biases": "model.safetensors",
|
| 195 |
+
"model.layers.15.self_attn.v_proj.scales": "model.safetensors",
|
| 196 |
+
"model.layers.15.self_attn.v_proj.weight": "model.safetensors",
|
| 197 |
+
"model.layers.16.input_layernorm.weight": "model.safetensors",
|
| 198 |
+
"model.layers.16.mlp.down_proj.biases": "model.safetensors",
|
| 199 |
+
"model.layers.16.mlp.down_proj.scales": "model.safetensors",
|
| 200 |
+
"model.layers.16.mlp.down_proj.weight": "model.safetensors",
|
| 201 |
+
"model.layers.16.mlp.gate_proj.biases": "model.safetensors",
|
| 202 |
+
"model.layers.16.mlp.gate_proj.scales": "model.safetensors",
|
| 203 |
+
"model.layers.16.mlp.gate_proj.weight": "model.safetensors",
|
| 204 |
+
"model.layers.16.mlp.up_proj.biases": "model.safetensors",
|
| 205 |
+
"model.layers.16.mlp.up_proj.scales": "model.safetensors",
|
| 206 |
+
"model.layers.16.mlp.up_proj.weight": "model.safetensors",
|
| 207 |
+
"model.layers.16.post_attention_layernorm.weight": "model.safetensors",
|
| 208 |
+
"model.layers.16.self_attn.k_proj.biases": "model.safetensors",
|
| 209 |
+
"model.layers.16.self_attn.k_proj.scales": "model.safetensors",
|
| 210 |
+
"model.layers.16.self_attn.k_proj.weight": "model.safetensors",
|
| 211 |
+
"model.layers.16.self_attn.o_proj.biases": "model.safetensors",
|
| 212 |
+
"model.layers.16.self_attn.o_proj.scales": "model.safetensors",
|
| 213 |
+
"model.layers.16.self_attn.o_proj.weight": "model.safetensors",
|
| 214 |
+
"model.layers.16.self_attn.q_proj.biases": "model.safetensors",
|
| 215 |
+
"model.layers.16.self_attn.q_proj.scales": "model.safetensors",
|
| 216 |
+
"model.layers.16.self_attn.q_proj.weight": "model.safetensors",
|
| 217 |
+
"model.layers.16.self_attn.v_proj.biases": "model.safetensors",
|
| 218 |
+
"model.layers.16.self_attn.v_proj.scales": "model.safetensors",
|
| 219 |
+
"model.layers.16.self_attn.v_proj.weight": "model.safetensors",
|
| 220 |
+
"model.layers.17.input_layernorm.weight": "model.safetensors",
|
| 221 |
+
"model.layers.17.mlp.down_proj.biases": "model.safetensors",
|
| 222 |
+
"model.layers.17.mlp.down_proj.scales": "model.safetensors",
|
| 223 |
+
"model.layers.17.mlp.down_proj.weight": "model.safetensors",
|
| 224 |
+
"model.layers.17.mlp.gate_proj.biases": "model.safetensors",
|
| 225 |
+
"model.layers.17.mlp.gate_proj.scales": "model.safetensors",
|
| 226 |
+
"model.layers.17.mlp.gate_proj.weight": "model.safetensors",
|
| 227 |
+
"model.layers.17.mlp.up_proj.biases": "model.safetensors",
|
| 228 |
+
"model.layers.17.mlp.up_proj.scales": "model.safetensors",
|
| 229 |
+
"model.layers.17.mlp.up_proj.weight": "model.safetensors",
|
| 230 |
+
"model.layers.17.post_attention_layernorm.weight": "model.safetensors",
|
| 231 |
+
"model.layers.17.self_attn.k_proj.biases": "model.safetensors",
|
| 232 |
+
"model.layers.17.self_attn.k_proj.scales": "model.safetensors",
|
| 233 |
+
"model.layers.17.self_attn.k_proj.weight": "model.safetensors",
|
| 234 |
+
"model.layers.17.self_attn.o_proj.biases": "model.safetensors",
|
| 235 |
+
"model.layers.17.self_attn.o_proj.scales": "model.safetensors",
|
| 236 |
+
"model.layers.17.self_attn.o_proj.weight": "model.safetensors",
|
| 237 |
+
"model.layers.17.self_attn.q_proj.biases": "model.safetensors",
|
| 238 |
+
"model.layers.17.self_attn.q_proj.scales": "model.safetensors",
|
| 239 |
+
"model.layers.17.self_attn.q_proj.weight": "model.safetensors",
|
| 240 |
+
"model.layers.17.self_attn.v_proj.biases": "model.safetensors",
|
| 241 |
+
"model.layers.17.self_attn.v_proj.scales": "model.safetensors",
|
| 242 |
+
"model.layers.17.self_attn.v_proj.weight": "model.safetensors",
|
| 243 |
+
"model.layers.18.input_layernorm.weight": "model.safetensors",
|
| 244 |
+
"model.layers.18.mlp.down_proj.biases": "model.safetensors",
|
| 245 |
+
"model.layers.18.mlp.down_proj.scales": "model.safetensors",
|
| 246 |
+
"model.layers.18.mlp.down_proj.weight": "model.safetensors",
|
| 247 |
+
"model.layers.18.mlp.gate_proj.biases": "model.safetensors",
|
| 248 |
+
"model.layers.18.mlp.gate_proj.scales": "model.safetensors",
|
| 249 |
+
"model.layers.18.mlp.gate_proj.weight": "model.safetensors",
|
| 250 |
+
"model.layers.18.mlp.up_proj.biases": "model.safetensors",
|
| 251 |
+
"model.layers.18.mlp.up_proj.scales": "model.safetensors",
|
| 252 |
+
"model.layers.18.mlp.up_proj.weight": "model.safetensors",
|
| 253 |
+
"model.layers.18.post_attention_layernorm.weight": "model.safetensors",
|
| 254 |
+
"model.layers.18.self_attn.k_proj.biases": "model.safetensors",
|
| 255 |
+
"model.layers.18.self_attn.k_proj.scales": "model.safetensors",
|
| 256 |
+
"model.layers.18.self_attn.k_proj.weight": "model.safetensors",
|
| 257 |
+
"model.layers.18.self_attn.o_proj.biases": "model.safetensors",
|
| 258 |
+
"model.layers.18.self_attn.o_proj.scales": "model.safetensors",
|
| 259 |
+
"model.layers.18.self_attn.o_proj.weight": "model.safetensors",
|
| 260 |
+
"model.layers.18.self_attn.q_proj.biases": "model.safetensors",
|
| 261 |
+
"model.layers.18.self_attn.q_proj.scales": "model.safetensors",
|
| 262 |
+
"model.layers.18.self_attn.q_proj.weight": "model.safetensors",
|
| 263 |
+
"model.layers.18.self_attn.v_proj.biases": "model.safetensors",
|
| 264 |
+
"model.layers.18.self_attn.v_proj.scales": "model.safetensors",
|
| 265 |
+
"model.layers.18.self_attn.v_proj.weight": "model.safetensors",
|
| 266 |
+
"model.layers.19.input_layernorm.weight": "model.safetensors",
|
| 267 |
+
"model.layers.19.mlp.down_proj.biases": "model.safetensors",
|
| 268 |
+
"model.layers.19.mlp.down_proj.scales": "model.safetensors",
|
| 269 |
+
"model.layers.19.mlp.down_proj.weight": "model.safetensors",
|
| 270 |
+
"model.layers.19.mlp.gate_proj.biases": "model.safetensors",
|
| 271 |
+
"model.layers.19.mlp.gate_proj.scales": "model.safetensors",
|
| 272 |
+
"model.layers.19.mlp.gate_proj.weight": "model.safetensors",
|
| 273 |
+
"model.layers.19.mlp.up_proj.biases": "model.safetensors",
|
| 274 |
+
"model.layers.19.mlp.up_proj.scales": "model.safetensors",
|
| 275 |
+
"model.layers.19.mlp.up_proj.weight": "model.safetensors",
|
| 276 |
+
"model.layers.19.post_attention_layernorm.weight": "model.safetensors",
|
| 277 |
+
"model.layers.19.self_attn.k_proj.biases": "model.safetensors",
|
| 278 |
+
"model.layers.19.self_attn.k_proj.scales": "model.safetensors",
|
| 279 |
+
"model.layers.19.self_attn.k_proj.weight": "model.safetensors",
|
| 280 |
+
"model.layers.19.self_attn.o_proj.biases": "model.safetensors",
|
| 281 |
+
"model.layers.19.self_attn.o_proj.scales": "model.safetensors",
|
| 282 |
+
"model.layers.19.self_attn.o_proj.weight": "model.safetensors",
|
| 283 |
+
"model.layers.19.self_attn.q_proj.biases": "model.safetensors",
|
| 284 |
+
"model.layers.19.self_attn.q_proj.scales": "model.safetensors",
|
| 285 |
+
"model.layers.19.self_attn.q_proj.weight": "model.safetensors",
|
| 286 |
+
"model.layers.19.self_attn.v_proj.biases": "model.safetensors",
|
| 287 |
+
"model.layers.19.self_attn.v_proj.scales": "model.safetensors",
|
| 288 |
+
"model.layers.19.self_attn.v_proj.weight": "model.safetensors",
|
| 289 |
+
"model.layers.2.input_layernorm.weight": "model.safetensors",
|
| 290 |
+
"model.layers.2.mlp.down_proj.biases": "model.safetensors",
|
| 291 |
+
"model.layers.2.mlp.down_proj.scales": "model.safetensors",
|
| 292 |
+
"model.layers.2.mlp.down_proj.weight": "model.safetensors",
|
| 293 |
+
"model.layers.2.mlp.gate_proj.biases": "model.safetensors",
|
| 294 |
+
"model.layers.2.mlp.gate_proj.scales": "model.safetensors",
|
| 295 |
+
"model.layers.2.mlp.gate_proj.weight": "model.safetensors",
|
| 296 |
+
"model.layers.2.mlp.up_proj.biases": "model.safetensors",
|
| 297 |
+
"model.layers.2.mlp.up_proj.scales": "model.safetensors",
|
| 298 |
+
"model.layers.2.mlp.up_proj.weight": "model.safetensors",
|
| 299 |
+
"model.layers.2.post_attention_layernorm.weight": "model.safetensors",
|
| 300 |
+
"model.layers.2.self_attn.k_proj.biases": "model.safetensors",
|
| 301 |
+
"model.layers.2.self_attn.k_proj.scales": "model.safetensors",
|
| 302 |
+
"model.layers.2.self_attn.k_proj.weight": "model.safetensors",
|
| 303 |
+
"model.layers.2.self_attn.o_proj.biases": "model.safetensors",
|
| 304 |
+
"model.layers.2.self_attn.o_proj.scales": "model.safetensors",
|
| 305 |
+
"model.layers.2.self_attn.o_proj.weight": "model.safetensors",
|
| 306 |
+
"model.layers.2.self_attn.q_proj.biases": "model.safetensors",
|
| 307 |
+
"model.layers.2.self_attn.q_proj.scales": "model.safetensors",
|
| 308 |
+
"model.layers.2.self_attn.q_proj.weight": "model.safetensors",
|
| 309 |
+
"model.layers.2.self_attn.v_proj.biases": "model.safetensors",
|
| 310 |
+
"model.layers.2.self_attn.v_proj.scales": "model.safetensors",
|
| 311 |
+
"model.layers.2.self_attn.v_proj.weight": "model.safetensors",
|
| 312 |
+
"model.layers.20.input_layernorm.weight": "model.safetensors",
|
| 313 |
+
"model.layers.20.mlp.down_proj.biases": "model.safetensors",
|
| 314 |
+
"model.layers.20.mlp.down_proj.scales": "model.safetensors",
|
| 315 |
+
"model.layers.20.mlp.down_proj.weight": "model.safetensors",
|
| 316 |
+
"model.layers.20.mlp.gate_proj.biases": "model.safetensors",
|
| 317 |
+
"model.layers.20.mlp.gate_proj.scales": "model.safetensors",
|
| 318 |
+
"model.layers.20.mlp.gate_proj.weight": "model.safetensors",
|
| 319 |
+
"model.layers.20.mlp.up_proj.biases": "model.safetensors",
|
| 320 |
+
"model.layers.20.mlp.up_proj.scales": "model.safetensors",
|
| 321 |
+
"model.layers.20.mlp.up_proj.weight": "model.safetensors",
|
| 322 |
+
"model.layers.20.post_attention_layernorm.weight": "model.safetensors",
|
| 323 |
+
"model.layers.20.self_attn.k_proj.biases": "model.safetensors",
|
| 324 |
+
"model.layers.20.self_attn.k_proj.scales": "model.safetensors",
|
| 325 |
+
"model.layers.20.self_attn.k_proj.weight": "model.safetensors",
|
| 326 |
+
"model.layers.20.self_attn.o_proj.biases": "model.safetensors",
|
| 327 |
+
"model.layers.20.self_attn.o_proj.scales": "model.safetensors",
|
| 328 |
+
"model.layers.20.self_attn.o_proj.weight": "model.safetensors",
|
| 329 |
+
"model.layers.20.self_attn.q_proj.biases": "model.safetensors",
|
| 330 |
+
"model.layers.20.self_attn.q_proj.scales": "model.safetensors",
|
| 331 |
+
"model.layers.20.self_attn.q_proj.weight": "model.safetensors",
|
| 332 |
+
"model.layers.20.self_attn.v_proj.biases": "model.safetensors",
|
| 333 |
+
"model.layers.20.self_attn.v_proj.scales": "model.safetensors",
|
| 334 |
+
"model.layers.20.self_attn.v_proj.weight": "model.safetensors",
|
| 335 |
+
"model.layers.21.input_layernorm.weight": "model.safetensors",
|
| 336 |
+
"model.layers.21.mlp.down_proj.biases": "model.safetensors",
|
| 337 |
+
"model.layers.21.mlp.down_proj.scales": "model.safetensors",
|
| 338 |
+
"model.layers.21.mlp.down_proj.weight": "model.safetensors",
|
| 339 |
+
"model.layers.21.mlp.gate_proj.biases": "model.safetensors",
|
| 340 |
+
"model.layers.21.mlp.gate_proj.scales": "model.safetensors",
|
| 341 |
+
"model.layers.21.mlp.gate_proj.weight": "model.safetensors",
|
| 342 |
+
"model.layers.21.mlp.up_proj.biases": "model.safetensors",
|
| 343 |
+
"model.layers.21.mlp.up_proj.scales": "model.safetensors",
|
| 344 |
+
"model.layers.21.mlp.up_proj.weight": "model.safetensors",
|
| 345 |
+
"model.layers.21.post_attention_layernorm.weight": "model.safetensors",
|
| 346 |
+
"model.layers.21.self_attn.k_proj.biases": "model.safetensors",
|
| 347 |
+
"model.layers.21.self_attn.k_proj.scales": "model.safetensors",
|
| 348 |
+
"model.layers.21.self_attn.k_proj.weight": "model.safetensors",
|
| 349 |
+
"model.layers.21.self_attn.o_proj.biases": "model.safetensors",
|
| 350 |
+
"model.layers.21.self_attn.o_proj.scales": "model.safetensors",
|
| 351 |
+
"model.layers.21.self_attn.o_proj.weight": "model.safetensors",
|
| 352 |
+
"model.layers.21.self_attn.q_proj.biases": "model.safetensors",
|
| 353 |
+
"model.layers.21.self_attn.q_proj.scales": "model.safetensors",
|
| 354 |
+
"model.layers.21.self_attn.q_proj.weight": "model.safetensors",
|
| 355 |
+
"model.layers.21.self_attn.v_proj.biases": "model.safetensors",
|
| 356 |
+
"model.layers.21.self_attn.v_proj.scales": "model.safetensors",
|
| 357 |
+
"model.layers.21.self_attn.v_proj.weight": "model.safetensors",
|
| 358 |
+
"model.layers.3.input_layernorm.weight": "model.safetensors",
|
| 359 |
+
"model.layers.3.mlp.down_proj.biases": "model.safetensors",
|
| 360 |
+
"model.layers.3.mlp.down_proj.scales": "model.safetensors",
|
| 361 |
+
"model.layers.3.mlp.down_proj.weight": "model.safetensors",
|
| 362 |
+
"model.layers.3.mlp.gate_proj.biases": "model.safetensors",
|
| 363 |
+
"model.layers.3.mlp.gate_proj.scales": "model.safetensors",
|
| 364 |
+
"model.layers.3.mlp.gate_proj.weight": "model.safetensors",
|
| 365 |
+
"model.layers.3.mlp.up_proj.biases": "model.safetensors",
|
| 366 |
+
"model.layers.3.mlp.up_proj.scales": "model.safetensors",
|
| 367 |
+
"model.layers.3.mlp.up_proj.weight": "model.safetensors",
|
| 368 |
+
"model.layers.3.post_attention_layernorm.weight": "model.safetensors",
|
| 369 |
+
"model.layers.3.self_attn.k_proj.biases": "model.safetensors",
|
| 370 |
+
"model.layers.3.self_attn.k_proj.scales": "model.safetensors",
|
| 371 |
+
"model.layers.3.self_attn.k_proj.weight": "model.safetensors",
|
| 372 |
+
"model.layers.3.self_attn.o_proj.biases": "model.safetensors",
|
| 373 |
+
"model.layers.3.self_attn.o_proj.scales": "model.safetensors",
|
| 374 |
+
"model.layers.3.self_attn.o_proj.weight": "model.safetensors",
|
| 375 |
+
"model.layers.3.self_attn.q_proj.biases": "model.safetensors",
|
| 376 |
+
"model.layers.3.self_attn.q_proj.scales": "model.safetensors",
|
| 377 |
+
"model.layers.3.self_attn.q_proj.weight": "model.safetensors",
|
| 378 |
+
"model.layers.3.self_attn.v_proj.biases": "model.safetensors",
|
| 379 |
+
"model.layers.3.self_attn.v_proj.scales": "model.safetensors",
|
| 380 |
+
"model.layers.3.self_attn.v_proj.weight": "model.safetensors",
|
| 381 |
+
"model.layers.4.input_layernorm.weight": "model.safetensors",
|
| 382 |
+
"model.layers.4.mlp.down_proj.biases": "model.safetensors",
|
| 383 |
+
"model.layers.4.mlp.down_proj.scales": "model.safetensors",
|
| 384 |
+
"model.layers.4.mlp.down_proj.weight": "model.safetensors",
|
| 385 |
+
"model.layers.4.mlp.gate_proj.biases": "model.safetensors",
|
| 386 |
+
"model.layers.4.mlp.gate_proj.scales": "model.safetensors",
|
| 387 |
+
"model.layers.4.mlp.gate_proj.weight": "model.safetensors",
|
| 388 |
+
"model.layers.4.mlp.up_proj.biases": "model.safetensors",
|
| 389 |
+
"model.layers.4.mlp.up_proj.scales": "model.safetensors",
|
| 390 |
+
"model.layers.4.mlp.up_proj.weight": "model.safetensors",
|
| 391 |
+
"model.layers.4.post_attention_layernorm.weight": "model.safetensors",
|
| 392 |
+
"model.layers.4.self_attn.k_proj.biases": "model.safetensors",
|
| 393 |
+
"model.layers.4.self_attn.k_proj.scales": "model.safetensors",
|
| 394 |
+
"model.layers.4.self_attn.k_proj.weight": "model.safetensors",
|
| 395 |
+
"model.layers.4.self_attn.o_proj.biases": "model.safetensors",
|
| 396 |
+
"model.layers.4.self_attn.o_proj.scales": "model.safetensors",
|
| 397 |
+
"model.layers.4.self_attn.o_proj.weight": "model.safetensors",
|
| 398 |
+
"model.layers.4.self_attn.q_proj.biases": "model.safetensors",
|
| 399 |
+
"model.layers.4.self_attn.q_proj.scales": "model.safetensors",
|
| 400 |
+
"model.layers.4.self_attn.q_proj.weight": "model.safetensors",
|
| 401 |
+
"model.layers.4.self_attn.v_proj.biases": "model.safetensors",
|
| 402 |
+
"model.layers.4.self_attn.v_proj.scales": "model.safetensors",
|
| 403 |
+
"model.layers.4.self_attn.v_proj.weight": "model.safetensors",
|
| 404 |
+
"model.layers.5.input_layernorm.weight": "model.safetensors",
|
| 405 |
+
"model.layers.5.mlp.down_proj.biases": "model.safetensors",
|
| 406 |
+
"model.layers.5.mlp.down_proj.scales": "model.safetensors",
|
| 407 |
+
"model.layers.5.mlp.down_proj.weight": "model.safetensors",
|
| 408 |
+
"model.layers.5.mlp.gate_proj.biases": "model.safetensors",
|
| 409 |
+
"model.layers.5.mlp.gate_proj.scales": "model.safetensors",
|
| 410 |
+
"model.layers.5.mlp.gate_proj.weight": "model.safetensors",
|
| 411 |
+
"model.layers.5.mlp.up_proj.biases": "model.safetensors",
|
| 412 |
+
"model.layers.5.mlp.up_proj.scales": "model.safetensors",
|
| 413 |
+
"model.layers.5.mlp.up_proj.weight": "model.safetensors",
|
| 414 |
+
"model.layers.5.post_attention_layernorm.weight": "model.safetensors",
|
| 415 |
+
"model.layers.5.self_attn.k_proj.biases": "model.safetensors",
|
| 416 |
+
"model.layers.5.self_attn.k_proj.scales": "model.safetensors",
|
| 417 |
+
"model.layers.5.self_attn.k_proj.weight": "model.safetensors",
|
| 418 |
+
"model.layers.5.self_attn.o_proj.biases": "model.safetensors",
|
| 419 |
+
"model.layers.5.self_attn.o_proj.scales": "model.safetensors",
|
| 420 |
+
"model.layers.5.self_attn.o_proj.weight": "model.safetensors",
|
| 421 |
+
"model.layers.5.self_attn.q_proj.biases": "model.safetensors",
|
| 422 |
+
"model.layers.5.self_attn.q_proj.scales": "model.safetensors",
|
| 423 |
+
"model.layers.5.self_attn.q_proj.weight": "model.safetensors",
|
| 424 |
+
"model.layers.5.self_attn.v_proj.biases": "model.safetensors",
|
| 425 |
+
"model.layers.5.self_attn.v_proj.scales": "model.safetensors",
|
| 426 |
+
"model.layers.5.self_attn.v_proj.weight": "model.safetensors",
|
| 427 |
+
"model.layers.6.input_layernorm.weight": "model.safetensors",
|
| 428 |
+
"model.layers.6.mlp.down_proj.biases": "model.safetensors",
|
| 429 |
+
"model.layers.6.mlp.down_proj.scales": "model.safetensors",
|
| 430 |
+
"model.layers.6.mlp.down_proj.weight": "model.safetensors",
|
| 431 |
+
"model.layers.6.mlp.gate_proj.biases": "model.safetensors",
|
| 432 |
+
"model.layers.6.mlp.gate_proj.scales": "model.safetensors",
|
| 433 |
+
"model.layers.6.mlp.gate_proj.weight": "model.safetensors",
|
| 434 |
+
"model.layers.6.mlp.up_proj.biases": "model.safetensors",
|
| 435 |
+
"model.layers.6.mlp.up_proj.scales": "model.safetensors",
|
| 436 |
+
"model.layers.6.mlp.up_proj.weight": "model.safetensors",
|
| 437 |
+
"model.layers.6.post_attention_layernorm.weight": "model.safetensors",
|
| 438 |
+
"model.layers.6.self_attn.k_proj.biases": "model.safetensors",
|
| 439 |
+
"model.layers.6.self_attn.k_proj.scales": "model.safetensors",
|
| 440 |
+
"model.layers.6.self_attn.k_proj.weight": "model.safetensors",
|
| 441 |
+
"model.layers.6.self_attn.o_proj.biases": "model.safetensors",
|
| 442 |
+
"model.layers.6.self_attn.o_proj.scales": "model.safetensors",
|
| 443 |
+
"model.layers.6.self_attn.o_proj.weight": "model.safetensors",
|
| 444 |
+
"model.layers.6.self_attn.q_proj.biases": "model.safetensors",
|
| 445 |
+
"model.layers.6.self_attn.q_proj.scales": "model.safetensors",
|
| 446 |
+
"model.layers.6.self_attn.q_proj.weight": "model.safetensors",
|
| 447 |
+
"model.layers.6.self_attn.v_proj.biases": "model.safetensors",
|
| 448 |
+
"model.layers.6.self_attn.v_proj.scales": "model.safetensors",
|
| 449 |
+
"model.layers.6.self_attn.v_proj.weight": "model.safetensors",
|
| 450 |
+
"model.layers.7.input_layernorm.weight": "model.safetensors",
|
| 451 |
+
"model.layers.7.mlp.down_proj.biases": "model.safetensors",
|
| 452 |
+
"model.layers.7.mlp.down_proj.scales": "model.safetensors",
|
| 453 |
+
"model.layers.7.mlp.down_proj.weight": "model.safetensors",
|
| 454 |
+
"model.layers.7.mlp.gate_proj.biases": "model.safetensors",
|
| 455 |
+
"model.layers.7.mlp.gate_proj.scales": "model.safetensors",
|
| 456 |
+
"model.layers.7.mlp.gate_proj.weight": "model.safetensors",
|
| 457 |
+
"model.layers.7.mlp.up_proj.biases": "model.safetensors",
|
| 458 |
+
"model.layers.7.mlp.up_proj.scales": "model.safetensors",
|
| 459 |
+
"model.layers.7.mlp.up_proj.weight": "model.safetensors",
|
| 460 |
+
"model.layers.7.post_attention_layernorm.weight": "model.safetensors",
|
| 461 |
+
"model.layers.7.self_attn.k_proj.biases": "model.safetensors",
|
| 462 |
+
"model.layers.7.self_attn.k_proj.scales": "model.safetensors",
|
| 463 |
+
"model.layers.7.self_attn.k_proj.weight": "model.safetensors",
|
| 464 |
+
"model.layers.7.self_attn.o_proj.biases": "model.safetensors",
|
| 465 |
+
"model.layers.7.self_attn.o_proj.scales": "model.safetensors",
|
| 466 |
+
"model.layers.7.self_attn.o_proj.weight": "model.safetensors",
|
| 467 |
+
"model.layers.7.self_attn.q_proj.biases": "model.safetensors",
|
| 468 |
+
"model.layers.7.self_attn.q_proj.scales": "model.safetensors",
|
| 469 |
+
"model.layers.7.self_attn.q_proj.weight": "model.safetensors",
|
| 470 |
+
"model.layers.7.self_attn.v_proj.biases": "model.safetensors",
|
| 471 |
+
"model.layers.7.self_attn.v_proj.scales": "model.safetensors",
|
| 472 |
+
"model.layers.7.self_attn.v_proj.weight": "model.safetensors",
|
| 473 |
+
"model.layers.8.input_layernorm.weight": "model.safetensors",
|
| 474 |
+
"model.layers.8.mlp.down_proj.biases": "model.safetensors",
|
| 475 |
+
"model.layers.8.mlp.down_proj.scales": "model.safetensors",
|
| 476 |
+
"model.layers.8.mlp.down_proj.weight": "model.safetensors",
|
| 477 |
+
"model.layers.8.mlp.gate_proj.biases": "model.safetensors",
|
| 478 |
+
"model.layers.8.mlp.gate_proj.scales": "model.safetensors",
|
| 479 |
+
"model.layers.8.mlp.gate_proj.weight": "model.safetensors",
|
| 480 |
+
"model.layers.8.mlp.up_proj.biases": "model.safetensors",
|
| 481 |
+
"model.layers.8.mlp.up_proj.scales": "model.safetensors",
|
| 482 |
+
"model.layers.8.mlp.up_proj.weight": "model.safetensors",
|
| 483 |
+
"model.layers.8.post_attention_layernorm.weight": "model.safetensors",
|
| 484 |
+
"model.layers.8.self_attn.k_proj.biases": "model.safetensors",
|
| 485 |
+
"model.layers.8.self_attn.k_proj.scales": "model.safetensors",
|
| 486 |
+
"model.layers.8.self_attn.k_proj.weight": "model.safetensors",
|
| 487 |
+
"model.layers.8.self_attn.o_proj.biases": "model.safetensors",
|
| 488 |
+
"model.layers.8.self_attn.o_proj.scales": "model.safetensors",
|
| 489 |
+
"model.layers.8.self_attn.o_proj.weight": "model.safetensors",
|
| 490 |
+
"model.layers.8.self_attn.q_proj.biases": "model.safetensors",
|
| 491 |
+
"model.layers.8.self_attn.q_proj.scales": "model.safetensors",
|
| 492 |
+
"model.layers.8.self_attn.q_proj.weight": "model.safetensors",
|
| 493 |
+
"model.layers.8.self_attn.v_proj.biases": "model.safetensors",
|
| 494 |
+
"model.layers.8.self_attn.v_proj.scales": "model.safetensors",
|
| 495 |
+
"model.layers.8.self_attn.v_proj.weight": "model.safetensors",
|
| 496 |
+
"model.layers.9.input_layernorm.weight": "model.safetensors",
|
| 497 |
+
"model.layers.9.mlp.down_proj.biases": "model.safetensors",
|
| 498 |
+
"model.layers.9.mlp.down_proj.scales": "model.safetensors",
|
| 499 |
+
"model.layers.9.mlp.down_proj.weight": "model.safetensors",
|
| 500 |
+
"model.layers.9.mlp.gate_proj.biases": "model.safetensors",
|
| 501 |
+
"model.layers.9.mlp.gate_proj.scales": "model.safetensors",
|
| 502 |
+
"model.layers.9.mlp.gate_proj.weight": "model.safetensors",
|
| 503 |
+
"model.layers.9.mlp.up_proj.biases": "model.safetensors",
|
| 504 |
+
"model.layers.9.mlp.up_proj.scales": "model.safetensors",
|
| 505 |
+
"model.layers.9.mlp.up_proj.weight": "model.safetensors",
|
| 506 |
+
"model.layers.9.post_attention_layernorm.weight": "model.safetensors",
|
| 507 |
+
"model.layers.9.self_attn.k_proj.biases": "model.safetensors",
|
| 508 |
+
"model.layers.9.self_attn.k_proj.scales": "model.safetensors",
|
| 509 |
+
"model.layers.9.self_attn.k_proj.weight": "model.safetensors",
|
| 510 |
+
"model.layers.9.self_attn.o_proj.biases": "model.safetensors",
|
| 511 |
+
"model.layers.9.self_attn.o_proj.scales": "model.safetensors",
|
| 512 |
+
"model.layers.9.self_attn.o_proj.weight": "model.safetensors",
|
| 513 |
+
"model.layers.9.self_attn.q_proj.biases": "model.safetensors",
|
| 514 |
+
"model.layers.9.self_attn.q_proj.scales": "model.safetensors",
|
| 515 |
+
"model.layers.9.self_attn.q_proj.weight": "model.safetensors",
|
| 516 |
+
"model.layers.9.self_attn.v_proj.biases": "model.safetensors",
|
| 517 |
+
"model.layers.9.self_attn.v_proj.scales": "model.safetensors",
|
| 518 |
+
"model.layers.9.self_attn.v_proj.weight": "model.safetensors",
|
| 519 |
+
"model.norm.weight": "model.safetensors"
|
| 520 |
+
}
|
| 521 |
+
}
|
nanbeige.py
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
# Copyright © 2024 Apple Inc.
|
| 2 |
+
# mlx-lm architecture module for Nanbeige4.2 (looped / recurrent-depth transformer).
|
| 3 |
+
#
|
| 4 |
+
# Nanbeige4.2 is Llama-style (GQA attention, SwiGLU MLP, RMSNorm, rotary embeddings)
|
| 5 |
+
# with one twist: the full decoder stack is executed `num_loops` times. Each loop pass
|
| 6 |
+
# keeps its own KV-cache slice, and (when skip_loop_final_norm is False) the final
|
| 7 |
+
# RMSNorm is applied at the end of every loop pass — the normalized output of one loop
|
| 8 |
+
# feeds the next loop as input.
|
| 9 |
+
|
| 10 |
+
from dataclasses import dataclass
|
| 11 |
+
from typing import Any, Dict, Optional, Union
|
| 12 |
+
|
| 13 |
+
import mlx.core as mx
|
| 14 |
+
import mlx.nn as nn
|
| 15 |
+
|
| 16 |
+
from .base import BaseModelArgs, create_attention_mask, scaled_dot_product_attention
|
| 17 |
+
from .cache import KVCache
|
| 18 |
+
from .rope_utils import initialize_rope
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
@dataclass
|
| 22 |
+
class ModelArgs(BaseModelArgs):
|
| 23 |
+
model_type: str
|
| 24 |
+
hidden_size: int
|
| 25 |
+
num_hidden_layers: int
|
| 26 |
+
intermediate_size: int
|
| 27 |
+
num_attention_heads: int
|
| 28 |
+
rms_norm_eps: float
|
| 29 |
+
vocab_size: int
|
| 30 |
+
head_dim: Optional[int] = None
|
| 31 |
+
max_position_embeddings: Optional[int] = None
|
| 32 |
+
num_key_value_heads: Optional[int] = None
|
| 33 |
+
attention_bias: bool = False
|
| 34 |
+
mlp_bias: bool = False
|
| 35 |
+
rope_theta: float = 10000.0
|
| 36 |
+
rope_traditional: bool = False
|
| 37 |
+
rope_scaling: Optional[Dict[str, Union[float, str]]] = None
|
| 38 |
+
tie_word_embeddings: bool = False
|
| 39 |
+
num_loops: int = 1
|
| 40 |
+
skip_loop_final_norm: bool = False
|
| 41 |
+
|
| 42 |
+
def __post_init__(self):
|
| 43 |
+
if self.num_key_value_heads is None:
|
| 44 |
+
self.num_key_value_heads = self.num_attention_heads
|
| 45 |
+
if self.num_loops < 1:
|
| 46 |
+
self.num_loops = 1
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
class Attention(nn.Module):
|
| 50 |
+
def __init__(self, args: ModelArgs):
|
| 51 |
+
super().__init__()
|
| 52 |
+
dim = args.hidden_size
|
| 53 |
+
self.n_heads = args.num_attention_heads
|
| 54 |
+
self.n_kv_heads = args.num_key_value_heads
|
| 55 |
+
self.head_dim = head_dim = args.head_dim or (dim // self.n_heads)
|
| 56 |
+
self.scale = head_dim**-0.5
|
| 57 |
+
|
| 58 |
+
self.q_proj = nn.Linear(dim, self.n_heads * head_dim, bias=args.attention_bias)
|
| 59 |
+
self.k_proj = nn.Linear(dim, self.n_kv_heads * head_dim, bias=args.attention_bias)
|
| 60 |
+
self.v_proj = nn.Linear(dim, self.n_kv_heads * head_dim, bias=args.attention_bias)
|
| 61 |
+
self.o_proj = nn.Linear(self.n_heads * head_dim, dim, bias=args.attention_bias)
|
| 62 |
+
|
| 63 |
+
self.rope = initialize_rope(
|
| 64 |
+
self.head_dim,
|
| 65 |
+
args.rope_theta,
|
| 66 |
+
args.rope_traditional,
|
| 67 |
+
args.rope_scaling,
|
| 68 |
+
args.max_position_embeddings,
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
def __call__(self, x: mx.array, mask=None, cache=None) -> mx.array:
|
| 72 |
+
B, L, D = x.shape
|
| 73 |
+
|
| 74 |
+
queries, keys, values = self.q_proj(x), self.k_proj(x), self.v_proj(x)
|
| 75 |
+
queries = queries.reshape(B, L, self.n_heads, -1).transpose(0, 2, 1, 3)
|
| 76 |
+
keys = keys.reshape(B, L, self.n_kv_heads, -1).transpose(0, 2, 1, 3)
|
| 77 |
+
values = values.reshape(B, L, self.n_kv_heads, -1).transpose(0, 2, 1, 3)
|
| 78 |
+
|
| 79 |
+
if cache is not None:
|
| 80 |
+
queries = self.rope(queries, offset=cache.offset)
|
| 81 |
+
keys = self.rope(keys, offset=cache.offset)
|
| 82 |
+
keys, values = cache.update_and_fetch(keys, values)
|
| 83 |
+
else:
|
| 84 |
+
queries = self.rope(queries)
|
| 85 |
+
keys = self.rope(keys)
|
| 86 |
+
|
| 87 |
+
output = scaled_dot_product_attention(
|
| 88 |
+
queries, keys, values, cache=cache, scale=self.scale, mask=mask
|
| 89 |
+
)
|
| 90 |
+
output = output.transpose(0, 2, 1, 3).reshape(B, L, -1)
|
| 91 |
+
return self.o_proj(output)
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
class MLP(nn.Module):
|
| 95 |
+
def __init__(self, args: ModelArgs):
|
| 96 |
+
super().__init__()
|
| 97 |
+
dim, hidden = args.hidden_size, args.intermediate_size
|
| 98 |
+
self.gate_proj = nn.Linear(dim, hidden, bias=args.mlp_bias)
|
| 99 |
+
self.down_proj = nn.Linear(hidden, dim, bias=args.mlp_bias)
|
| 100 |
+
self.up_proj = nn.Linear(dim, hidden, bias=args.mlp_bias)
|
| 101 |
+
|
| 102 |
+
def __call__(self, x) -> mx.array:
|
| 103 |
+
return self.down_proj(nn.silu(self.gate_proj(x)) * self.up_proj(x))
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
class TransformerBlock(nn.Module):
|
| 107 |
+
def __init__(self, args: ModelArgs):
|
| 108 |
+
super().__init__()
|
| 109 |
+
self.self_attn = Attention(args)
|
| 110 |
+
self.mlp = MLP(args)
|
| 111 |
+
self.input_layernorm = nn.RMSNorm(args.hidden_size, eps=args.rms_norm_eps)
|
| 112 |
+
self.post_attention_layernorm = nn.RMSNorm(
|
| 113 |
+
args.hidden_size, eps=args.rms_norm_eps
|
| 114 |
+
)
|
| 115 |
+
|
| 116 |
+
def __call__(self, x: mx.array, mask=None, cache=None) -> mx.array:
|
| 117 |
+
r = self.self_attn(self.input_layernorm(x), mask, cache)
|
| 118 |
+
h = x + r
|
| 119 |
+
r = self.mlp(self.post_attention_layernorm(h))
|
| 120 |
+
return h + r
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
class NanbeigeModel(nn.Module):
|
| 124 |
+
def __init__(self, args: ModelArgs):
|
| 125 |
+
super().__init__()
|
| 126 |
+
self.args = args
|
| 127 |
+
self.num_hidden_layers = args.num_hidden_layers
|
| 128 |
+
self.num_loops = args.num_loops
|
| 129 |
+
self.skip_loop_final_norm = args.skip_loop_final_norm
|
| 130 |
+
assert args.vocab_size > 0
|
| 131 |
+
self.embed_tokens = nn.Embedding(args.vocab_size, args.hidden_size)
|
| 132 |
+
self.layers = [TransformerBlock(args) for _ in range(args.num_hidden_layers)]
|
| 133 |
+
self.norm = nn.RMSNorm(args.hidden_size, eps=args.rms_norm_eps)
|
| 134 |
+
|
| 135 |
+
def __call__(self, inputs: mx.array, cache=None, input_embeddings=None):
|
| 136 |
+
if input_embeddings is not None:
|
| 137 |
+
h = input_embeddings
|
| 138 |
+
else:
|
| 139 |
+
h = self.embed_tokens(inputs)
|
| 140 |
+
|
| 141 |
+
n = self.num_hidden_layers
|
| 142 |
+
if cache is None:
|
| 143 |
+
cache = [None] * (n * self.num_loops)
|
| 144 |
+
|
| 145 |
+
# Each loop pass replays the whole stack against its own cache slice.
|
| 146 |
+
for loop_idx in range(self.num_loops):
|
| 147 |
+
loop_cache = cache[loop_idx * n : (loop_idx + 1) * n]
|
| 148 |
+
mask = create_attention_mask(h, loop_cache[0])
|
| 149 |
+
for layer, c in zip(self.layers, loop_cache):
|
| 150 |
+
h = layer(h, mask, cache=c)
|
| 151 |
+
if not self.skip_loop_final_norm:
|
| 152 |
+
h = self.norm(h)
|
| 153 |
+
|
| 154 |
+
if self.skip_loop_final_norm:
|
| 155 |
+
h = self.norm(h)
|
| 156 |
+
return h
|
| 157 |
+
|
| 158 |
+
|
| 159 |
+
class Model(nn.Module):
|
| 160 |
+
def __init__(self, args: ModelArgs):
|
| 161 |
+
super().__init__()
|
| 162 |
+
self.args = args
|
| 163 |
+
self.model_type = args.model_type
|
| 164 |
+
self.model = NanbeigeModel(args)
|
| 165 |
+
if not args.tie_word_embeddings:
|
| 166 |
+
self.lm_head = nn.Linear(args.hidden_size, args.vocab_size, bias=False)
|
| 167 |
+
|
| 168 |
+
def __call__(self, inputs: mx.array, cache=None, input_embeddings=None):
|
| 169 |
+
out = self.model(inputs, cache, input_embeddings)
|
| 170 |
+
if self.args.tie_word_embeddings:
|
| 171 |
+
out = self.model.embed_tokens.as_linear(out)
|
| 172 |
+
else:
|
| 173 |
+
out = self.lm_head(out)
|
| 174 |
+
return out
|
| 175 |
+
|
| 176 |
+
def sanitize(self, weights):
|
| 177 |
+
# Drop non-persistent rotary buffers if present in a checkpoint.
|
| 178 |
+
weights = {
|
| 179 |
+
k: v
|
| 180 |
+
for k, v in weights.items()
|
| 181 |
+
if "rotary_emb.inv_freq" not in k and ".rope." not in k
|
| 182 |
+
}
|
| 183 |
+
if self.args.tie_word_embeddings:
|
| 184 |
+
weights.pop("lm_head.weight", None)
|
| 185 |
+
return weights
|
| 186 |
+
|
| 187 |
+
@property
|
| 188 |
+
def layers(self):
|
| 189 |
+
return self.model.layers
|
| 190 |
+
|
| 191 |
+
def make_cache(self):
|
| 192 |
+
# One KV cache per (loop, layer): the stack is executed num_loops times
|
| 193 |
+
# and each pass must not see the other passes' keys/values.
|
| 194 |
+
return [
|
| 195 |
+
KVCache()
|
| 196 |
+
for _ in range(self.args.num_hidden_layers * self.args.num_loops)
|
| 197 |
+
]
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a002676e923776f5a59d21320d667920e732000f7762fb72e6be6e911790e060
|
| 3 |
+
size 18450976
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": true,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<|im_start|>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|im_end|>",
|
| 7 |
+
"is_local": true,
|
| 8 |
+
"local_files_only": false,
|
| 9 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 10 |
+
"pad_token": "<unk>",
|
| 11 |
+
"sp_model_kwargs": {},
|
| 12 |
+
"spaces_between_special_tokens": false,
|
| 13 |
+
"tokenizer_class": "LlamaTokenizer",
|
| 14 |
+
"tool_parser_type": "qwen3_coder",
|
| 15 |
+
"unk_token": "<unk>",
|
| 16 |
+
"use_default_system_prompt": false
|
| 17 |
+
}
|