Upload optimized Gemma4 checkpoint
Browse files- .gitattributes +1 -0
- README.md +19 -0
- __init__.py +2 -0
- chat_template.jinja +347 -0
- config.json +89 -0
- configuration_gemma4.py +383 -0
- export_summary.json +348 -0
- gemma4_optimization.py +203 -0
- generation_config.json +10 -0
- model-00001-of-00011.safetensors +3 -0
- model-00002-of-00011.safetensors +3 -0
- model-00003-of-00011.safetensors +3 -0
- model-00004-of-00011.safetensors +3 -0
- model-00005-of-00011.safetensors +3 -0
- model-00006-of-00011.safetensors +3 -0
- model-00007-of-00011.safetensors +3 -0
- model-00008-of-00011.safetensors +3 -0
- model-00009-of-00011.safetensors +3 -0
- model-00010-of-00011.safetensors +3 -0
- model-00011-of-00011.safetensors +3 -0
- model.safetensors.index.json +666 -0
- modeling_gemma4.py +0 -0
- tokenizer.json +3 -0
- tokenizer_config.json +95 -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,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# gemma4-zero-compute
|
| 2 |
+
|
| 3 |
+
Optimized Gemma4 text-only checkpoint exported from this repository.
|
| 4 |
+
|
| 5 |
+
## Loading
|
| 6 |
+
|
| 7 |
+
```python
|
| 8 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 9 |
+
|
| 10 |
+
tokenizer = AutoTokenizer.from_pretrained("haysonC/gemma4-zero-compute", trust_remote_code=True)
|
| 11 |
+
model = AutoModelForCausalLM.from_pretrained("haysonC/gemma4-zero-compute", trust_remote_code=True)
|
| 12 |
+
```
|
| 13 |
+
|
| 14 |
+
## Notes
|
| 15 |
+
|
| 16 |
+
- Base model: `google/gemma-4-26B-A4B-it`
|
| 17 |
+
- Architecture: `OptimizedGemma4ForCausalLM`
|
| 18 |
+
- Scope: text-only causal language model export
|
| 19 |
+
- Router checkpoint loaded: `True`
|
__init__.py
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from .configuration_gemma4 import Gemma4TextConfig
|
| 2 |
+
from .gemma4_optimization import OptimizedGemma4ForCausalLM
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- macro format_parameters(properties, required) -%}
|
| 2 |
+
{%- set standard_keys = ['description', 'type', 'properties', 'required', 'nullable'] -%}
|
| 3 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 4 |
+
{%- for key, value in properties | dictsort -%}
|
| 5 |
+
{%- set add_comma = false -%}
|
| 6 |
+
{%- if key not in standard_keys -%}
|
| 7 |
+
{%- if ns.found_first %},{% endif -%}
|
| 8 |
+
{%- set ns.found_first = true -%}
|
| 9 |
+
{{ key }}:{
|
| 10 |
+
{%- if value['description'] -%}
|
| 11 |
+
description:<|"|>{{ value['description'] }}<|"|>
|
| 12 |
+
{%- set add_comma = true -%}
|
| 13 |
+
{%- endif -%}
|
| 14 |
+
{%- if value['type'] | upper == 'STRING' -%}
|
| 15 |
+
{%- if value['enum'] -%}
|
| 16 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 17 |
+
enum:{{ format_argument(value['enum']) }}
|
| 18 |
+
{%- endif -%}
|
| 19 |
+
{%- elif value['type'] | upper == 'ARRAY' -%}
|
| 20 |
+
{%- if value['items'] is mapping and value['items'] -%}
|
| 21 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 22 |
+
items:{
|
| 23 |
+
{%- set ns_items = namespace(found_first=false) -%}
|
| 24 |
+
{%- for item_key, item_value in value['items'] | dictsort -%}
|
| 25 |
+
{%- if item_value is not none -%}
|
| 26 |
+
{%- if ns_items.found_first %},{% endif -%}
|
| 27 |
+
{%- set ns_items.found_first = true -%}
|
| 28 |
+
{%- if item_key == 'properties' -%}
|
| 29 |
+
properties:{
|
| 30 |
+
{%- if item_value is mapping -%}
|
| 31 |
+
{{- format_parameters(item_value, value['items']['required'] | default([])) -}}
|
| 32 |
+
{%- endif -%}
|
| 33 |
+
}
|
| 34 |
+
{%- elif item_key == 'required' -%}
|
| 35 |
+
required:[
|
| 36 |
+
{%- for req_item in item_value -%}
|
| 37 |
+
<|"|>{{- req_item -}}<|"|>
|
| 38 |
+
{%- if not loop.last %},{% endif -%}
|
| 39 |
+
{%- endfor -%}
|
| 40 |
+
]
|
| 41 |
+
{%- elif item_key == 'type' -%}
|
| 42 |
+
{%- if item_value is string -%}
|
| 43 |
+
type:{{ format_argument(item_value | upper) }}
|
| 44 |
+
{%- else -%}
|
| 45 |
+
type:{{ format_argument(item_value | map('upper') | list) }}
|
| 46 |
+
{%- endif -%}
|
| 47 |
+
{%- else -%}
|
| 48 |
+
{{ item_key }}:{{ format_argument(item_value) }}
|
| 49 |
+
{%- endif -%}
|
| 50 |
+
{%- endif -%}
|
| 51 |
+
{%- endfor -%}
|
| 52 |
+
}
|
| 53 |
+
{%- endif -%}
|
| 54 |
+
{%- endif -%}
|
| 55 |
+
{%- if value['nullable'] %}
|
| 56 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 57 |
+
nullable:true
|
| 58 |
+
{%- endif -%}
|
| 59 |
+
{%- if value['type'] | upper == 'OBJECT' -%}
|
| 60 |
+
{%- if value['properties'] is defined and value['properties'] is mapping -%}
|
| 61 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 62 |
+
properties:{
|
| 63 |
+
{{- format_parameters(value['properties'], value['required'] | default([])) -}}
|
| 64 |
+
}
|
| 65 |
+
{%- elif value is mapping -%}
|
| 66 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 67 |
+
properties:{
|
| 68 |
+
{{- format_parameters(value, value['required'] | default([])) -}}
|
| 69 |
+
}
|
| 70 |
+
{%- endif -%}
|
| 71 |
+
{%- if value['required'] -%}
|
| 72 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 73 |
+
required:[
|
| 74 |
+
{%- for item in value['required'] | default([]) -%}
|
| 75 |
+
<|"|>{{- item -}}<|"|>
|
| 76 |
+
{%- if not loop.last %},{% endif -%}
|
| 77 |
+
{%- endfor -%}
|
| 78 |
+
]
|
| 79 |
+
{%- endif -%}
|
| 80 |
+
{%- endif -%}
|
| 81 |
+
{%- if add_comma %},{%- else -%} {%- set add_comma = true -%} {% endif -%}
|
| 82 |
+
type:<|"|>{{ value['type'] | upper }}<|"|>}
|
| 83 |
+
{%- endif -%}
|
| 84 |
+
{%- endfor -%}
|
| 85 |
+
{%- endmacro -%}
|
| 86 |
+
{%- macro format_function_declaration(tool_data) -%}
|
| 87 |
+
declaration:{{- tool_data['function']['name'] -}}{description:<|"|>{{- tool_data['function']['description'] -}}<|"|>
|
| 88 |
+
{%- set params = tool_data['function']['parameters'] -%}
|
| 89 |
+
{%- if params -%}
|
| 90 |
+
,parameters:{
|
| 91 |
+
{%- if params['properties'] -%}
|
| 92 |
+
properties:{ {{- format_parameters(params['properties'], params['required']) -}} },
|
| 93 |
+
{%- endif -%}
|
| 94 |
+
{%- if params['required'] -%}
|
| 95 |
+
required:[
|
| 96 |
+
{%- for item in params['required'] -%}
|
| 97 |
+
<|"|>{{- item -}}<|"|>
|
| 98 |
+
{{- ',' if not loop.last -}}
|
| 99 |
+
{%- endfor -%}
|
| 100 |
+
],
|
| 101 |
+
{%- endif -%}
|
| 102 |
+
{%- if params['type'] -%}
|
| 103 |
+
type:<|"|>{{- params['type'] | upper -}}<|"|>}
|
| 104 |
+
{%- endif -%}
|
| 105 |
+
{%- endif -%}
|
| 106 |
+
{%- if 'response' in tool_data['function'] -%}
|
| 107 |
+
{%- set response_declaration = tool_data['function']['response'] -%}
|
| 108 |
+
,response:{
|
| 109 |
+
{%- if response_declaration['description'] -%}
|
| 110 |
+
description:<|"|>{{- response_declaration['description'] -}}<|"|>,
|
| 111 |
+
{%- endif -%}
|
| 112 |
+
{%- if response_declaration['type'] | upper == 'OBJECT' -%}
|
| 113 |
+
type:<|"|>{{- response_declaration['type'] | upper -}}<|"|>}
|
| 114 |
+
{%- endif -%}
|
| 115 |
+
{%- endif -%}
|
| 116 |
+
}
|
| 117 |
+
{%- endmacro -%}
|
| 118 |
+
{%- macro format_argument(argument, escape_keys=True) -%}
|
| 119 |
+
{%- if argument is string -%}
|
| 120 |
+
{{- '<|"|>' + argument + '<|"|>' -}}
|
| 121 |
+
{%- elif argument is boolean -%}
|
| 122 |
+
{{- 'true' if argument else 'false' -}}
|
| 123 |
+
{%- elif argument is mapping -%}
|
| 124 |
+
{{- '{' -}}
|
| 125 |
+
{%- set ns = namespace(found_first=false) -%}
|
| 126 |
+
{%- for key, value in argument | dictsort -%}
|
| 127 |
+
{%- if ns.found_first %},{% endif -%}
|
| 128 |
+
{%- set ns.found_first = true -%}
|
| 129 |
+
{%- if escape_keys -%}
|
| 130 |
+
{{- '<|"|>' + key + '<|"|>' -}}
|
| 131 |
+
{%- else -%}
|
| 132 |
+
{{- key -}}
|
| 133 |
+
{%- endif -%}
|
| 134 |
+
:{{- format_argument(value, escape_keys=escape_keys) -}}
|
| 135 |
+
{%- endfor -%}
|
| 136 |
+
{{- '}' -}}
|
| 137 |
+
{%- elif argument is sequence -%}
|
| 138 |
+
{{- '[' -}}
|
| 139 |
+
{%- for item in argument -%}
|
| 140 |
+
{{- format_argument(item, escape_keys=escape_keys) -}}
|
| 141 |
+
{%- if not loop.last %},{% endif -%}
|
| 142 |
+
{%- endfor -%}
|
| 143 |
+
{{- ']' -}}
|
| 144 |
+
{%- else -%}
|
| 145 |
+
{{- argument -}}
|
| 146 |
+
{%- endif -%}
|
| 147 |
+
{%- endmacro -%}
|
| 148 |
+
{%- macro strip_thinking(text) -%}
|
| 149 |
+
{%- set ns = namespace(result='') -%}
|
| 150 |
+
{%- for part in text.split('<channel|>') -%}
|
| 151 |
+
{%- if '<|channel>' in part -%}
|
| 152 |
+
{%- set ns.result = ns.result + part.split('<|channel>')[0] -%}
|
| 153 |
+
{%- else -%}
|
| 154 |
+
{%- set ns.result = ns.result + part -%}
|
| 155 |
+
{%- endif -%}
|
| 156 |
+
{%- endfor -%}
|
| 157 |
+
{{- ns.result | trim -}}
|
| 158 |
+
{%- endmacro -%}
|
| 159 |
+
|
| 160 |
+
{%- macro format_tool_response_block(tool_name, response) -%}
|
| 161 |
+
{{- '<|tool_response>' -}}
|
| 162 |
+
{%- if response is mapping -%}
|
| 163 |
+
{{- 'response:' + tool_name + '{' -}}
|
| 164 |
+
{%- for key, value in response | dictsort -%}
|
| 165 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 166 |
+
{%- if not loop.last %},{% endif -%}
|
| 167 |
+
{%- endfor -%}
|
| 168 |
+
{{- '}' -}}
|
| 169 |
+
{%- else -%}
|
| 170 |
+
{{- 'response:' + tool_name + '{value:' + format_argument(response, escape_keys=False) + '}' -}}
|
| 171 |
+
{%- endif -%}
|
| 172 |
+
{{- '<tool_response|>' -}}
|
| 173 |
+
{%- endmacro -%}
|
| 174 |
+
|
| 175 |
+
{%- set ns = namespace(prev_message_type=None) -%}
|
| 176 |
+
{%- set loop_messages = messages -%}
|
| 177 |
+
{{- bos_token -}}
|
| 178 |
+
{#- Handle System/Tool Definitions Block -#}
|
| 179 |
+
{%- if (enable_thinking is defined and enable_thinking) or tools or messages[0]['role'] in ['system', 'developer'] -%}
|
| 180 |
+
{{- '<|turn>system\n' -}}
|
| 181 |
+
|
| 182 |
+
{#- Inject Thinking token at the very top of the FIRST system turn -#}
|
| 183 |
+
{%- if enable_thinking is defined and enable_thinking -%}
|
| 184 |
+
{{- '<|think|>\n' -}}
|
| 185 |
+
{%- set ns.prev_message_type = 'think' -%}
|
| 186 |
+
{%- endif -%}
|
| 187 |
+
|
| 188 |
+
{%- if messages[0]['role'] in ['system', 'developer'] -%}
|
| 189 |
+
{{- messages[0]['content'] | trim -}}
|
| 190 |
+
{%- set loop_messages = messages[1:] -%}
|
| 191 |
+
{%- endif -%}
|
| 192 |
+
|
| 193 |
+
{%- if tools -%}
|
| 194 |
+
{%- for tool in tools %}
|
| 195 |
+
{{- '<|tool>' -}}
|
| 196 |
+
{{- format_function_declaration(tool) | trim -}}
|
| 197 |
+
{{- '<tool|>' -}}
|
| 198 |
+
{%- endfor %}
|
| 199 |
+
{%- set ns.prev_message_type = 'tool' -%}
|
| 200 |
+
{%- endif -%}
|
| 201 |
+
|
| 202 |
+
{{- '<turn|>\n' -}}
|
| 203 |
+
{%- endif %}
|
| 204 |
+
|
| 205 |
+
{#- Pre-scan: find last user message index for reasoning guard -#}
|
| 206 |
+
{%- set ns_turn = namespace(last_user_idx=-1) -%}
|
| 207 |
+
{%- for i in range(loop_messages | length) -%}
|
| 208 |
+
{%- if loop_messages[i]['role'] == 'user' -%}
|
| 209 |
+
{%- set ns_turn.last_user_idx = i -%}
|
| 210 |
+
{%- endif -%}
|
| 211 |
+
{%- endfor -%}
|
| 212 |
+
|
| 213 |
+
{#- Loop through messages -#}
|
| 214 |
+
{%- for message in loop_messages -%}
|
| 215 |
+
{%- if message['role'] != 'tool' -%}
|
| 216 |
+
{%- set ns.prev_message_type = None -%}
|
| 217 |
+
{%- set role = 'model' if message['role'] == 'assistant' else message['role'] -%}
|
| 218 |
+
{#- Detect continuation: suppress duplicate <|turn>model when previous non-tool message was also assistant -#}
|
| 219 |
+
{%- set prev_nt = namespace(role=None, found=false) -%}
|
| 220 |
+
{%- if loop.index0 > 0 -%}
|
| 221 |
+
{%- for j in range(loop.index0 - 1, -1, -1) -%}
|
| 222 |
+
{%- if not prev_nt.found -%}
|
| 223 |
+
{%- if loop_messages[j]['role'] != 'tool' -%}
|
| 224 |
+
{%- set prev_nt.role = loop_messages[j]['role'] -%}
|
| 225 |
+
{%- set prev_nt.found = true -%}
|
| 226 |
+
{%- endif -%}
|
| 227 |
+
{%- endif -%}
|
| 228 |
+
{%- endfor -%}
|
| 229 |
+
{%- endif -%}
|
| 230 |
+
{%- set continue_same_model_turn = (role == 'model' and prev_nt.role == 'assistant') -%}
|
| 231 |
+
{%- if not continue_same_model_turn -%}
|
| 232 |
+
{{- '<|turn>' + role + '\n' }}
|
| 233 |
+
{%- endif -%}
|
| 234 |
+
|
| 235 |
+
{#- Render reasoning/reasoning_content as thinking channel -#}
|
| 236 |
+
{%- set thinking_text = message.get('reasoning') or message.get('reasoning_content') -%}
|
| 237 |
+
{%- if thinking_text and loop.index0 > ns_turn.last_user_idx and message.get('tool_calls') -%}
|
| 238 |
+
{{- '<|channel>thought\n' + thinking_text + '\n<channel|>' -}}
|
| 239 |
+
{%- endif -%}
|
| 240 |
+
|
| 241 |
+
{%- if message['tool_calls'] -%}
|
| 242 |
+
{%- for tool_call in message['tool_calls'] -%}
|
| 243 |
+
{%- set function = tool_call['function'] -%}
|
| 244 |
+
{{- '<|tool_call>call:' + function['name'] + '{' -}}
|
| 245 |
+
{%- if function['arguments'] is mapping -%}
|
| 246 |
+
{%- set ns_args = namespace(found_first=false) -%}
|
| 247 |
+
{%- for key, value in function['arguments'] | dictsort -%}
|
| 248 |
+
{%- if ns_args.found_first %},{% endif -%}
|
| 249 |
+
{%- set ns_args.found_first = true -%}
|
| 250 |
+
{{- key -}}:{{- format_argument(value, escape_keys=False) -}}
|
| 251 |
+
{%- endfor -%}
|
| 252 |
+
{%- elif function['arguments'] is string -%}
|
| 253 |
+
{{- function['arguments'] -}}
|
| 254 |
+
{%- endif -%}
|
| 255 |
+
{{- '}<tool_call|>' -}}
|
| 256 |
+
{%- endfor -%}
|
| 257 |
+
{%- set ns.prev_message_type = 'tool_call' -%}
|
| 258 |
+
{%- endif -%}
|
| 259 |
+
|
| 260 |
+
{%- set ns_tr_out = namespace(flag=false) -%}
|
| 261 |
+
{%- if message.get('tool_responses') -%}
|
| 262 |
+
{#- Legacy: tool_responses embedded on the assistant message (Google/Gemma native) -#}
|
| 263 |
+
{%- for tool_response in message['tool_responses'] -%}
|
| 264 |
+
{{- format_tool_response_block(tool_response['name'] | default('unknown'), tool_response['response']) -}}
|
| 265 |
+
{%- set ns_tr_out.flag = true -%}
|
| 266 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 267 |
+
{%- endfor -%}
|
| 268 |
+
{%- elif message.get('tool_calls') -%}
|
| 269 |
+
{#- OpenAI Chat Completions: forward-scan consecutive role:tool messages -#}
|
| 270 |
+
{%- set ns_tool_scan = namespace(stopped=false) -%}
|
| 271 |
+
{%- for k in range(loop.index0 + 1, loop_messages | length) -%}
|
| 272 |
+
{%- if ns_tool_scan.stopped -%}
|
| 273 |
+
{%- elif loop_messages[k]['role'] != 'tool' -%}
|
| 274 |
+
{%- set ns_tool_scan.stopped = true -%}
|
| 275 |
+
{%- else -%}
|
| 276 |
+
{%- set follow = loop_messages[k] -%}
|
| 277 |
+
{#- Resolve tool_call_id to function name -#}
|
| 278 |
+
{%- set ns_tname = namespace(name=follow.get('name') | default('unknown')) -%}
|
| 279 |
+
{%- for tc in message['tool_calls'] -%}
|
| 280 |
+
{%- if tc.get('id') == follow.get('tool_call_id') -%}
|
| 281 |
+
{%- set ns_tname.name = tc['function']['name'] -%}
|
| 282 |
+
{%- endif -%}
|
| 283 |
+
{%- endfor -%}
|
| 284 |
+
{#- Handle content as string or content-parts array -#}
|
| 285 |
+
{%- set tool_body = follow.get('content') -%}
|
| 286 |
+
{%- if tool_body is string -%}
|
| 287 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 288 |
+
{%- elif tool_body is sequence and tool_body is not string -%}
|
| 289 |
+
{%- set ns_txt = namespace(s='') -%}
|
| 290 |
+
{%- for part in tool_body -%}
|
| 291 |
+
{%- if part.get('type') == 'text' -%}
|
| 292 |
+
{%- set ns_txt.s = ns_txt.s + (part.get('text') | default('')) -%}
|
| 293 |
+
{%- endif -%}
|
| 294 |
+
{%- endfor -%}
|
| 295 |
+
{{- format_tool_response_block(ns_tname.name, ns_txt.s) -}}
|
| 296 |
+
{%- else -%}
|
| 297 |
+
{{- format_tool_response_block(ns_tname.name, tool_body) -}}
|
| 298 |
+
{%- endif -%}
|
| 299 |
+
{%- set ns_tr_out.flag = true -%}
|
| 300 |
+
{%- set ns.prev_message_type = 'tool_response' -%}
|
| 301 |
+
{%- endif -%}
|
| 302 |
+
{%- endfor -%}
|
| 303 |
+
{%- endif -%}
|
| 304 |
+
|
| 305 |
+
{%- if message['content'] is string -%}
|
| 306 |
+
{%- if role == 'model' -%}
|
| 307 |
+
{{- strip_thinking(message['content']) -}}
|
| 308 |
+
{%- else -%}
|
| 309 |
+
{{- message['content'] | trim -}}
|
| 310 |
+
{%- endif -%}
|
| 311 |
+
{%- elif message['content'] is sequence -%}
|
| 312 |
+
{%- for item in message['content'] -%}
|
| 313 |
+
{%- if item['type'] == 'text' -%}
|
| 314 |
+
{%- if role == 'model' -%}
|
| 315 |
+
{{- strip_thinking(item['text']) -}}
|
| 316 |
+
{%- else -%}
|
| 317 |
+
{{- item['text'] | trim -}}
|
| 318 |
+
{%- endif -%}
|
| 319 |
+
{%- elif item['type'] == 'image' -%}
|
| 320 |
+
{{- '<|image|>' -}}
|
| 321 |
+
{%- set ns.prev_message_type = 'image' -%}
|
| 322 |
+
{%- elif item['type'] == 'audio' -%}
|
| 323 |
+
{{- '<|audio|>' -}}
|
| 324 |
+
{%- set ns.prev_message_type = 'audio' -%}
|
| 325 |
+
{%- elif item['type'] == 'video' -%}
|
| 326 |
+
{{- '<|video|>' -}}
|
| 327 |
+
{%- set ns.prev_message_type = 'video' -%}
|
| 328 |
+
{%- endif -%}
|
| 329 |
+
{%- endfor -%}
|
| 330 |
+
{%- endif -%}
|
| 331 |
+
|
| 332 |
+
{%- if ns.prev_message_type == 'tool_call' and not ns_tr_out.flag -%}
|
| 333 |
+
{{- '<|tool_response>' -}}
|
| 334 |
+
{%- elif not (ns_tr_out.flag and not message.get('content')) -%}
|
| 335 |
+
{{- '<turn|>\n' -}}
|
| 336 |
+
{%- endif -%}
|
| 337 |
+
{%- endif -%}
|
| 338 |
+
{%- endfor -%}
|
| 339 |
+
|
| 340 |
+
{%- if add_generation_prompt -%}
|
| 341 |
+
{%- if ns.prev_message_type != 'tool_response' and ns.prev_message_type != 'tool_call' -%}
|
| 342 |
+
{{- '<|turn>model\n' -}}
|
| 343 |
+
{%- if not enable_thinking | default(false) -%}
|
| 344 |
+
{{- '<|channel>thought\n<channel|>' -}}
|
| 345 |
+
{%- endif -%}
|
| 346 |
+
{%- endif -%}
|
| 347 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_zero_compute_expert": true,
|
| 3 |
+
"architectures": [
|
| 4 |
+
"OptimizedGemma4ForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"attention_bias": false,
|
| 7 |
+
"attention_dropout": 0.0,
|
| 8 |
+
"attention_k_eq_v": true,
|
| 9 |
+
"auto_map": {
|
| 10 |
+
"AutoConfig": "configuration_gemma4.Gemma4TextConfig",
|
| 11 |
+
"AutoModelForCausalLM": "gemma4_optimization.OptimizedGemma4ForCausalLM"
|
| 12 |
+
},
|
| 13 |
+
"bos_token_id": 2,
|
| 14 |
+
"dtype": "bfloat16",
|
| 15 |
+
"enable_moe_block": true,
|
| 16 |
+
"eos_token_id": 1,
|
| 17 |
+
"final_logit_softcapping": 30.0,
|
| 18 |
+
"global_head_dim": 512,
|
| 19 |
+
"head_dim": 256,
|
| 20 |
+
"hidden_activation": "gelu_pytorch_tanh",
|
| 21 |
+
"hidden_size": 2816,
|
| 22 |
+
"hidden_size_per_layer_input": 0,
|
| 23 |
+
"initializer_range": 0.02,
|
| 24 |
+
"intermediate_size": 2112,
|
| 25 |
+
"layer_types": [
|
| 26 |
+
"sliding_attention",
|
| 27 |
+
"sliding_attention",
|
| 28 |
+
"sliding_attention",
|
| 29 |
+
"sliding_attention",
|
| 30 |
+
"sliding_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"sliding_attention",
|
| 33 |
+
"sliding_attention",
|
| 34 |
+
"sliding_attention",
|
| 35 |
+
"sliding_attention",
|
| 36 |
+
"sliding_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"sliding_attention",
|
| 39 |
+
"sliding_attention",
|
| 40 |
+
"sliding_attention",
|
| 41 |
+
"sliding_attention",
|
| 42 |
+
"sliding_attention",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"sliding_attention",
|
| 45 |
+
"sliding_attention",
|
| 46 |
+
"sliding_attention",
|
| 47 |
+
"sliding_attention",
|
| 48 |
+
"sliding_attention",
|
| 49 |
+
"full_attention",
|
| 50 |
+
"sliding_attention",
|
| 51 |
+
"sliding_attention",
|
| 52 |
+
"sliding_attention",
|
| 53 |
+
"sliding_attention",
|
| 54 |
+
"sliding_attention",
|
| 55 |
+
"full_attention"
|
| 56 |
+
],
|
| 57 |
+
"max_position_embeddings": 262144,
|
| 58 |
+
"model_type": "gemma4_text",
|
| 59 |
+
"moe_intermediate_size": 704,
|
| 60 |
+
"num_attention_heads": 16,
|
| 61 |
+
"num_experts": 128,
|
| 62 |
+
"num_global_key_value_heads": 2,
|
| 63 |
+
"num_hidden_layers": 30,
|
| 64 |
+
"num_key_value_heads": 8,
|
| 65 |
+
"num_kv_shared_layers": 0,
|
| 66 |
+
"pad_token_id": 0,
|
| 67 |
+
"rms_norm_eps": 1e-06,
|
| 68 |
+
"rope_parameters": {
|
| 69 |
+
"full_attention": {
|
| 70 |
+
"partial_rotary_factor": 0.25,
|
| 71 |
+
"rope_theta": 1000000.0,
|
| 72 |
+
"rope_type": "proportional"
|
| 73 |
+
},
|
| 74 |
+
"sliding_attention": {
|
| 75 |
+
"rope_theta": 10000.0,
|
| 76 |
+
"rope_type": "default"
|
| 77 |
+
}
|
| 78 |
+
},
|
| 79 |
+
"sliding_window": 1024,
|
| 80 |
+
"tie_word_embeddings": true,
|
| 81 |
+
"top_k_experts": 8,
|
| 82 |
+
"transformers_version": "5.5.3",
|
| 83 |
+
"use_bidirectional_attention": "vision",
|
| 84 |
+
"use_cache": true,
|
| 85 |
+
"use_double_wide_mlp": false,
|
| 86 |
+
"use_zero_compute_optimization": true,
|
| 87 |
+
"vocab_size": 262144,
|
| 88 |
+
"vocab_size_per_layer_input": 262144
|
| 89 |
+
}
|
configuration_gemma4.py
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2026 the HuggingFace Team. All rights reserved.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
from typing import Any, Literal
|
| 16 |
+
|
| 17 |
+
from huggingface_hub.dataclasses import strict
|
| 18 |
+
|
| 19 |
+
from transformers.configuration_utils import PreTrainedConfig
|
| 20 |
+
from transformers.utils import auto_docstring, logging
|
| 21 |
+
from transformers.utils.type_validators import interval
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
logger = logging.get_logger(__name__)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
@auto_docstring(checkpoint="google/gemma-4-e2b-it")
|
| 28 |
+
@strict
|
| 29 |
+
class Gemma4AudioConfig(PreTrainedConfig):
|
| 30 |
+
r"""
|
| 31 |
+
subsampling_conv_channels (`list[int]`, defaults to `[128, 32]`):
|
| 32 |
+
Channel sizes for the convolutional layers in the Sub-sample Convolution Projection.
|
| 33 |
+
residual_weight (`float`, defaults to `0.5`):
|
| 34 |
+
Scaling applied to hidden_states prior to combining with the residual in the feedforward.
|
| 35 |
+
attention_chunk_size (`int`, defaults to `12`):
|
| 36 |
+
The sub-sequence size for attention processing.
|
| 37 |
+
attention_context_left (`int`, defaults to `13`):
|
| 38 |
+
The leftward context size for the attention chunk.
|
| 39 |
+
attention_context_right (`int`, defaults to `0`):
|
| 40 |
+
The rightward context size for the attention chunk.
|
| 41 |
+
attention_logit_cap (`float`, defaults to `50.0`):
|
| 42 |
+
Cap applied to attention weights.
|
| 43 |
+
attention_invalid_logits_value (`float`, defaults to `1e-9`):
|
| 44 |
+
Value to use for invalid logits in attention.
|
| 45 |
+
use_clipped_linears (`bool`, defaults to `True`):
|
| 46 |
+
If true, apply clipping to the Linear layers, drawing bounds from the model checkpoint.
|
| 47 |
+
gradient_clipping (`float`, defaults to `1e10`):
|
| 48 |
+
Clipping value used to stabilize extremely large gradient values.
|
| 49 |
+
output_proj_dims (`int`, defaults to `1536`):
|
| 50 |
+
Dimension of the final linear projection from `hidden_size` to the model's output.
|
| 51 |
+
"""
|
| 52 |
+
|
| 53 |
+
model_type = "gemma4_audio"
|
| 54 |
+
|
| 55 |
+
hidden_size: int = 1024
|
| 56 |
+
num_hidden_layers: int = 12
|
| 57 |
+
num_attention_heads: int = 8
|
| 58 |
+
hidden_act: str = "silu"
|
| 59 |
+
|
| 60 |
+
# subsampling parameters
|
| 61 |
+
subsampling_conv_channels: list[int] | tuple[int, int] = (128, 32)
|
| 62 |
+
|
| 63 |
+
# conformer parameters
|
| 64 |
+
conv_kernel_size: int = 5
|
| 65 |
+
residual_weight: float = 0.5
|
| 66 |
+
attention_chunk_size: int = 12
|
| 67 |
+
attention_context_left: int = 13
|
| 68 |
+
attention_context_right: int = 0
|
| 69 |
+
attention_logit_cap: float = 50.0
|
| 70 |
+
attention_invalid_logits_value: float = -1.0e9
|
| 71 |
+
|
| 72 |
+
use_clipped_linears: bool = True
|
| 73 |
+
rms_norm_eps: float = 1e-6
|
| 74 |
+
gradient_clipping: float = 1e10
|
| 75 |
+
output_proj_dims: int = 1536
|
| 76 |
+
initializer_range: float = interval(min=0.0, max=1.0)(default=0.02)
|
| 77 |
+
|
| 78 |
+
def __post_init__(self, **kwargs):
|
| 79 |
+
# JSON serialization converts tuples to lists, convert back
|
| 80 |
+
if isinstance(self.subsampling_conv_channels, tuple):
|
| 81 |
+
self.subsampling_conv_channels = list(self.subsampling_conv_channels)
|
| 82 |
+
super().__post_init__(**kwargs)
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
@auto_docstring(checkpoint="google/gemma-4-e2b-it")
|
| 86 |
+
@strict
|
| 87 |
+
class Gemma4TextConfig(PreTrainedConfig):
|
| 88 |
+
r"""
|
| 89 |
+
use_bidirectional_attention (`str`, *optional*):
|
| 90 |
+
Controls bidirectional attention behavior. When set to `"vision"`, vision tokens
|
| 91 |
+
attend bidirectionally while text tokens use causal attention. When set to `"all"`,
|
| 92 |
+
all tokens use bidirectional attention.
|
| 93 |
+
vocab_size_per_layer_input (`int`, defaults to 262144):
|
| 94 |
+
Vocabulary size for the per-layer input embeddings. Used by models with per-layer
|
| 95 |
+
residual streams where a smaller embedding is added at each decoder layer.
|
| 96 |
+
hidden_size_per_layer_input (`int`, defaults to 256):
|
| 97 |
+
Hidden dimension for the per-layer input embeddings. Controls the width of the
|
| 98 |
+
per-layer residual embedding vectors.
|
| 99 |
+
num_global_key_value_heads (`int`, *optional*):
|
| 100 |
+
Number of key-value heads for global (full) attention layers. If `None`, defaults
|
| 101 |
+
to `num_key_value_heads`.
|
| 102 |
+
global_head_dim (`int`, defaults to 512):
|
| 103 |
+
Dimension of each attention head in global (full) attention layers.
|
| 104 |
+
attention_k_eq_v (`bool`, defaults to `False`):
|
| 105 |
+
Whether keys and values share the same projection weights. When `True`, the key
|
| 106 |
+
projection output is reused as the value projection.
|
| 107 |
+
num_kv_shared_layers (`int`, defaults to 0):
|
| 108 |
+
Number of consecutive decoder layers that share the same key-value projections.
|
| 109 |
+
A value of 0 means no sharing (each layer has independent KV projections).
|
| 110 |
+
enable_moe_block (`bool`, defaults to `False`):
|
| 111 |
+
Whether to enable Mixture-of-Experts (MoE) blocks in the decoder layers. When
|
| 112 |
+
`True`, eligible layers will use a sparse MoE feed-forward network.
|
| 113 |
+
use_double_wide_mlp (`bool`, defaults to `False`):
|
| 114 |
+
Whether to use a double-width MLP with fused gate and up projections.
|
| 115 |
+
top_k_experts (`int`, *optional*):
|
| 116 |
+
Number of experts activated per token in MoE layers. Only used when
|
| 117 |
+
`enable_moe_block=True`.
|
| 118 |
+
moe_intermediate_size (`int`, *optional*):
|
| 119 |
+
Intermediate (hidden) size of each expert's feed-forward network in MoE layers.
|
| 120 |
+
Only used when `enable_moe_block=True`.
|
| 121 |
+
add_zero_compute_expert (`bool`, defaults to `False`):
|
| 122 |
+
Whether to append a router-only expert slot that performs no expert compute. This
|
| 123 |
+
keeps the original expert weights intact while allowing the router to learn to
|
| 124 |
+
send tokens to a zero-compute path.
|
| 125 |
+
use_zero_compute_optimization (`bool`, defaults to `False`):
|
| 126 |
+
Signals higher-level orchestration to build the optimized Gemma4 text stack instead
|
| 127 |
+
of the original one while keeping the base architecture definitions available.
|
| 128 |
+
"""
|
| 129 |
+
|
| 130 |
+
model_type = "gemma4_text"
|
| 131 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 132 |
+
base_model_tp_plan = {
|
| 133 |
+
"layers.*.self_attn.q_proj": "colwise",
|
| 134 |
+
"layers.*.self_attn.k_proj": "colwise",
|
| 135 |
+
"layers.*.self_attn.v_proj": "colwise",
|
| 136 |
+
"layers.*.self_attn.q_norm": "replicated_with_grad_allreduce",
|
| 137 |
+
"layers.*.self_attn.k_norm": "replicated_with_grad_allreduce",
|
| 138 |
+
"layers.*.self_attn.o_proj": "rowwise",
|
| 139 |
+
"layers.*.mlp.gate_proj": "colwise",
|
| 140 |
+
"layers.*.mlp.up_proj": "colwise",
|
| 141 |
+
"layers.*.mlp.down_proj": "rowwise",
|
| 142 |
+
"layers.*.experts.gate_up_proj": "packed_colwise",
|
| 143 |
+
"layers.*.experts.down_proj": "rowwise",
|
| 144 |
+
"layers.*.experts": "moe_tp_experts",
|
| 145 |
+
}
|
| 146 |
+
base_model_pp_plan = {
|
| 147 |
+
"embed_tokens": (["input_ids"], ["inputs_embeds"]),
|
| 148 |
+
"layers": (["hidden_states", "attention_mask"], ["hidden_states"]),
|
| 149 |
+
"norm": (["hidden_states"], ["hidden_states"]),
|
| 150 |
+
}
|
| 151 |
+
|
| 152 |
+
vocab_size: int = 262_144
|
| 153 |
+
hidden_size: int = 2304
|
| 154 |
+
intermediate_size: int = 9216
|
| 155 |
+
num_hidden_layers: int = 30
|
| 156 |
+
num_attention_heads: int = 8
|
| 157 |
+
num_key_value_heads: int = 4
|
| 158 |
+
head_dim: int = 256
|
| 159 |
+
hidden_activation: str = "gelu_pytorch_tanh"
|
| 160 |
+
max_position_embeddings: int = 131_072
|
| 161 |
+
initializer_range: float = 0.02
|
| 162 |
+
rms_norm_eps: float = 1e-6
|
| 163 |
+
use_cache: bool = True
|
| 164 |
+
pad_token_id: int | None = 0
|
| 165 |
+
eos_token_id: int | list[int] | None = 1
|
| 166 |
+
bos_token_id: int | None = 2
|
| 167 |
+
tie_word_embeddings: bool = True
|
| 168 |
+
rope_parameters: dict | None = None
|
| 169 |
+
attention_bias: bool = False
|
| 170 |
+
attention_dropout: int | float | None = 0.0
|
| 171 |
+
sliding_window: int = 512
|
| 172 |
+
layer_types: list[str] | None = None
|
| 173 |
+
final_logit_softcapping: float | None = None
|
| 174 |
+
use_bidirectional_attention: Literal["all", "vision"] | None = None
|
| 175 |
+
vocab_size_per_layer_input: int = 262_144
|
| 176 |
+
hidden_size_per_layer_input: int = 256
|
| 177 |
+
num_global_key_value_heads: int | None = None
|
| 178 |
+
global_head_dim: int = 512
|
| 179 |
+
attention_k_eq_v: bool = False
|
| 180 |
+
num_kv_shared_layers: int = 0
|
| 181 |
+
enable_moe_block: bool = False
|
| 182 |
+
use_double_wide_mlp: bool = False
|
| 183 |
+
num_experts: int | None = None
|
| 184 |
+
top_k_experts: int | None = None
|
| 185 |
+
moe_intermediate_size: int | None = None
|
| 186 |
+
add_zero_compute_expert: bool = False
|
| 187 |
+
use_zero_compute_optimization: bool = False
|
| 188 |
+
|
| 189 |
+
def __post_init__(self, **kwargs):
|
| 190 |
+
if self.use_bidirectional_attention == "all":
|
| 191 |
+
self.sliding_window = (self.sliding_window // 2) + 1 # due to fa we set exclusive bounds
|
| 192 |
+
|
| 193 |
+
if self.layer_types is None:
|
| 194 |
+
sliding_window_pattern = 6 # by default 5:1
|
| 195 |
+
self.layer_types = [
|
| 196 |
+
"sliding_attention" if bool((i + 1) % sliding_window_pattern) else "full_attention"
|
| 197 |
+
for i in range(self.num_hidden_layers)
|
| 198 |
+
]
|
| 199 |
+
|
| 200 |
+
if self.layer_types and (last_layer_type := self.layer_types[-1]) != "full_attention":
|
| 201 |
+
logger.warning(
|
| 202 |
+
f"Last layer must use `full_attention`, but got `{last_layer_type}`. Forcing last layer to `full_attention`."
|
| 203 |
+
)
|
| 204 |
+
self.layer_types[-1] = "full_attention"
|
| 205 |
+
|
| 206 |
+
default_rope_params: dict[Literal["full_attention", "sliding_attention"] : dict[str, Any]] = {
|
| 207 |
+
"sliding_attention": {"rope_type": "default", "rope_theta": 10_000.0},
|
| 208 |
+
"full_attention": {"rope_type": "proportional", "partial_rotary_factor": 0.25, "rope_theta": 1_000_000.0},
|
| 209 |
+
}
|
| 210 |
+
active_layer_types = set(self.layer_types)
|
| 211 |
+
if self.rope_parameters is None:
|
| 212 |
+
self.rope_parameters = {
|
| 213 |
+
layer_type: dict(default_rope_params[layer_type]) for layer_type in active_layer_types
|
| 214 |
+
}
|
| 215 |
+
elif set(self.rope_parameters.keys()).issubset(default_rope_params):
|
| 216 |
+
self.rope_parameters = {
|
| 217 |
+
layer_type: dict(rope_params)
|
| 218 |
+
for layer_type, rope_params in self.rope_parameters.items()
|
| 219 |
+
if layer_type in active_layer_types
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
if self.num_experts is not None and self.top_k_experts is not None:
|
| 223 |
+
total_num_experts = self.num_experts + int(self.add_zero_compute_expert)
|
| 224 |
+
if self.top_k_experts > total_num_experts:
|
| 225 |
+
logger.warning(
|
| 226 |
+
"top_k_experts=%s exceeds the available expert count %s. "
|
| 227 |
+
"Clamping top_k_experts to %s.",
|
| 228 |
+
self.top_k_experts,
|
| 229 |
+
total_num_experts,
|
| 230 |
+
total_num_experts,
|
| 231 |
+
)
|
| 232 |
+
self.top_k_experts = total_num_experts
|
| 233 |
+
|
| 234 |
+
if self.add_zero_compute_expert:
|
| 235 |
+
self.use_zero_compute_optimization = True
|
| 236 |
+
|
| 237 |
+
super().__post_init__(**kwargs)
|
| 238 |
+
|
| 239 |
+
def convert_rope_params_to_dict(self, **kwargs):
|
| 240 |
+
# No need to handle BC for new models, because they have no old-format `rope_scaling`
|
| 241 |
+
return kwargs
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
@auto_docstring(checkpoint="google/gemma-4-e2b-it")
|
| 245 |
+
@strict
|
| 246 |
+
class Gemma4VisionConfig(PreTrainedConfig):
|
| 247 |
+
r"""
|
| 248 |
+
pooling_kernel_size (`int`, *optional*):
|
| 249 |
+
Spatial pooling kernel size applied after patchification.
|
| 250 |
+
position_embedding_size (`int`, defaults to 10240):
|
| 251 |
+
Maximum number of position embeddings for the vision encoder. Controls the size of
|
| 252 |
+
the learned 2D position embedding table used by the patch embedder.
|
| 253 |
+
use_clipped_linears (`bool`, defaults to `False`):
|
| 254 |
+
Whether to use weight-clipped linear layers. When enabled, linear layer weights are
|
| 255 |
+
clamped to a fixed range during the forward pass to improve numerical stability.
|
| 256 |
+
standardize (`bool`, defaults to `False`):
|
| 257 |
+
If true, applies a bias and scale to the soft tokens returned from the pooler.
|
| 258 |
+
"""
|
| 259 |
+
|
| 260 |
+
model_type = "gemma4_vision"
|
| 261 |
+
base_model_tp_plan = {
|
| 262 |
+
"encoder.layers.*.self_attn.q_proj": "colwise",
|
| 263 |
+
"encoder.layers.*.self_attn.k_proj": "colwise",
|
| 264 |
+
"encoder.layers.*.self_attn.v_proj": "colwise",
|
| 265 |
+
"encoder.layers.*.self_attn.q_norm": "replicated_with_grad_allreduce",
|
| 266 |
+
"encoder.layers.*.self_attn.k_norm": "replicated_with_grad_allreduce",
|
| 267 |
+
"encoder.layers.*.self_attn.o_proj": "rowwise",
|
| 268 |
+
"encoder.layers.*.mlp.gate_proj": "colwise",
|
| 269 |
+
"encoder.layers.*.mlp.up_proj": "colwise",
|
| 270 |
+
"encoder.layers.*.mlp.down_proj": "rowwise",
|
| 271 |
+
}
|
| 272 |
+
default_theta = 100.0
|
| 273 |
+
|
| 274 |
+
hidden_size: int = 768
|
| 275 |
+
intermediate_size: int = 3072
|
| 276 |
+
num_hidden_layers: int = 16
|
| 277 |
+
num_attention_heads: int = 12
|
| 278 |
+
num_key_value_heads: int = 12
|
| 279 |
+
head_dim: int = 64
|
| 280 |
+
hidden_activation: str = "gelu_pytorch_tanh"
|
| 281 |
+
rms_norm_eps: float = 1e-6
|
| 282 |
+
max_position_embeddings: int = 131_072
|
| 283 |
+
attention_bias: bool | None = False
|
| 284 |
+
attention_dropout: float | None = 0.0
|
| 285 |
+
rope_parameters: dict | None = None
|
| 286 |
+
pooling_kernel_size: int = 3
|
| 287 |
+
patch_size: int = 16
|
| 288 |
+
position_embedding_size: int = 10 * 1024
|
| 289 |
+
use_clipped_linears: bool = False
|
| 290 |
+
standardize: bool = False
|
| 291 |
+
initializer_range: float = 0.02
|
| 292 |
+
|
| 293 |
+
def __post_init__(self, **kwargs):
|
| 294 |
+
if self.rope_parameters is None:
|
| 295 |
+
self.rope_parameters = {"rope_type": "default", "rope_theta": 100.0}
|
| 296 |
+
|
| 297 |
+
super().__post_init__(**kwargs)
|
| 298 |
+
|
| 299 |
+
|
| 300 |
+
@auto_docstring(checkpoint="google/gemma-4-e2b-it")
|
| 301 |
+
@strict
|
| 302 |
+
class Gemma4Config(PreTrainedConfig):
|
| 303 |
+
r"""
|
| 304 |
+
boi_token_id (`int`, *optional*, defaults to 255999):
|
| 305 |
+
The begin-of-image token index to wrap the image prompt.
|
| 306 |
+
eoi_token_id (`int`, *optional*, defaults to 258882):
|
| 307 |
+
The end-of-image token index to wrap the image prompt.
|
| 308 |
+
boa_token_id (`int`, *optional*, defaults to 256000):
|
| 309 |
+
The begin-of-audio token index to wrap the audio prompt.
|
| 310 |
+
eoa_token_index (`int`, *optional*, defaults to 258883):
|
| 311 |
+
The end-of-audio token index to wrap the audio prompt.
|
| 312 |
+
|
| 313 |
+
Example:
|
| 314 |
+
|
| 315 |
+
```python
|
| 316 |
+
>>> from transformers import (
|
| 317 |
+
>>> Gemma4AudioConfig,
|
| 318 |
+
>>> Gemma4Config,
|
| 319 |
+
>>> Gemma4ForConditionalGeneration,
|
| 320 |
+
>>> Gemma4TextConfig,
|
| 321 |
+
>>> Gemma4VisionConfig,
|
| 322 |
+
>>> )
|
| 323 |
+
|
| 324 |
+
>>> # Initializing a Gemma 4 Audio config.
|
| 325 |
+
>>> audio_config = Gemma4AudioConfig()
|
| 326 |
+
|
| 327 |
+
>>> # Initializing a Gemma 4 Text config.
|
| 328 |
+
>>> text_config = Gemma4TextConfig()
|
| 329 |
+
|
| 330 |
+
>>> # Initializing a Gemma 4 vision config.
|
| 331 |
+
>>> vision_config = Gemma4VisionConfig()
|
| 332 |
+
|
| 333 |
+
>>> # Initializing a Gemma 4 config similar to google/gemma-4-e2b-it
|
| 334 |
+
>>> configuration = Gemma4Config(text_config, vision_config, audio_config)
|
| 335 |
+
|
| 336 |
+
>>> # Initializing a model from the google/gemma-4-e2b-it configuration
|
| 337 |
+
>>> model = Gemma4ForConditionalGeneration(configuration)
|
| 338 |
+
|
| 339 |
+
>>> # Accessing the model configuration
|
| 340 |
+
>>> configuration = model.config
|
| 341 |
+
```"""
|
| 342 |
+
|
| 343 |
+
model_type = "gemma4"
|
| 344 |
+
sub_configs = {
|
| 345 |
+
"text_config": Gemma4TextConfig,
|
| 346 |
+
"vision_config": Gemma4VisionConfig,
|
| 347 |
+
"audio_config": Gemma4AudioConfig,
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
text_config: Gemma4TextConfig | dict[str, Any] | None = None
|
| 351 |
+
vision_config: Gemma4VisionConfig | dict[str, Any] | None = None
|
| 352 |
+
audio_config: Gemma4AudioConfig | dict[str, Any] | None = None
|
| 353 |
+
boi_token_id: int | None = 255_999
|
| 354 |
+
eoi_token_id: int | None = 258_882
|
| 355 |
+
image_token_id: int | None = 258_880
|
| 356 |
+
video_token_id: int | None = 258_884
|
| 357 |
+
boa_token_id: int | None = 256_000
|
| 358 |
+
eoa_token_index: int | None = 258_883
|
| 359 |
+
audio_token_id: int | None = 258_881
|
| 360 |
+
initializer_range: float | None = 0.02
|
| 361 |
+
tie_word_embeddings: bool = True
|
| 362 |
+
|
| 363 |
+
def __post_init__(self, **kwargs):
|
| 364 |
+
if self.text_config is None:
|
| 365 |
+
self.text_config = Gemma4TextConfig()
|
| 366 |
+
logger.info("text_config is None. Using default Gemma4TextConfig.")
|
| 367 |
+
elif isinstance(self.text_config, dict):
|
| 368 |
+
self.text_config = Gemma4TextConfig(**self.text_config)
|
| 369 |
+
|
| 370 |
+
if self.vision_config is None:
|
| 371 |
+
logger.info("vision_config is None. Gemma4Model.vision_tower will not be initialized.")
|
| 372 |
+
if isinstance(self.vision_config, dict):
|
| 373 |
+
self.vision_config = Gemma4VisionConfig(**self.vision_config)
|
| 374 |
+
|
| 375 |
+
if self.audio_config is None:
|
| 376 |
+
logger.info("audio_config is None. Gemma4Model.audio_tower will not be initialized.")
|
| 377 |
+
if isinstance(self.audio_config, dict):
|
| 378 |
+
self.audio_config = Gemma4AudioConfig(**self.audio_config)
|
| 379 |
+
|
| 380 |
+
super().__post_init__(**kwargs)
|
| 381 |
+
|
| 382 |
+
|
| 383 |
+
__all__ = ["Gemma4AudioConfig", "Gemma4Config", "Gemma4TextConfig", "Gemma4VisionConfig"]
|
export_summary.json
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"base_model_class": "Gemma4TextCausalLMProxy",
|
| 3 |
+
"code_files": [
|
| 4 |
+
"/tmp/gemma4-hf-export-zxa_ushe/configuration_gemma4.py",
|
| 5 |
+
"/tmp/gemma4-hf-export-zxa_ushe/modeling_gemma4.py",
|
| 6 |
+
"/tmp/gemma4-hf-export-zxa_ushe/gemma4_optimization.py",
|
| 7 |
+
"/tmp/gemma4-hf-export-zxa_ushe/__init__.py"
|
| 8 |
+
],
|
| 9 |
+
"max_shard_size": "5GB",
|
| 10 |
+
"model_class": "OptimizedGemma4ForCausalLM",
|
| 11 |
+
"output_dir": "/tmp/gemma4-hf-export-zxa_ushe",
|
| 12 |
+
"repo_id": "haysonC/gemma4-zero-compute",
|
| 13 |
+
"router_checkpoint": {
|
| 14 |
+
"config": {
|
| 15 |
+
"metadata": {
|
| 16 |
+
"resume_summary": {
|
| 17 |
+
"config": {
|
| 18 |
+
"metadata": {
|
| 19 |
+
"resume_summary": {
|
| 20 |
+
"config": {
|
| 21 |
+
"metadata": {
|
| 22 |
+
"resume_summary": {
|
| 23 |
+
"loaded": false,
|
| 24 |
+
"reason": "resume disabled"
|
| 25 |
+
},
|
| 26 |
+
"step": 500,
|
| 27 |
+
"training_metrics": {
|
| 28 |
+
"current_lambda_zero_compute": 2.0,
|
| 29 |
+
"effective_batch_size": 16,
|
| 30 |
+
"entropy_loss": 4.538632531960806,
|
| 31 |
+
"entropy_term": 0.0,
|
| 32 |
+
"expert_usage_sample": [
|
| 33 |
+
1240.0,
|
| 34 |
+
2139.0,
|
| 35 |
+
1213.0,
|
| 36 |
+
793.0,
|
| 37 |
+
1992.0,
|
| 38 |
+
1957.0,
|
| 39 |
+
503.0,
|
| 40 |
+
1528.0,
|
| 41 |
+
1398.0,
|
| 42 |
+
2252.0,
|
| 43 |
+
1835.0,
|
| 44 |
+
1146.0,
|
| 45 |
+
1440.0,
|
| 46 |
+
1527.0,
|
| 47 |
+
1757.0,
|
| 48 |
+
803.0
|
| 49 |
+
],
|
| 50 |
+
"grad_norm": 70.5,
|
| 51 |
+
"gradient_accumulation_steps": 8,
|
| 52 |
+
"lambda_entropy": 0.0,
|
| 53 |
+
"lambda_router": 1.0,
|
| 54 |
+
"lambda_zero_compute": 2.0,
|
| 55 |
+
"loss": 2.327640622854233,
|
| 56 |
+
"micro_batch_size": 2,
|
| 57 |
+
"output_kl": 1.1904816403985023,
|
| 58 |
+
"output_kl_term": 1.1904816403985023,
|
| 59 |
+
"probe_output_kl": 1.1182771921157837,
|
| 60 |
+
"probe_router_entropy": 4.540449047088623,
|
| 61 |
+
"probe_router_kl": 0.051853783428668976,
|
| 62 |
+
"probe_same_expert_ratio": 0.8435872395833334,
|
| 63 |
+
"probe_zero_compute_loss": 0.5133160352706909,
|
| 64 |
+
"probe_zero_compute_margin_gap": 0.41453187317432216,
|
| 65 |
+
"probe_zero_compute_mass": 0.013335910812020301,
|
| 66 |
+
"probe_zero_compute_top1_ratio": 0.00654296875,
|
| 67 |
+
"probe_zero_compute_topk_ratio": 0.29026692708333335,
|
| 68 |
+
"router_entropy": 4.538632531960806,
|
| 69 |
+
"router_kl": 0.05338437343016267,
|
| 70 |
+
"router_kl_term": 0.05338437343016267,
|
| 71 |
+
"same_expert_ratio": 0.8424682617187501,
|
| 72 |
+
"step": 500,
|
| 73 |
+
"tokens_per_optimizer_step": 8192,
|
| 74 |
+
"zero_compute_loss": 0.5418873056769371,
|
| 75 |
+
"zero_compute_margin_gap": 0.4672557485134652,
|
| 76 |
+
"zero_compute_mass": 0.012517090452214084,
|
| 77 |
+
"zero_compute_ramp_steps": 50,
|
| 78 |
+
"zero_compute_term": 1.0837746113538742,
|
| 79 |
+
"zero_compute_top1_ratio": 0.00439453125,
|
| 80 |
+
"zero_compute_topk_margin": 0.0,
|
| 81 |
+
"zero_compute_topk_ratio": 0.24339599609374998,
|
| 82 |
+
"zero_compute_warmup_steps": 0,
|
| 83 |
+
"zero_expert_usage": 1080.0
|
| 84 |
+
}
|
| 85 |
+
},
|
| 86 |
+
"model_config": {
|
| 87 |
+
"add_zero_compute_expert": true,
|
| 88 |
+
"num_experts": 128,
|
| 89 |
+
"top_k_experts": 8,
|
| 90 |
+
"use_zero_compute_optimization": true
|
| 91 |
+
},
|
| 92 |
+
"num_router_keys": 90,
|
| 93 |
+
"router_keys_sample": [
|
| 94 |
+
"model.layers.0.router.per_expert_scale",
|
| 95 |
+
"model.layers.0.router.proj.weight",
|
| 96 |
+
"model.layers.0.router.scale",
|
| 97 |
+
"model.layers.1.router.per_expert_scale",
|
| 98 |
+
"model.layers.1.router.proj.weight",
|
| 99 |
+
"model.layers.1.router.scale",
|
| 100 |
+
"model.layers.10.router.per_expert_scale",
|
| 101 |
+
"model.layers.10.router.proj.weight",
|
| 102 |
+
"model.layers.10.router.scale",
|
| 103 |
+
"model.layers.11.router.per_expert_scale",
|
| 104 |
+
"model.layers.11.router.proj.weight",
|
| 105 |
+
"model.layers.11.router.scale"
|
| 106 |
+
],
|
| 107 |
+
"source_model_id": ""
|
| 108 |
+
},
|
| 109 |
+
"config_path": "/cache/router_artifacts/router_config.json",
|
| 110 |
+
"loaded": true,
|
| 111 |
+
"loaded_key_count": 90,
|
| 112 |
+
"loaded_keys_sample": [
|
| 113 |
+
"model.layers.0.router.per_expert_scale",
|
| 114 |
+
"model.layers.0.router.proj.weight",
|
| 115 |
+
"model.layers.0.router.scale",
|
| 116 |
+
"model.layers.1.router.per_expert_scale",
|
| 117 |
+
"model.layers.1.router.proj.weight",
|
| 118 |
+
"model.layers.1.router.scale",
|
| 119 |
+
"model.layers.10.router.per_expert_scale",
|
| 120 |
+
"model.layers.10.router.proj.weight",
|
| 121 |
+
"model.layers.10.router.scale",
|
| 122 |
+
"model.layers.11.router.per_expert_scale",
|
| 123 |
+
"model.layers.11.router.proj.weight",
|
| 124 |
+
"model.layers.11.router.scale"
|
| 125 |
+
],
|
| 126 |
+
"path": "/cache/router_artifacts/router_state_dict.pt"
|
| 127 |
+
},
|
| 128 |
+
"step": 100,
|
| 129 |
+
"training_metrics": {
|
| 130 |
+
"current_lambda_zero_compute": 3.0,
|
| 131 |
+
"effective_batch_size": 16,
|
| 132 |
+
"entropy_loss": 4.542559911807379,
|
| 133 |
+
"entropy_term": 0.0,
|
| 134 |
+
"expert_usage_sample": [
|
| 135 |
+
1239.0,
|
| 136 |
+
2070.0,
|
| 137 |
+
1500.0,
|
| 138 |
+
1201.0,
|
| 139 |
+
2009.0,
|
| 140 |
+
1821.0,
|
| 141 |
+
670.0,
|
| 142 |
+
1778.0,
|
| 143 |
+
1452.0,
|
| 144 |
+
2154.0,
|
| 145 |
+
2007.0,
|
| 146 |
+
980.0,
|
| 147 |
+
1320.0,
|
| 148 |
+
1568.0,
|
| 149 |
+
1522.0,
|
| 150 |
+
700.0
|
| 151 |
+
],
|
| 152 |
+
"grad_norm": 446.0,
|
| 153 |
+
"gradient_accumulation_steps": 8,
|
| 154 |
+
"lambda_entropy": 0.0,
|
| 155 |
+
"lambda_router": 1.0,
|
| 156 |
+
"lambda_zero_compute": 3.0,
|
| 157 |
+
"loss": 2.6639687418937683,
|
| 158 |
+
"micro_batch_size": 2,
|
| 159 |
+
"output_kl": 0.9797117039561272,
|
| 160 |
+
"output_kl_term": 0.9797117039561272,
|
| 161 |
+
"probe_output_kl": 1.0213916301727295,
|
| 162 |
+
"probe_router_entropy": 4.537958733240763,
|
| 163 |
+
"probe_router_kl": 0.05228007212281227,
|
| 164 |
+
"probe_same_expert_ratio": 0.8512044270833333,
|
| 165 |
+
"probe_zero_compute_loss": 0.5116603970527649,
|
| 166 |
+
"probe_zero_compute_margin_gap": 0.37900154244465134,
|
| 167 |
+
"probe_zero_compute_mass": 0.014502804105480513,
|
| 168 |
+
"probe_zero_compute_top1_ratio": 0.02294921875,
|
| 169 |
+
"probe_zero_compute_topk_ratio": 0.3021158854166667,
|
| 170 |
+
"router_entropy": 4.542559911807379,
|
| 171 |
+
"router_kl": 0.05281998496502638,
|
| 172 |
+
"router_kl_term": 0.05281998496502638,
|
| 173 |
+
"same_expert_ratio": 0.85335693359375,
|
| 174 |
+
"step": 100,
|
| 175 |
+
"tokens_per_optimizer_step": 8192,
|
| 176 |
+
"zero_compute_loss": 0.5438123419880867,
|
| 177 |
+
"zero_compute_margin_gap": 0.4289153911076331,
|
| 178 |
+
"zero_compute_mass": 0.013749805480862657,
|
| 179 |
+
"zero_compute_ramp_steps": 50,
|
| 180 |
+
"zero_compute_term": 1.6314370036125183,
|
| 181 |
+
"zero_compute_top1_ratio": 0.019120279947916666,
|
| 182 |
+
"zero_compute_topk_margin": 0.0,
|
| 183 |
+
"zero_compute_topk_ratio": 0.26689453125,
|
| 184 |
+
"zero_compute_warmup_steps": 0,
|
| 185 |
+
"zero_expert_usage": 4699.0
|
| 186 |
+
}
|
| 187 |
+
},
|
| 188 |
+
"model_config": {
|
| 189 |
+
"add_zero_compute_expert": true,
|
| 190 |
+
"num_experts": 128,
|
| 191 |
+
"top_k_experts": 8,
|
| 192 |
+
"use_zero_compute_optimization": true
|
| 193 |
+
},
|
| 194 |
+
"num_router_keys": 90,
|
| 195 |
+
"router_keys_sample": [
|
| 196 |
+
"model.layers.0.router.per_expert_scale",
|
| 197 |
+
"model.layers.0.router.proj.weight",
|
| 198 |
+
"model.layers.0.router.scale",
|
| 199 |
+
"model.layers.1.router.per_expert_scale",
|
| 200 |
+
"model.layers.1.router.proj.weight",
|
| 201 |
+
"model.layers.1.router.scale",
|
| 202 |
+
"model.layers.10.router.per_expert_scale",
|
| 203 |
+
"model.layers.10.router.proj.weight",
|
| 204 |
+
"model.layers.10.router.scale",
|
| 205 |
+
"model.layers.11.router.per_expert_scale",
|
| 206 |
+
"model.layers.11.router.proj.weight",
|
| 207 |
+
"model.layers.11.router.scale"
|
| 208 |
+
],
|
| 209 |
+
"source_model_id": ""
|
| 210 |
+
},
|
| 211 |
+
"config_path": "/cache/router_artifacts/router_config.json",
|
| 212 |
+
"loaded": true,
|
| 213 |
+
"loaded_key_count": 90,
|
| 214 |
+
"loaded_keys_sample": [
|
| 215 |
+
"model.layers.0.router.per_expert_scale",
|
| 216 |
+
"model.layers.0.router.proj.weight",
|
| 217 |
+
"model.layers.0.router.scale",
|
| 218 |
+
"model.layers.1.router.per_expert_scale",
|
| 219 |
+
"model.layers.1.router.proj.weight",
|
| 220 |
+
"model.layers.1.router.scale",
|
| 221 |
+
"model.layers.10.router.per_expert_scale",
|
| 222 |
+
"model.layers.10.router.proj.weight",
|
| 223 |
+
"model.layers.10.router.scale",
|
| 224 |
+
"model.layers.11.router.per_expert_scale",
|
| 225 |
+
"model.layers.11.router.proj.weight",
|
| 226 |
+
"model.layers.11.router.scale"
|
| 227 |
+
],
|
| 228 |
+
"path": "/cache/router_artifacts/router_state_dict.pt"
|
| 229 |
+
},
|
| 230 |
+
"step": 500,
|
| 231 |
+
"training_metrics": {
|
| 232 |
+
"current_lambda_zero_compute": 3.0,
|
| 233 |
+
"easy_token_ratio": 0.88720703125,
|
| 234 |
+
"effective_batch_size": 16,
|
| 235 |
+
"entropy_loss": 4.538989106814067,
|
| 236 |
+
"entropy_term": 0.009077978213628133,
|
| 237 |
+
"expert_usage_sample": [
|
| 238 |
+
1200.0,
|
| 239 |
+
2028.0,
|
| 240 |
+
1208.0,
|
| 241 |
+
783.0,
|
| 242 |
+
2040.0,
|
| 243 |
+
1847.0,
|
| 244 |
+
497.0,
|
| 245 |
+
1490.0,
|
| 246 |
+
1385.0,
|
| 247 |
+
2217.0,
|
| 248 |
+
1843.0,
|
| 249 |
+
1175.0,
|
| 250 |
+
1406.0,
|
| 251 |
+
1502.0,
|
| 252 |
+
1687.0,
|
| 253 |
+
771.0
|
| 254 |
+
],
|
| 255 |
+
"grad_norm": 204.0,
|
| 256 |
+
"gradient_accumulation_steps": 8,
|
| 257 |
+
"lambda_entropy": 0.002,
|
| 258 |
+
"lambda_router": 1.0,
|
| 259 |
+
"lambda_zero_compute": 3.0,
|
| 260 |
+
"loss": 2.76311457157135,
|
| 261 |
+
"micro_batch_size": 2,
|
| 262 |
+
"output_kl": 1.1192611530423164,
|
| 263 |
+
"output_kl_term": 1.1192611530423164,
|
| 264 |
+
"probe_easy_token_ratio": 0.9248046875,
|
| 265 |
+
"probe_output_kl": 1.1542232036590576,
|
| 266 |
+
"probe_router_entropy": 4.538172864913941,
|
| 267 |
+
"probe_router_kl": 0.0544092059135437,
|
| 268 |
+
"probe_same_expert_ratio": 0.8352864583333334,
|
| 269 |
+
"probe_teacher_confidence_mean": 0.6827144622802734,
|
| 270 |
+
"probe_zero_compute_loss": 0.5005475282669067,
|
| 271 |
+
"probe_zero_compute_margin_gap": 0.3712589807061819,
|
| 272 |
+
"probe_zero_compute_mass": 0.01432527024565543,
|
| 273 |
+
"probe_zero_compute_token_weight_mean": 0.6357069611549377,
|
| 274 |
+
"probe_zero_compute_top1_hits_actual": 568.0,
|
| 275 |
+
"probe_zero_compute_top1_ratio": 0.017643229166666666,
|
| 276 |
+
"probe_zero_compute_top1_ratio_actual": 0.018489583333333334,
|
| 277 |
+
"probe_zero_compute_topk_hits_actual": 10002.0,
|
| 278 |
+
"probe_zero_compute_topk_ratio": 0.31997760956028976,
|
| 279 |
+
"probe_zero_compute_topk_ratio_actual": 0.0406982421875,
|
| 280 |
+
"router_entropy": 4.538989106814067,
|
| 281 |
+
"router_kl": 0.054629013407975435,
|
| 282 |
+
"router_kl_term": 0.054629013407975435,
|
| 283 |
+
"same_expert_ratio": 0.8434204101562499,
|
| 284 |
+
"step": 500,
|
| 285 |
+
"teacher_confidence_mean": 0.6225322559475899,
|
| 286 |
+
"tokens_per_optimizer_step": 8192,
|
| 287 |
+
"zero_compute_loss": 0.5267154797911644,
|
| 288 |
+
"zero_compute_margin_gap": 0.418523011850672,
|
| 289 |
+
"zero_compute_mass": 0.01356517664706988,
|
| 290 |
+
"zero_compute_ramp_steps": 50,
|
| 291 |
+
"zero_compute_term": 1.5801464468240738,
|
| 292 |
+
"zero_compute_token_weight_mean": 0.5501668378710747,
|
| 293 |
+
"zero_compute_top1_hits_actual": 459.0,
|
| 294 |
+
"zero_compute_top1_ratio": 0.014103190104166665,
|
| 295 |
+
"zero_compute_top1_ratio_actual": 0.014941406249999997,
|
| 296 |
+
"zero_compute_topk_hits_actual": 8916.125,
|
| 297 |
+
"zero_compute_topk_margin": 0.0,
|
| 298 |
+
"zero_compute_topk_ratio": 0.27892842232367093,
|
| 299 |
+
"zero_compute_topk_ratio_actual": 0.03627980550130208,
|
| 300 |
+
"zero_compute_warmup_steps": 0,
|
| 301 |
+
"zero_expert_usage": 3466.0
|
| 302 |
+
}
|
| 303 |
+
},
|
| 304 |
+
"model_config": {
|
| 305 |
+
"add_zero_compute_expert": true,
|
| 306 |
+
"num_experts": 128,
|
| 307 |
+
"top_k_experts": 8,
|
| 308 |
+
"use_zero_compute_optimization": true
|
| 309 |
+
},
|
| 310 |
+
"num_router_keys": 90,
|
| 311 |
+
"router_keys_sample": [
|
| 312 |
+
"model.layers.0.router.per_expert_scale",
|
| 313 |
+
"model.layers.0.router.proj.weight",
|
| 314 |
+
"model.layers.0.router.scale",
|
| 315 |
+
"model.layers.1.router.per_expert_scale",
|
| 316 |
+
"model.layers.1.router.proj.weight",
|
| 317 |
+
"model.layers.1.router.scale",
|
| 318 |
+
"model.layers.10.router.per_expert_scale",
|
| 319 |
+
"model.layers.10.router.proj.weight",
|
| 320 |
+
"model.layers.10.router.scale",
|
| 321 |
+
"model.layers.11.router.per_expert_scale",
|
| 322 |
+
"model.layers.11.router.proj.weight",
|
| 323 |
+
"model.layers.11.router.scale"
|
| 324 |
+
],
|
| 325 |
+
"source_model_id": ""
|
| 326 |
+
},
|
| 327 |
+
"config_path": "/cache/router_artifacts/router_config.json",
|
| 328 |
+
"loaded": true,
|
| 329 |
+
"loaded_key_count": 90,
|
| 330 |
+
"loaded_keys_sample": [
|
| 331 |
+
"model.layers.0.router.per_expert_scale",
|
| 332 |
+
"model.layers.0.router.proj.weight",
|
| 333 |
+
"model.layers.0.router.scale",
|
| 334 |
+
"model.layers.1.router.per_expert_scale",
|
| 335 |
+
"model.layers.1.router.proj.weight",
|
| 336 |
+
"model.layers.1.router.scale",
|
| 337 |
+
"model.layers.10.router.per_expert_scale",
|
| 338 |
+
"model.layers.10.router.proj.weight",
|
| 339 |
+
"model.layers.10.router.scale",
|
| 340 |
+
"model.layers.11.router.per_expert_scale",
|
| 341 |
+
"model.layers.11.router.proj.weight",
|
| 342 |
+
"model.layers.11.router.scale"
|
| 343 |
+
],
|
| 344 |
+
"path": "/cache/router_artifacts/router_state_dict.pt"
|
| 345 |
+
},
|
| 346 |
+
"source_model_id": "google/gemma-4-26B-A4B-it",
|
| 347 |
+
"torch_dtype": "torch.bfloat16"
|
| 348 |
+
}
|
gemma4_optimization.py
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# gemma4_optimization.py
|
| 2 |
+
|
| 3 |
+
"""
|
| 4 |
+
Hayson Cheung, 2026, Oringinal Script written to optimize
|
| 5 |
+
Gemma4 on Hugging Face's Transformers library.
|
| 6 |
+
|
| 7 |
+
LICENSED UNDER THE MIT LICENSE.
|
| 8 |
+
|
| 9 |
+
This file contains optimized variants of Gemma4 text model components, including a mixin for remapping weights from original Gemma4 models to optimized versions. The optimizations include support for an additional zero-compute expert in the MoE router and experts, as well as adjustments to the router's projection and scaling parameters to accommodate the expanded expert set. The load_optimization_weights method enables loading weights from a base Gemma4 model while remapping tensors as needed for the optimized architecture.
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from __future__ import annotations
|
| 13 |
+
|
| 14 |
+
from dataclasses import dataclass
|
| 15 |
+
|
| 16 |
+
import torch
|
| 17 |
+
from torch import nn
|
| 18 |
+
|
| 19 |
+
from .modeling_gemma4 import (
|
| 20 |
+
Gemma4ForCausalLM,
|
| 21 |
+
Gemma4TextDecoderLayer,
|
| 22 |
+
Gemma4TextExperts,
|
| 23 |
+
Gemma4TextModel,
|
| 24 |
+
Gemma4TextRouter,
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
@dataclass(frozen=True)
|
| 29 |
+
class Gemma4OptimizationLoadResult:
|
| 30 |
+
loaded_keys: tuple[str, ...]
|
| 31 |
+
skipped_keys: tuple[str, ...]
|
| 32 |
+
|
| 33 |
+
@property
|
| 34 |
+
def loaded_count(self) -> int:
|
| 35 |
+
return len(self.loaded_keys)
|
| 36 |
+
|
| 37 |
+
@property
|
| 38 |
+
def skipped_count(self) -> int:
|
| 39 |
+
return len(self.skipped_keys)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class Gemma4OptimizationWeightsMixin:
|
| 43 |
+
"""
|
| 44 |
+
Mixin for modules that need a custom remount step when loading weights
|
| 45 |
+
from an original Gemma4 model into an optimized variant.
|
| 46 |
+
"""
|
| 47 |
+
|
| 48 |
+
def _remap_optimization_tensors(
|
| 49 |
+
self,
|
| 50 |
+
base_state_dict: dict[str, torch.Tensor],
|
| 51 |
+
target_state_dict: dict[str, torch.Tensor],
|
| 52 |
+
) -> dict[str, torch.Tensor]:
|
| 53 |
+
return {}
|
| 54 |
+
|
| 55 |
+
def load_optimization_weights(self, base_model: nn.Module) -> Gemma4OptimizationLoadResult:
|
| 56 |
+
if not isinstance(self, nn.Module):
|
| 57 |
+
raise TypeError("Gemma4OptimizationWeightsMixin can only be used with nn.Module subclasses.")
|
| 58 |
+
if not isinstance(base_model, nn.Module):
|
| 59 |
+
raise TypeError("base_model must be an nn.Module.")
|
| 60 |
+
|
| 61 |
+
target_state_dict = self.state_dict()
|
| 62 |
+
loaded: dict[str, torch.Tensor] = {}
|
| 63 |
+
|
| 64 |
+
for module_name, module in self.named_modules():
|
| 65 |
+
if not isinstance(module, Gemma4OptimizationWeightsMixin):
|
| 66 |
+
continue
|
| 67 |
+
|
| 68 |
+
try:
|
| 69 |
+
base_module = base_model if module_name == "" else base_model.get_submodule(module_name)
|
| 70 |
+
except AttributeError:
|
| 71 |
+
continue
|
| 72 |
+
|
| 73 |
+
remapped_tensors = module._remap_optimization_tensors(base_module.state_dict(), module.state_dict())
|
| 74 |
+
for tensor_name, tensor_value in remapped_tensors.items():
|
| 75 |
+
full_name = f"{module_name}.{tensor_name}" if module_name else tensor_name
|
| 76 |
+
loaded[full_name] = tensor_value.to(
|
| 77 |
+
device=target_state_dict[full_name].device,
|
| 78 |
+
dtype=target_state_dict[full_name].dtype,
|
| 79 |
+
)
|
| 80 |
+
|
| 81 |
+
for tensor_name, tensor_value in base_model.state_dict().items():
|
| 82 |
+
if tensor_name in loaded:
|
| 83 |
+
continue
|
| 84 |
+
target_tensor = target_state_dict.get(tensor_name)
|
| 85 |
+
if target_tensor is None or target_tensor.shape != tensor_value.shape:
|
| 86 |
+
continue
|
| 87 |
+
loaded[tensor_name] = tensor_value.to(device=target_tensor.device, dtype=target_tensor.dtype)
|
| 88 |
+
|
| 89 |
+
self.load_state_dict(loaded, strict=False)
|
| 90 |
+
|
| 91 |
+
skipped = tuple(sorted(set(base_model.state_dict()) - set(loaded)))
|
| 92 |
+
return Gemma4OptimizationLoadResult(tuple(sorted(loaded)), skipped)
|
| 93 |
+
|
| 94 |
+
def _load_weights(self, base_model: nn.Module) -> Gemma4OptimizationLoadResult:
|
| 95 |
+
return self.load_optimization_weights(base_model)
|
| 96 |
+
|
| 97 |
+
|
| 98 |
+
def get_total_optimized_experts(num_experts: int, add_zero_compute_expert: bool) -> int:
|
| 99 |
+
return num_experts + int(add_zero_compute_expert)
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
class OptimizedGemma4TextExperts(Gemma4TextExperts):
|
| 103 |
+
def __init__(self, config):
|
| 104 |
+
super().__init__(config)
|
| 105 |
+
self.total_num_experts = get_total_optimized_experts(
|
| 106 |
+
self.num_experts, getattr(config, "add_zero_compute_expert", False)
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
def forward(
|
| 110 |
+
self,
|
| 111 |
+
hidden_states: torch.Tensor,
|
| 112 |
+
top_k_index: torch.Tensor,
|
| 113 |
+
top_k_weights: torch.Tensor,
|
| 114 |
+
) -> torch.Tensor:
|
| 115 |
+
final_hidden_states = torch.zeros_like(hidden_states)
|
| 116 |
+
with torch.no_grad():
|
| 117 |
+
expert_mask = torch.nn.functional.one_hot(top_k_index, num_classes=self.total_num_experts)
|
| 118 |
+
expert_mask = expert_mask.permute(2, 1, 0)
|
| 119 |
+
expert_hit = torch.greater(expert_mask.sum(dim=(-1, -2)), 0).nonzero()
|
| 120 |
+
|
| 121 |
+
for expert_idx in expert_hit:
|
| 122 |
+
expert_idx = expert_idx[0]
|
| 123 |
+
if expert_idx >= self.num_experts:
|
| 124 |
+
continue
|
| 125 |
+
top_k_pos, token_idx = torch.where(expert_mask[expert_idx])
|
| 126 |
+
current_state = hidden_states[token_idx]
|
| 127 |
+
gate, up = nn.functional.linear(current_state, self.gate_up_proj[expert_idx]).chunk(2, dim=-1)
|
| 128 |
+
current_hidden_states = self.act_fn(gate) * up
|
| 129 |
+
current_hidden_states = nn.functional.linear(current_hidden_states, self.down_proj[expert_idx])
|
| 130 |
+
current_hidden_states = current_hidden_states * top_k_weights[token_idx, top_k_pos, None]
|
| 131 |
+
final_hidden_states.index_add_(0, token_idx, current_hidden_states.to(final_hidden_states.dtype))
|
| 132 |
+
|
| 133 |
+
return final_hidden_states
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
class OptimizedGemma4TextRouter(Gemma4OptimizationWeightsMixin, Gemma4TextRouter):
|
| 137 |
+
def __init__(self, config):
|
| 138 |
+
super().__init__(config)
|
| 139 |
+
self.num_experts = config.num_experts
|
| 140 |
+
self.total_num_experts = get_total_optimized_experts(
|
| 141 |
+
self.num_experts, getattr(config, "add_zero_compute_expert", False)
|
| 142 |
+
)
|
| 143 |
+
self.proj = nn.Linear(config.hidden_size, self.total_num_experts, bias=False)
|
| 144 |
+
self.per_expert_scale = nn.Parameter(torch.ones(self.total_num_experts))
|
| 145 |
+
|
| 146 |
+
def _remap_optimization_tensors(
|
| 147 |
+
self,
|
| 148 |
+
base_state_dict: dict[str, torch.Tensor],
|
| 149 |
+
target_state_dict: dict[str, torch.Tensor],
|
| 150 |
+
) -> dict[str, torch.Tensor]:
|
| 151 |
+
remapped: dict[str, torch.Tensor] = {}
|
| 152 |
+
|
| 153 |
+
base_proj = base_state_dict.get("proj.weight")
|
| 154 |
+
target_proj = target_state_dict.get("proj.weight")
|
| 155 |
+
if (
|
| 156 |
+
base_proj is not None
|
| 157 |
+
and target_proj is not None
|
| 158 |
+
and target_proj.shape[1] == base_proj.shape[1]
|
| 159 |
+
and target_proj.shape[0] == base_proj.shape[0] + 1
|
| 160 |
+
):
|
| 161 |
+
expanded_proj = target_proj.clone()
|
| 162 |
+
expanded_proj.zero_()
|
| 163 |
+
expanded_proj[: base_proj.shape[0]].copy_(base_proj)
|
| 164 |
+
remapped["proj.weight"] = expanded_proj
|
| 165 |
+
|
| 166 |
+
base_per_expert_scale = base_state_dict.get("per_expert_scale")
|
| 167 |
+
target_per_expert_scale = target_state_dict.get("per_expert_scale")
|
| 168 |
+
if (
|
| 169 |
+
base_per_expert_scale is not None
|
| 170 |
+
and target_per_expert_scale is not None
|
| 171 |
+
and target_per_expert_scale.shape[0] == base_per_expert_scale.shape[0] + 1
|
| 172 |
+
):
|
| 173 |
+
expanded_per_expert_scale = target_per_expert_scale.clone()
|
| 174 |
+
expanded_per_expert_scale.fill_(1.0)
|
| 175 |
+
expanded_per_expert_scale[: base_per_expert_scale.shape[0]].copy_(base_per_expert_scale)
|
| 176 |
+
remapped["per_expert_scale"] = expanded_per_expert_scale
|
| 177 |
+
|
| 178 |
+
return remapped
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
class OptimizedGemma4TextDecoderLayer(Gemma4TextDecoderLayer):
|
| 182 |
+
router_class = OptimizedGemma4TextRouter
|
| 183 |
+
experts_class = OptimizedGemma4TextExperts
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
class OptimizedGemma4TextModel(Gemma4OptimizationWeightsMixin, Gemma4TextModel):
|
| 187 |
+
decoder_layer_class = OptimizedGemma4TextDecoderLayer
|
| 188 |
+
|
| 189 |
+
|
| 190 |
+
class OptimizedGemma4ForCausalLM(Gemma4OptimizationWeightsMixin, Gemma4ForCausalLM):
|
| 191 |
+
text_model_class = OptimizedGemma4TextModel
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
__all__ = [
|
| 195 |
+
"Gemma4OptimizationLoadResult",
|
| 196 |
+
"Gemma4OptimizationWeightsMixin",
|
| 197 |
+
"OptimizedGemma4ForCausalLM",
|
| 198 |
+
"OptimizedGemma4TextDecoderLayer",
|
| 199 |
+
"OptimizedGemma4TextExperts",
|
| 200 |
+
"OptimizedGemma4TextModel",
|
| 201 |
+
"OptimizedGemma4TextRouter",
|
| 202 |
+
"get_total_optimized_experts",
|
| 203 |
+
]
|
generation_config.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 2,
|
| 4 |
+
"eos_token_id": 1,
|
| 5 |
+
"output_attentions": false,
|
| 6 |
+
"output_hidden_states": false,
|
| 7 |
+
"pad_token_id": 0,
|
| 8 |
+
"transformers_version": "5.5.3",
|
| 9 |
+
"use_cache": true
|
| 10 |
+
}
|
model-00001-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d3439313309f3d3a25d6f24c8d91c444f86f21b3c3def0b6c122cf722858ec4f
|
| 3 |
+
size 4838439644
|
model-00002-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ffad46c8227677da8b448b548da345e8151c6f320f4f79a378db0f012282f41f
|
| 3 |
+
size 4913431124
|
model-00003-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bb8becf37055a085fa3aa38beac7585ee3f3106451f3f7ee8944bd3e19468800
|
| 3 |
+
size 4884594380
|
model-00004-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:806b09e6afa1fa84cb2e9e77f2627991ac8279785ad48da03620d9b2bf37e39d
|
| 3 |
+
size 4913431164
|
model-00005-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f66e5b58eb65af1d13e440580fe6dc696988604ca60cf3d082f12bf5caa86c56
|
| 3 |
+
size 4884594444
|
model-00006-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:05ee10d6a8c3f74c1db8519a8089ba4871335f8fc0ffc196525c35e1a85d558d
|
| 3 |
+
size 4913431196
|
model-00007-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d94e9293dd7099334cb7a72c2a529d82559d87bde5298e95dd36048c8fd9b85e
|
| 3 |
+
size 4884594444
|
model-00008-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7e139cbd5b61c7506513cd1fba878ae2a3738e84121438b1042865516c956608
|
| 3 |
+
size 4913431196
|
model-00009-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7c7e39645e9d4608d84b2327d9fb59d635d8d23201b62296572523016ddedb8a
|
| 3 |
+
size 4884594444
|
model-00010-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:52cc2118792e66eca31769eeffff2ccce8e9659f5f7c83bc9a09c6c3c4de727f
|
| 3 |
+
size 4913431196
|
model-00011-of-00011.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d4574aeba49be3a8ebf26e718af8fd27ff0f1537ea47df763f03d74230fda7b1
|
| 3 |
+
size 2998950720
|
model.safetensors.index.json
ADDED
|
@@ -0,0 +1,666 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"metadata": {
|
| 3 |
+
"total_parameters": 25971423774,
|
| 4 |
+
"total_size": 51942847608
|
| 5 |
+
},
|
| 6 |
+
"weight_map": {
|
| 7 |
+
"lm_head.weight": "model-00011-of-00011.safetensors",
|
| 8 |
+
"model.embed_tokens.weight": "model-00001-of-00011.safetensors",
|
| 9 |
+
"model.layers.0.experts.down_proj": "model-00001-of-00011.safetensors",
|
| 10 |
+
"model.layers.0.experts.gate_up_proj": "model-00001-of-00011.safetensors",
|
| 11 |
+
"model.layers.0.input_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 12 |
+
"model.layers.0.layer_scalar": "model-00001-of-00011.safetensors",
|
| 13 |
+
"model.layers.0.mlp.down_proj.weight": "model-00001-of-00011.safetensors",
|
| 14 |
+
"model.layers.0.mlp.gate_proj.weight": "model-00001-of-00011.safetensors",
|
| 15 |
+
"model.layers.0.mlp.up_proj.weight": "model-00001-of-00011.safetensors",
|
| 16 |
+
"model.layers.0.post_attention_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 17 |
+
"model.layers.0.post_feedforward_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 18 |
+
"model.layers.0.post_feedforward_layernorm_1.weight": "model-00001-of-00011.safetensors",
|
| 19 |
+
"model.layers.0.post_feedforward_layernorm_2.weight": "model-00001-of-00011.safetensors",
|
| 20 |
+
"model.layers.0.pre_feedforward_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 21 |
+
"model.layers.0.pre_feedforward_layernorm_2.weight": "model-00001-of-00011.safetensors",
|
| 22 |
+
"model.layers.0.router.per_expert_scale": "model-00001-of-00011.safetensors",
|
| 23 |
+
"model.layers.0.router.proj.weight": "model-00001-of-00011.safetensors",
|
| 24 |
+
"model.layers.0.router.scale": "model-00001-of-00011.safetensors",
|
| 25 |
+
"model.layers.0.self_attn.k_norm.weight": "model-00001-of-00011.safetensors",
|
| 26 |
+
"model.layers.0.self_attn.k_proj.weight": "model-00001-of-00011.safetensors",
|
| 27 |
+
"model.layers.0.self_attn.o_proj.weight": "model-00001-of-00011.safetensors",
|
| 28 |
+
"model.layers.0.self_attn.q_norm.weight": "model-00001-of-00011.safetensors",
|
| 29 |
+
"model.layers.0.self_attn.q_proj.weight": "model-00001-of-00011.safetensors",
|
| 30 |
+
"model.layers.0.self_attn.v_proj.weight": "model-00001-of-00011.safetensors",
|
| 31 |
+
"model.layers.1.experts.down_proj": "model-00001-of-00011.safetensors",
|
| 32 |
+
"model.layers.1.experts.gate_up_proj": "model-00001-of-00011.safetensors",
|
| 33 |
+
"model.layers.1.input_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 34 |
+
"model.layers.1.layer_scalar": "model-00001-of-00011.safetensors",
|
| 35 |
+
"model.layers.1.mlp.down_proj.weight": "model-00001-of-00011.safetensors",
|
| 36 |
+
"model.layers.1.mlp.gate_proj.weight": "model-00001-of-00011.safetensors",
|
| 37 |
+
"model.layers.1.mlp.up_proj.weight": "model-00001-of-00011.safetensors",
|
| 38 |
+
"model.layers.1.post_attention_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 39 |
+
"model.layers.1.post_feedforward_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 40 |
+
"model.layers.1.post_feedforward_layernorm_1.weight": "model-00001-of-00011.safetensors",
|
| 41 |
+
"model.layers.1.post_feedforward_layernorm_2.weight": "model-00001-of-00011.safetensors",
|
| 42 |
+
"model.layers.1.pre_feedforward_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 43 |
+
"model.layers.1.pre_feedforward_layernorm_2.weight": "model-00001-of-00011.safetensors",
|
| 44 |
+
"model.layers.1.router.per_expert_scale": "model-00001-of-00011.safetensors",
|
| 45 |
+
"model.layers.1.router.proj.weight": "model-00001-of-00011.safetensors",
|
| 46 |
+
"model.layers.1.router.scale": "model-00001-of-00011.safetensors",
|
| 47 |
+
"model.layers.1.self_attn.k_norm.weight": "model-00001-of-00011.safetensors",
|
| 48 |
+
"model.layers.1.self_attn.k_proj.weight": "model-00001-of-00011.safetensors",
|
| 49 |
+
"model.layers.1.self_attn.o_proj.weight": "model-00001-of-00011.safetensors",
|
| 50 |
+
"model.layers.1.self_attn.q_norm.weight": "model-00001-of-00011.safetensors",
|
| 51 |
+
"model.layers.1.self_attn.q_proj.weight": "model-00001-of-00011.safetensors",
|
| 52 |
+
"model.layers.1.self_attn.v_proj.weight": "model-00001-of-00011.safetensors",
|
| 53 |
+
"model.layers.10.experts.down_proj": "model-00004-of-00011.safetensors",
|
| 54 |
+
"model.layers.10.experts.gate_up_proj": "model-00004-of-00011.safetensors",
|
| 55 |
+
"model.layers.10.input_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 56 |
+
"model.layers.10.layer_scalar": "model-00004-of-00011.safetensors",
|
| 57 |
+
"model.layers.10.mlp.down_proj.weight": "model-00004-of-00011.safetensors",
|
| 58 |
+
"model.layers.10.mlp.gate_proj.weight": "model-00004-of-00011.safetensors",
|
| 59 |
+
"model.layers.10.mlp.up_proj.weight": "model-00004-of-00011.safetensors",
|
| 60 |
+
"model.layers.10.post_attention_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 61 |
+
"model.layers.10.post_feedforward_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 62 |
+
"model.layers.10.post_feedforward_layernorm_1.weight": "model-00004-of-00011.safetensors",
|
| 63 |
+
"model.layers.10.post_feedforward_layernorm_2.weight": "model-00004-of-00011.safetensors",
|
| 64 |
+
"model.layers.10.pre_feedforward_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 65 |
+
"model.layers.10.pre_feedforward_layernorm_2.weight": "model-00004-of-00011.safetensors",
|
| 66 |
+
"model.layers.10.router.per_expert_scale": "model-00004-of-00011.safetensors",
|
| 67 |
+
"model.layers.10.router.proj.weight": "model-00004-of-00011.safetensors",
|
| 68 |
+
"model.layers.10.router.scale": "model-00004-of-00011.safetensors",
|
| 69 |
+
"model.layers.10.self_attn.k_norm.weight": "model-00004-of-00011.safetensors",
|
| 70 |
+
"model.layers.10.self_attn.k_proj.weight": "model-00004-of-00011.safetensors",
|
| 71 |
+
"model.layers.10.self_attn.o_proj.weight": "model-00004-of-00011.safetensors",
|
| 72 |
+
"model.layers.10.self_attn.q_norm.weight": "model-00004-of-00011.safetensors",
|
| 73 |
+
"model.layers.10.self_attn.q_proj.weight": "model-00004-of-00011.safetensors",
|
| 74 |
+
"model.layers.10.self_attn.v_proj.weight": "model-00004-of-00011.safetensors",
|
| 75 |
+
"model.layers.11.experts.down_proj": "model-00005-of-00011.safetensors",
|
| 76 |
+
"model.layers.11.experts.gate_up_proj": "model-00005-of-00011.safetensors",
|
| 77 |
+
"model.layers.11.input_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 78 |
+
"model.layers.11.layer_scalar": "model-00004-of-00011.safetensors",
|
| 79 |
+
"model.layers.11.mlp.down_proj.weight": "model-00004-of-00011.safetensors",
|
| 80 |
+
"model.layers.11.mlp.gate_proj.weight": "model-00004-of-00011.safetensors",
|
| 81 |
+
"model.layers.11.mlp.up_proj.weight": "model-00004-of-00011.safetensors",
|
| 82 |
+
"model.layers.11.post_attention_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 83 |
+
"model.layers.11.post_feedforward_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 84 |
+
"model.layers.11.post_feedforward_layernorm_1.weight": "model-00005-of-00011.safetensors",
|
| 85 |
+
"model.layers.11.post_feedforward_layernorm_2.weight": "model-00005-of-00011.safetensors",
|
| 86 |
+
"model.layers.11.pre_feedforward_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 87 |
+
"model.layers.11.pre_feedforward_layernorm_2.weight": "model-00005-of-00011.safetensors",
|
| 88 |
+
"model.layers.11.router.per_expert_scale": "model-00004-of-00011.safetensors",
|
| 89 |
+
"model.layers.11.router.proj.weight": "model-00004-of-00011.safetensors",
|
| 90 |
+
"model.layers.11.router.scale": "model-00004-of-00011.safetensors",
|
| 91 |
+
"model.layers.11.self_attn.k_norm.weight": "model-00004-of-00011.safetensors",
|
| 92 |
+
"model.layers.11.self_attn.k_proj.weight": "model-00004-of-00011.safetensors",
|
| 93 |
+
"model.layers.11.self_attn.o_proj.weight": "model-00004-of-00011.safetensors",
|
| 94 |
+
"model.layers.11.self_attn.q_norm.weight": "model-00004-of-00011.safetensors",
|
| 95 |
+
"model.layers.11.self_attn.q_proj.weight": "model-00004-of-00011.safetensors",
|
| 96 |
+
"model.layers.12.experts.down_proj": "model-00005-of-00011.safetensors",
|
| 97 |
+
"model.layers.12.experts.gate_up_proj": "model-00005-of-00011.safetensors",
|
| 98 |
+
"model.layers.12.input_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 99 |
+
"model.layers.12.layer_scalar": "model-00005-of-00011.safetensors",
|
| 100 |
+
"model.layers.12.mlp.down_proj.weight": "model-00005-of-00011.safetensors",
|
| 101 |
+
"model.layers.12.mlp.gate_proj.weight": "model-00005-of-00011.safetensors",
|
| 102 |
+
"model.layers.12.mlp.up_proj.weight": "model-00005-of-00011.safetensors",
|
| 103 |
+
"model.layers.12.post_attention_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 104 |
+
"model.layers.12.post_feedforward_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 105 |
+
"model.layers.12.post_feedforward_layernorm_1.weight": "model-00005-of-00011.safetensors",
|
| 106 |
+
"model.layers.12.post_feedforward_layernorm_2.weight": "model-00005-of-00011.safetensors",
|
| 107 |
+
"model.layers.12.pre_feedforward_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 108 |
+
"model.layers.12.pre_feedforward_layernorm_2.weight": "model-00005-of-00011.safetensors",
|
| 109 |
+
"model.layers.12.router.per_expert_scale": "model-00005-of-00011.safetensors",
|
| 110 |
+
"model.layers.12.router.proj.weight": "model-00005-of-00011.safetensors",
|
| 111 |
+
"model.layers.12.router.scale": "model-00005-of-00011.safetensors",
|
| 112 |
+
"model.layers.12.self_attn.k_norm.weight": "model-00005-of-00011.safetensors",
|
| 113 |
+
"model.layers.12.self_attn.k_proj.weight": "model-00005-of-00011.safetensors",
|
| 114 |
+
"model.layers.12.self_attn.o_proj.weight": "model-00005-of-00011.safetensors",
|
| 115 |
+
"model.layers.12.self_attn.q_norm.weight": "model-00005-of-00011.safetensors",
|
| 116 |
+
"model.layers.12.self_attn.q_proj.weight": "model-00005-of-00011.safetensors",
|
| 117 |
+
"model.layers.12.self_attn.v_proj.weight": "model-00005-of-00011.safetensors",
|
| 118 |
+
"model.layers.13.experts.down_proj": "model-00005-of-00011.safetensors",
|
| 119 |
+
"model.layers.13.experts.gate_up_proj": "model-00005-of-00011.safetensors",
|
| 120 |
+
"model.layers.13.input_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 121 |
+
"model.layers.13.layer_scalar": "model-00005-of-00011.safetensors",
|
| 122 |
+
"model.layers.13.mlp.down_proj.weight": "model-00005-of-00011.safetensors",
|
| 123 |
+
"model.layers.13.mlp.gate_proj.weight": "model-00005-of-00011.safetensors",
|
| 124 |
+
"model.layers.13.mlp.up_proj.weight": "model-00005-of-00011.safetensors",
|
| 125 |
+
"model.layers.13.post_attention_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 126 |
+
"model.layers.13.post_feedforward_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 127 |
+
"model.layers.13.post_feedforward_layernorm_1.weight": "model-00005-of-00011.safetensors",
|
| 128 |
+
"model.layers.13.post_feedforward_layernorm_2.weight": "model-00005-of-00011.safetensors",
|
| 129 |
+
"model.layers.13.pre_feedforward_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 130 |
+
"model.layers.13.pre_feedforward_layernorm_2.weight": "model-00005-of-00011.safetensors",
|
| 131 |
+
"model.layers.13.router.per_expert_scale": "model-00005-of-00011.safetensors",
|
| 132 |
+
"model.layers.13.router.proj.weight": "model-00005-of-00011.safetensors",
|
| 133 |
+
"model.layers.13.router.scale": "model-00005-of-00011.safetensors",
|
| 134 |
+
"model.layers.13.self_attn.k_norm.weight": "model-00005-of-00011.safetensors",
|
| 135 |
+
"model.layers.13.self_attn.k_proj.weight": "model-00005-of-00011.safetensors",
|
| 136 |
+
"model.layers.13.self_attn.o_proj.weight": "model-00005-of-00011.safetensors",
|
| 137 |
+
"model.layers.13.self_attn.q_norm.weight": "model-00005-of-00011.safetensors",
|
| 138 |
+
"model.layers.13.self_attn.q_proj.weight": "model-00005-of-00011.safetensors",
|
| 139 |
+
"model.layers.13.self_attn.v_proj.weight": "model-00005-of-00011.safetensors",
|
| 140 |
+
"model.layers.14.experts.down_proj": "model-00006-of-00011.safetensors",
|
| 141 |
+
"model.layers.14.experts.gate_up_proj": "model-00006-of-00011.safetensors",
|
| 142 |
+
"model.layers.14.input_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 143 |
+
"model.layers.14.layer_scalar": "model-00005-of-00011.safetensors",
|
| 144 |
+
"model.layers.14.mlp.down_proj.weight": "model-00005-of-00011.safetensors",
|
| 145 |
+
"model.layers.14.mlp.gate_proj.weight": "model-00005-of-00011.safetensors",
|
| 146 |
+
"model.layers.14.mlp.up_proj.weight": "model-00005-of-00011.safetensors",
|
| 147 |
+
"model.layers.14.post_attention_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 148 |
+
"model.layers.14.post_feedforward_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 149 |
+
"model.layers.14.post_feedforward_layernorm_1.weight": "model-00006-of-00011.safetensors",
|
| 150 |
+
"model.layers.14.post_feedforward_layernorm_2.weight": "model-00006-of-00011.safetensors",
|
| 151 |
+
"model.layers.14.pre_feedforward_layernorm.weight": "model-00005-of-00011.safetensors",
|
| 152 |
+
"model.layers.14.pre_feedforward_layernorm_2.weight": "model-00006-of-00011.safetensors",
|
| 153 |
+
"model.layers.14.router.per_expert_scale": "model-00005-of-00011.safetensors",
|
| 154 |
+
"model.layers.14.router.proj.weight": "model-00005-of-00011.safetensors",
|
| 155 |
+
"model.layers.14.router.scale": "model-00005-of-00011.safetensors",
|
| 156 |
+
"model.layers.14.self_attn.k_norm.weight": "model-00005-of-00011.safetensors",
|
| 157 |
+
"model.layers.14.self_attn.k_proj.weight": "model-00005-of-00011.safetensors",
|
| 158 |
+
"model.layers.14.self_attn.o_proj.weight": "model-00005-of-00011.safetensors",
|
| 159 |
+
"model.layers.14.self_attn.q_norm.weight": "model-00005-of-00011.safetensors",
|
| 160 |
+
"model.layers.14.self_attn.q_proj.weight": "model-00005-of-00011.safetensors",
|
| 161 |
+
"model.layers.14.self_attn.v_proj.weight": "model-00005-of-00011.safetensors",
|
| 162 |
+
"model.layers.15.experts.down_proj": "model-00006-of-00011.safetensors",
|
| 163 |
+
"model.layers.15.experts.gate_up_proj": "model-00006-of-00011.safetensors",
|
| 164 |
+
"model.layers.15.input_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 165 |
+
"model.layers.15.layer_scalar": "model-00006-of-00011.safetensors",
|
| 166 |
+
"model.layers.15.mlp.down_proj.weight": "model-00006-of-00011.safetensors",
|
| 167 |
+
"model.layers.15.mlp.gate_proj.weight": "model-00006-of-00011.safetensors",
|
| 168 |
+
"model.layers.15.mlp.up_proj.weight": "model-00006-of-00011.safetensors",
|
| 169 |
+
"model.layers.15.post_attention_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 170 |
+
"model.layers.15.post_feedforward_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 171 |
+
"model.layers.15.post_feedforward_layernorm_1.weight": "model-00006-of-00011.safetensors",
|
| 172 |
+
"model.layers.15.post_feedforward_layernorm_2.weight": "model-00006-of-00011.safetensors",
|
| 173 |
+
"model.layers.15.pre_feedforward_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 174 |
+
"model.layers.15.pre_feedforward_layernorm_2.weight": "model-00006-of-00011.safetensors",
|
| 175 |
+
"model.layers.15.router.per_expert_scale": "model-00006-of-00011.safetensors",
|
| 176 |
+
"model.layers.15.router.proj.weight": "model-00006-of-00011.safetensors",
|
| 177 |
+
"model.layers.15.router.scale": "model-00006-of-00011.safetensors",
|
| 178 |
+
"model.layers.15.self_attn.k_norm.weight": "model-00006-of-00011.safetensors",
|
| 179 |
+
"model.layers.15.self_attn.k_proj.weight": "model-00006-of-00011.safetensors",
|
| 180 |
+
"model.layers.15.self_attn.o_proj.weight": "model-00006-of-00011.safetensors",
|
| 181 |
+
"model.layers.15.self_attn.q_norm.weight": "model-00006-of-00011.safetensors",
|
| 182 |
+
"model.layers.15.self_attn.q_proj.weight": "model-00006-of-00011.safetensors",
|
| 183 |
+
"model.layers.15.self_attn.v_proj.weight": "model-00006-of-00011.safetensors",
|
| 184 |
+
"model.layers.16.experts.down_proj": "model-00006-of-00011.safetensors",
|
| 185 |
+
"model.layers.16.experts.gate_up_proj": "model-00006-of-00011.safetensors",
|
| 186 |
+
"model.layers.16.input_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 187 |
+
"model.layers.16.layer_scalar": "model-00006-of-00011.safetensors",
|
| 188 |
+
"model.layers.16.mlp.down_proj.weight": "model-00006-of-00011.safetensors",
|
| 189 |
+
"model.layers.16.mlp.gate_proj.weight": "model-00006-of-00011.safetensors",
|
| 190 |
+
"model.layers.16.mlp.up_proj.weight": "model-00006-of-00011.safetensors",
|
| 191 |
+
"model.layers.16.post_attention_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 192 |
+
"model.layers.16.post_feedforward_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 193 |
+
"model.layers.16.post_feedforward_layernorm_1.weight": "model-00006-of-00011.safetensors",
|
| 194 |
+
"model.layers.16.post_feedforward_layernorm_2.weight": "model-00006-of-00011.safetensors",
|
| 195 |
+
"model.layers.16.pre_feedforward_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 196 |
+
"model.layers.16.pre_feedforward_layernorm_2.weight": "model-00006-of-00011.safetensors",
|
| 197 |
+
"model.layers.16.router.per_expert_scale": "model-00006-of-00011.safetensors",
|
| 198 |
+
"model.layers.16.router.proj.weight": "model-00006-of-00011.safetensors",
|
| 199 |
+
"model.layers.16.router.scale": "model-00006-of-00011.safetensors",
|
| 200 |
+
"model.layers.16.self_attn.k_norm.weight": "model-00006-of-00011.safetensors",
|
| 201 |
+
"model.layers.16.self_attn.k_proj.weight": "model-00006-of-00011.safetensors",
|
| 202 |
+
"model.layers.16.self_attn.o_proj.weight": "model-00006-of-00011.safetensors",
|
| 203 |
+
"model.layers.16.self_attn.q_norm.weight": "model-00006-of-00011.safetensors",
|
| 204 |
+
"model.layers.16.self_attn.q_proj.weight": "model-00006-of-00011.safetensors",
|
| 205 |
+
"model.layers.16.self_attn.v_proj.weight": "model-00006-of-00011.safetensors",
|
| 206 |
+
"model.layers.17.experts.down_proj": "model-00007-of-00011.safetensors",
|
| 207 |
+
"model.layers.17.experts.gate_up_proj": "model-00007-of-00011.safetensors",
|
| 208 |
+
"model.layers.17.input_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 209 |
+
"model.layers.17.layer_scalar": "model-00006-of-00011.safetensors",
|
| 210 |
+
"model.layers.17.mlp.down_proj.weight": "model-00006-of-00011.safetensors",
|
| 211 |
+
"model.layers.17.mlp.gate_proj.weight": "model-00006-of-00011.safetensors",
|
| 212 |
+
"model.layers.17.mlp.up_proj.weight": "model-00006-of-00011.safetensors",
|
| 213 |
+
"model.layers.17.post_attention_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 214 |
+
"model.layers.17.post_feedforward_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 215 |
+
"model.layers.17.post_feedforward_layernorm_1.weight": "model-00007-of-00011.safetensors",
|
| 216 |
+
"model.layers.17.post_feedforward_layernorm_2.weight": "model-00007-of-00011.safetensors",
|
| 217 |
+
"model.layers.17.pre_feedforward_layernorm.weight": "model-00006-of-00011.safetensors",
|
| 218 |
+
"model.layers.17.pre_feedforward_layernorm_2.weight": "model-00007-of-00011.safetensors",
|
| 219 |
+
"model.layers.17.router.per_expert_scale": "model-00006-of-00011.safetensors",
|
| 220 |
+
"model.layers.17.router.proj.weight": "model-00006-of-00011.safetensors",
|
| 221 |
+
"model.layers.17.router.scale": "model-00006-of-00011.safetensors",
|
| 222 |
+
"model.layers.17.self_attn.k_norm.weight": "model-00006-of-00011.safetensors",
|
| 223 |
+
"model.layers.17.self_attn.k_proj.weight": "model-00006-of-00011.safetensors",
|
| 224 |
+
"model.layers.17.self_attn.o_proj.weight": "model-00006-of-00011.safetensors",
|
| 225 |
+
"model.layers.17.self_attn.q_norm.weight": "model-00006-of-00011.safetensors",
|
| 226 |
+
"model.layers.17.self_attn.q_proj.weight": "model-00006-of-00011.safetensors",
|
| 227 |
+
"model.layers.18.experts.down_proj": "model-00007-of-00011.safetensors",
|
| 228 |
+
"model.layers.18.experts.gate_up_proj": "model-00007-of-00011.safetensors",
|
| 229 |
+
"model.layers.18.input_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 230 |
+
"model.layers.18.layer_scalar": "model-00007-of-00011.safetensors",
|
| 231 |
+
"model.layers.18.mlp.down_proj.weight": "model-00007-of-00011.safetensors",
|
| 232 |
+
"model.layers.18.mlp.gate_proj.weight": "model-00007-of-00011.safetensors",
|
| 233 |
+
"model.layers.18.mlp.up_proj.weight": "model-00007-of-00011.safetensors",
|
| 234 |
+
"model.layers.18.post_attention_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 235 |
+
"model.layers.18.post_feedforward_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 236 |
+
"model.layers.18.post_feedforward_layernorm_1.weight": "model-00007-of-00011.safetensors",
|
| 237 |
+
"model.layers.18.post_feedforward_layernorm_2.weight": "model-00007-of-00011.safetensors",
|
| 238 |
+
"model.layers.18.pre_feedforward_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 239 |
+
"model.layers.18.pre_feedforward_layernorm_2.weight": "model-00007-of-00011.safetensors",
|
| 240 |
+
"model.layers.18.router.per_expert_scale": "model-00007-of-00011.safetensors",
|
| 241 |
+
"model.layers.18.router.proj.weight": "model-00007-of-00011.safetensors",
|
| 242 |
+
"model.layers.18.router.scale": "model-00007-of-00011.safetensors",
|
| 243 |
+
"model.layers.18.self_attn.k_norm.weight": "model-00007-of-00011.safetensors",
|
| 244 |
+
"model.layers.18.self_attn.k_proj.weight": "model-00007-of-00011.safetensors",
|
| 245 |
+
"model.layers.18.self_attn.o_proj.weight": "model-00007-of-00011.safetensors",
|
| 246 |
+
"model.layers.18.self_attn.q_norm.weight": "model-00007-of-00011.safetensors",
|
| 247 |
+
"model.layers.18.self_attn.q_proj.weight": "model-00007-of-00011.safetensors",
|
| 248 |
+
"model.layers.18.self_attn.v_proj.weight": "model-00007-of-00011.safetensors",
|
| 249 |
+
"model.layers.19.experts.down_proj": "model-00007-of-00011.safetensors",
|
| 250 |
+
"model.layers.19.experts.gate_up_proj": "model-00007-of-00011.safetensors",
|
| 251 |
+
"model.layers.19.input_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 252 |
+
"model.layers.19.layer_scalar": "model-00007-of-00011.safetensors",
|
| 253 |
+
"model.layers.19.mlp.down_proj.weight": "model-00007-of-00011.safetensors",
|
| 254 |
+
"model.layers.19.mlp.gate_proj.weight": "model-00007-of-00011.safetensors",
|
| 255 |
+
"model.layers.19.mlp.up_proj.weight": "model-00007-of-00011.safetensors",
|
| 256 |
+
"model.layers.19.post_attention_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 257 |
+
"model.layers.19.post_feedforward_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 258 |
+
"model.layers.19.post_feedforward_layernorm_1.weight": "model-00007-of-00011.safetensors",
|
| 259 |
+
"model.layers.19.post_feedforward_layernorm_2.weight": "model-00007-of-00011.safetensors",
|
| 260 |
+
"model.layers.19.pre_feedforward_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 261 |
+
"model.layers.19.pre_feedforward_layernorm_2.weight": "model-00007-of-00011.safetensors",
|
| 262 |
+
"model.layers.19.router.per_expert_scale": "model-00007-of-00011.safetensors",
|
| 263 |
+
"model.layers.19.router.proj.weight": "model-00007-of-00011.safetensors",
|
| 264 |
+
"model.layers.19.router.scale": "model-00007-of-00011.safetensors",
|
| 265 |
+
"model.layers.19.self_attn.k_norm.weight": "model-00007-of-00011.safetensors",
|
| 266 |
+
"model.layers.19.self_attn.k_proj.weight": "model-00007-of-00011.safetensors",
|
| 267 |
+
"model.layers.19.self_attn.o_proj.weight": "model-00007-of-00011.safetensors",
|
| 268 |
+
"model.layers.19.self_attn.q_norm.weight": "model-00007-of-00011.safetensors",
|
| 269 |
+
"model.layers.19.self_attn.q_proj.weight": "model-00007-of-00011.safetensors",
|
| 270 |
+
"model.layers.19.self_attn.v_proj.weight": "model-00007-of-00011.safetensors",
|
| 271 |
+
"model.layers.2.experts.down_proj": "model-00002-of-00011.safetensors",
|
| 272 |
+
"model.layers.2.experts.gate_up_proj": "model-00002-of-00011.safetensors",
|
| 273 |
+
"model.layers.2.input_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 274 |
+
"model.layers.2.layer_scalar": "model-00001-of-00011.safetensors",
|
| 275 |
+
"model.layers.2.mlp.down_proj.weight": "model-00001-of-00011.safetensors",
|
| 276 |
+
"model.layers.2.mlp.gate_proj.weight": "model-00001-of-00011.safetensors",
|
| 277 |
+
"model.layers.2.mlp.up_proj.weight": "model-00001-of-00011.safetensors",
|
| 278 |
+
"model.layers.2.post_attention_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 279 |
+
"model.layers.2.post_feedforward_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 280 |
+
"model.layers.2.post_feedforward_layernorm_1.weight": "model-00002-of-00011.safetensors",
|
| 281 |
+
"model.layers.2.post_feedforward_layernorm_2.weight": "model-00002-of-00011.safetensors",
|
| 282 |
+
"model.layers.2.pre_feedforward_layernorm.weight": "model-00001-of-00011.safetensors",
|
| 283 |
+
"model.layers.2.pre_feedforward_layernorm_2.weight": "model-00002-of-00011.safetensors",
|
| 284 |
+
"model.layers.2.router.per_expert_scale": "model-00001-of-00011.safetensors",
|
| 285 |
+
"model.layers.2.router.proj.weight": "model-00001-of-00011.safetensors",
|
| 286 |
+
"model.layers.2.router.scale": "model-00001-of-00011.safetensors",
|
| 287 |
+
"model.layers.2.self_attn.k_norm.weight": "model-00001-of-00011.safetensors",
|
| 288 |
+
"model.layers.2.self_attn.k_proj.weight": "model-00001-of-00011.safetensors",
|
| 289 |
+
"model.layers.2.self_attn.o_proj.weight": "model-00001-of-00011.safetensors",
|
| 290 |
+
"model.layers.2.self_attn.q_norm.weight": "model-00001-of-00011.safetensors",
|
| 291 |
+
"model.layers.2.self_attn.q_proj.weight": "model-00001-of-00011.safetensors",
|
| 292 |
+
"model.layers.2.self_attn.v_proj.weight": "model-00001-of-00011.safetensors",
|
| 293 |
+
"model.layers.20.experts.down_proj": "model-00008-of-00011.safetensors",
|
| 294 |
+
"model.layers.20.experts.gate_up_proj": "model-00008-of-00011.safetensors",
|
| 295 |
+
"model.layers.20.input_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 296 |
+
"model.layers.20.layer_scalar": "model-00007-of-00011.safetensors",
|
| 297 |
+
"model.layers.20.mlp.down_proj.weight": "model-00007-of-00011.safetensors",
|
| 298 |
+
"model.layers.20.mlp.gate_proj.weight": "model-00007-of-00011.safetensors",
|
| 299 |
+
"model.layers.20.mlp.up_proj.weight": "model-00007-of-00011.safetensors",
|
| 300 |
+
"model.layers.20.post_attention_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 301 |
+
"model.layers.20.post_feedforward_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 302 |
+
"model.layers.20.post_feedforward_layernorm_1.weight": "model-00008-of-00011.safetensors",
|
| 303 |
+
"model.layers.20.post_feedforward_layernorm_2.weight": "model-00008-of-00011.safetensors",
|
| 304 |
+
"model.layers.20.pre_feedforward_layernorm.weight": "model-00007-of-00011.safetensors",
|
| 305 |
+
"model.layers.20.pre_feedforward_layernorm_2.weight": "model-00008-of-00011.safetensors",
|
| 306 |
+
"model.layers.20.router.per_expert_scale": "model-00007-of-00011.safetensors",
|
| 307 |
+
"model.layers.20.router.proj.weight": "model-00007-of-00011.safetensors",
|
| 308 |
+
"model.layers.20.router.scale": "model-00007-of-00011.safetensors",
|
| 309 |
+
"model.layers.20.self_attn.k_norm.weight": "model-00007-of-00011.safetensors",
|
| 310 |
+
"model.layers.20.self_attn.k_proj.weight": "model-00007-of-00011.safetensors",
|
| 311 |
+
"model.layers.20.self_attn.o_proj.weight": "model-00007-of-00011.safetensors",
|
| 312 |
+
"model.layers.20.self_attn.q_norm.weight": "model-00007-of-00011.safetensors",
|
| 313 |
+
"model.layers.20.self_attn.q_proj.weight": "model-00007-of-00011.safetensors",
|
| 314 |
+
"model.layers.20.self_attn.v_proj.weight": "model-00007-of-00011.safetensors",
|
| 315 |
+
"model.layers.21.experts.down_proj": "model-00008-of-00011.safetensors",
|
| 316 |
+
"model.layers.21.experts.gate_up_proj": "model-00008-of-00011.safetensors",
|
| 317 |
+
"model.layers.21.input_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 318 |
+
"model.layers.21.layer_scalar": "model-00008-of-00011.safetensors",
|
| 319 |
+
"model.layers.21.mlp.down_proj.weight": "model-00008-of-00011.safetensors",
|
| 320 |
+
"model.layers.21.mlp.gate_proj.weight": "model-00008-of-00011.safetensors",
|
| 321 |
+
"model.layers.21.mlp.up_proj.weight": "model-00008-of-00011.safetensors",
|
| 322 |
+
"model.layers.21.post_attention_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 323 |
+
"model.layers.21.post_feedforward_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 324 |
+
"model.layers.21.post_feedforward_layernorm_1.weight": "model-00008-of-00011.safetensors",
|
| 325 |
+
"model.layers.21.post_feedforward_layernorm_2.weight": "model-00008-of-00011.safetensors",
|
| 326 |
+
"model.layers.21.pre_feedforward_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 327 |
+
"model.layers.21.pre_feedforward_layernorm_2.weight": "model-00008-of-00011.safetensors",
|
| 328 |
+
"model.layers.21.router.per_expert_scale": "model-00008-of-00011.safetensors",
|
| 329 |
+
"model.layers.21.router.proj.weight": "model-00008-of-00011.safetensors",
|
| 330 |
+
"model.layers.21.router.scale": "model-00008-of-00011.safetensors",
|
| 331 |
+
"model.layers.21.self_attn.k_norm.weight": "model-00008-of-00011.safetensors",
|
| 332 |
+
"model.layers.21.self_attn.k_proj.weight": "model-00008-of-00011.safetensors",
|
| 333 |
+
"model.layers.21.self_attn.o_proj.weight": "model-00008-of-00011.safetensors",
|
| 334 |
+
"model.layers.21.self_attn.q_norm.weight": "model-00008-of-00011.safetensors",
|
| 335 |
+
"model.layers.21.self_attn.q_proj.weight": "model-00008-of-00011.safetensors",
|
| 336 |
+
"model.layers.21.self_attn.v_proj.weight": "model-00008-of-00011.safetensors",
|
| 337 |
+
"model.layers.22.experts.down_proj": "model-00008-of-00011.safetensors",
|
| 338 |
+
"model.layers.22.experts.gate_up_proj": "model-00008-of-00011.safetensors",
|
| 339 |
+
"model.layers.22.input_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 340 |
+
"model.layers.22.layer_scalar": "model-00008-of-00011.safetensors",
|
| 341 |
+
"model.layers.22.mlp.down_proj.weight": "model-00008-of-00011.safetensors",
|
| 342 |
+
"model.layers.22.mlp.gate_proj.weight": "model-00008-of-00011.safetensors",
|
| 343 |
+
"model.layers.22.mlp.up_proj.weight": "model-00008-of-00011.safetensors",
|
| 344 |
+
"model.layers.22.post_attention_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 345 |
+
"model.layers.22.post_feedforward_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 346 |
+
"model.layers.22.post_feedforward_layernorm_1.weight": "model-00008-of-00011.safetensors",
|
| 347 |
+
"model.layers.22.post_feedforward_layernorm_2.weight": "model-00008-of-00011.safetensors",
|
| 348 |
+
"model.layers.22.pre_feedforward_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 349 |
+
"model.layers.22.pre_feedforward_layernorm_2.weight": "model-00008-of-00011.safetensors",
|
| 350 |
+
"model.layers.22.router.per_expert_scale": "model-00008-of-00011.safetensors",
|
| 351 |
+
"model.layers.22.router.proj.weight": "model-00008-of-00011.safetensors",
|
| 352 |
+
"model.layers.22.router.scale": "model-00008-of-00011.safetensors",
|
| 353 |
+
"model.layers.22.self_attn.k_norm.weight": "model-00008-of-00011.safetensors",
|
| 354 |
+
"model.layers.22.self_attn.k_proj.weight": "model-00008-of-00011.safetensors",
|
| 355 |
+
"model.layers.22.self_attn.o_proj.weight": "model-00008-of-00011.safetensors",
|
| 356 |
+
"model.layers.22.self_attn.q_norm.weight": "model-00008-of-00011.safetensors",
|
| 357 |
+
"model.layers.22.self_attn.q_proj.weight": "model-00008-of-00011.safetensors",
|
| 358 |
+
"model.layers.22.self_attn.v_proj.weight": "model-00008-of-00011.safetensors",
|
| 359 |
+
"model.layers.23.experts.down_proj": "model-00009-of-00011.safetensors",
|
| 360 |
+
"model.layers.23.experts.gate_up_proj": "model-00009-of-00011.safetensors",
|
| 361 |
+
"model.layers.23.input_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 362 |
+
"model.layers.23.layer_scalar": "model-00008-of-00011.safetensors",
|
| 363 |
+
"model.layers.23.mlp.down_proj.weight": "model-00008-of-00011.safetensors",
|
| 364 |
+
"model.layers.23.mlp.gate_proj.weight": "model-00008-of-00011.safetensors",
|
| 365 |
+
"model.layers.23.mlp.up_proj.weight": "model-00008-of-00011.safetensors",
|
| 366 |
+
"model.layers.23.post_attention_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 367 |
+
"model.layers.23.post_feedforward_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 368 |
+
"model.layers.23.post_feedforward_layernorm_1.weight": "model-00009-of-00011.safetensors",
|
| 369 |
+
"model.layers.23.post_feedforward_layernorm_2.weight": "model-00009-of-00011.safetensors",
|
| 370 |
+
"model.layers.23.pre_feedforward_layernorm.weight": "model-00008-of-00011.safetensors",
|
| 371 |
+
"model.layers.23.pre_feedforward_layernorm_2.weight": "model-00009-of-00011.safetensors",
|
| 372 |
+
"model.layers.23.router.per_expert_scale": "model-00008-of-00011.safetensors",
|
| 373 |
+
"model.layers.23.router.proj.weight": "model-00008-of-00011.safetensors",
|
| 374 |
+
"model.layers.23.router.scale": "model-00008-of-00011.safetensors",
|
| 375 |
+
"model.layers.23.self_attn.k_norm.weight": "model-00008-of-00011.safetensors",
|
| 376 |
+
"model.layers.23.self_attn.k_proj.weight": "model-00008-of-00011.safetensors",
|
| 377 |
+
"model.layers.23.self_attn.o_proj.weight": "model-00008-of-00011.safetensors",
|
| 378 |
+
"model.layers.23.self_attn.q_norm.weight": "model-00008-of-00011.safetensors",
|
| 379 |
+
"model.layers.23.self_attn.q_proj.weight": "model-00008-of-00011.safetensors",
|
| 380 |
+
"model.layers.24.experts.down_proj": "model-00009-of-00011.safetensors",
|
| 381 |
+
"model.layers.24.experts.gate_up_proj": "model-00009-of-00011.safetensors",
|
| 382 |
+
"model.layers.24.input_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 383 |
+
"model.layers.24.layer_scalar": "model-00009-of-00011.safetensors",
|
| 384 |
+
"model.layers.24.mlp.down_proj.weight": "model-00009-of-00011.safetensors",
|
| 385 |
+
"model.layers.24.mlp.gate_proj.weight": "model-00009-of-00011.safetensors",
|
| 386 |
+
"model.layers.24.mlp.up_proj.weight": "model-00009-of-00011.safetensors",
|
| 387 |
+
"model.layers.24.post_attention_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 388 |
+
"model.layers.24.post_feedforward_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 389 |
+
"model.layers.24.post_feedforward_layernorm_1.weight": "model-00009-of-00011.safetensors",
|
| 390 |
+
"model.layers.24.post_feedforward_layernorm_2.weight": "model-00009-of-00011.safetensors",
|
| 391 |
+
"model.layers.24.pre_feedforward_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 392 |
+
"model.layers.24.pre_feedforward_layernorm_2.weight": "model-00009-of-00011.safetensors",
|
| 393 |
+
"model.layers.24.router.per_expert_scale": "model-00009-of-00011.safetensors",
|
| 394 |
+
"model.layers.24.router.proj.weight": "model-00009-of-00011.safetensors",
|
| 395 |
+
"model.layers.24.router.scale": "model-00009-of-00011.safetensors",
|
| 396 |
+
"model.layers.24.self_attn.k_norm.weight": "model-00009-of-00011.safetensors",
|
| 397 |
+
"model.layers.24.self_attn.k_proj.weight": "model-00009-of-00011.safetensors",
|
| 398 |
+
"model.layers.24.self_attn.o_proj.weight": "model-00009-of-00011.safetensors",
|
| 399 |
+
"model.layers.24.self_attn.q_norm.weight": "model-00009-of-00011.safetensors",
|
| 400 |
+
"model.layers.24.self_attn.q_proj.weight": "model-00009-of-00011.safetensors",
|
| 401 |
+
"model.layers.24.self_attn.v_proj.weight": "model-00009-of-00011.safetensors",
|
| 402 |
+
"model.layers.25.experts.down_proj": "model-00009-of-00011.safetensors",
|
| 403 |
+
"model.layers.25.experts.gate_up_proj": "model-00009-of-00011.safetensors",
|
| 404 |
+
"model.layers.25.input_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 405 |
+
"model.layers.25.layer_scalar": "model-00009-of-00011.safetensors",
|
| 406 |
+
"model.layers.25.mlp.down_proj.weight": "model-00009-of-00011.safetensors",
|
| 407 |
+
"model.layers.25.mlp.gate_proj.weight": "model-00009-of-00011.safetensors",
|
| 408 |
+
"model.layers.25.mlp.up_proj.weight": "model-00009-of-00011.safetensors",
|
| 409 |
+
"model.layers.25.post_attention_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 410 |
+
"model.layers.25.post_feedforward_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 411 |
+
"model.layers.25.post_feedforward_layernorm_1.weight": "model-00009-of-00011.safetensors",
|
| 412 |
+
"model.layers.25.post_feedforward_layernorm_2.weight": "model-00009-of-00011.safetensors",
|
| 413 |
+
"model.layers.25.pre_feedforward_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 414 |
+
"model.layers.25.pre_feedforward_layernorm_2.weight": "model-00009-of-00011.safetensors",
|
| 415 |
+
"model.layers.25.router.per_expert_scale": "model-00009-of-00011.safetensors",
|
| 416 |
+
"model.layers.25.router.proj.weight": "model-00009-of-00011.safetensors",
|
| 417 |
+
"model.layers.25.router.scale": "model-00009-of-00011.safetensors",
|
| 418 |
+
"model.layers.25.self_attn.k_norm.weight": "model-00009-of-00011.safetensors",
|
| 419 |
+
"model.layers.25.self_attn.k_proj.weight": "model-00009-of-00011.safetensors",
|
| 420 |
+
"model.layers.25.self_attn.o_proj.weight": "model-00009-of-00011.safetensors",
|
| 421 |
+
"model.layers.25.self_attn.q_norm.weight": "model-00009-of-00011.safetensors",
|
| 422 |
+
"model.layers.25.self_attn.q_proj.weight": "model-00009-of-00011.safetensors",
|
| 423 |
+
"model.layers.25.self_attn.v_proj.weight": "model-00009-of-00011.safetensors",
|
| 424 |
+
"model.layers.26.experts.down_proj": "model-00010-of-00011.safetensors",
|
| 425 |
+
"model.layers.26.experts.gate_up_proj": "model-00010-of-00011.safetensors",
|
| 426 |
+
"model.layers.26.input_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 427 |
+
"model.layers.26.layer_scalar": "model-00009-of-00011.safetensors",
|
| 428 |
+
"model.layers.26.mlp.down_proj.weight": "model-00009-of-00011.safetensors",
|
| 429 |
+
"model.layers.26.mlp.gate_proj.weight": "model-00009-of-00011.safetensors",
|
| 430 |
+
"model.layers.26.mlp.up_proj.weight": "model-00009-of-00011.safetensors",
|
| 431 |
+
"model.layers.26.post_attention_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 432 |
+
"model.layers.26.post_feedforward_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 433 |
+
"model.layers.26.post_feedforward_layernorm_1.weight": "model-00010-of-00011.safetensors",
|
| 434 |
+
"model.layers.26.post_feedforward_layernorm_2.weight": "model-00010-of-00011.safetensors",
|
| 435 |
+
"model.layers.26.pre_feedforward_layernorm.weight": "model-00009-of-00011.safetensors",
|
| 436 |
+
"model.layers.26.pre_feedforward_layernorm_2.weight": "model-00010-of-00011.safetensors",
|
| 437 |
+
"model.layers.26.router.per_expert_scale": "model-00009-of-00011.safetensors",
|
| 438 |
+
"model.layers.26.router.proj.weight": "model-00009-of-00011.safetensors",
|
| 439 |
+
"model.layers.26.router.scale": "model-00009-of-00011.safetensors",
|
| 440 |
+
"model.layers.26.self_attn.k_norm.weight": "model-00009-of-00011.safetensors",
|
| 441 |
+
"model.layers.26.self_attn.k_proj.weight": "model-00009-of-00011.safetensors",
|
| 442 |
+
"model.layers.26.self_attn.o_proj.weight": "model-00009-of-00011.safetensors",
|
| 443 |
+
"model.layers.26.self_attn.q_norm.weight": "model-00009-of-00011.safetensors",
|
| 444 |
+
"model.layers.26.self_attn.q_proj.weight": "model-00009-of-00011.safetensors",
|
| 445 |
+
"model.layers.26.self_attn.v_proj.weight": "model-00009-of-00011.safetensors",
|
| 446 |
+
"model.layers.27.experts.down_proj": "model-00010-of-00011.safetensors",
|
| 447 |
+
"model.layers.27.experts.gate_up_proj": "model-00010-of-00011.safetensors",
|
| 448 |
+
"model.layers.27.input_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 449 |
+
"model.layers.27.layer_scalar": "model-00010-of-00011.safetensors",
|
| 450 |
+
"model.layers.27.mlp.down_proj.weight": "model-00010-of-00011.safetensors",
|
| 451 |
+
"model.layers.27.mlp.gate_proj.weight": "model-00010-of-00011.safetensors",
|
| 452 |
+
"model.layers.27.mlp.up_proj.weight": "model-00010-of-00011.safetensors",
|
| 453 |
+
"model.layers.27.post_attention_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 454 |
+
"model.layers.27.post_feedforward_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 455 |
+
"model.layers.27.post_feedforward_layernorm_1.weight": "model-00010-of-00011.safetensors",
|
| 456 |
+
"model.layers.27.post_feedforward_layernorm_2.weight": "model-00010-of-00011.safetensors",
|
| 457 |
+
"model.layers.27.pre_feedforward_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 458 |
+
"model.layers.27.pre_feedforward_layernorm_2.weight": "model-00010-of-00011.safetensors",
|
| 459 |
+
"model.layers.27.router.per_expert_scale": "model-00010-of-00011.safetensors",
|
| 460 |
+
"model.layers.27.router.proj.weight": "model-00010-of-00011.safetensors",
|
| 461 |
+
"model.layers.27.router.scale": "model-00010-of-00011.safetensors",
|
| 462 |
+
"model.layers.27.self_attn.k_norm.weight": "model-00010-of-00011.safetensors",
|
| 463 |
+
"model.layers.27.self_attn.k_proj.weight": "model-00010-of-00011.safetensors",
|
| 464 |
+
"model.layers.27.self_attn.o_proj.weight": "model-00010-of-00011.safetensors",
|
| 465 |
+
"model.layers.27.self_attn.q_norm.weight": "model-00010-of-00011.safetensors",
|
| 466 |
+
"model.layers.27.self_attn.q_proj.weight": "model-00010-of-00011.safetensors",
|
| 467 |
+
"model.layers.27.self_attn.v_proj.weight": "model-00010-of-00011.safetensors",
|
| 468 |
+
"model.layers.28.experts.down_proj": "model-00010-of-00011.safetensors",
|
| 469 |
+
"model.layers.28.experts.gate_up_proj": "model-00010-of-00011.safetensors",
|
| 470 |
+
"model.layers.28.input_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 471 |
+
"model.layers.28.layer_scalar": "model-00010-of-00011.safetensors",
|
| 472 |
+
"model.layers.28.mlp.down_proj.weight": "model-00010-of-00011.safetensors",
|
| 473 |
+
"model.layers.28.mlp.gate_proj.weight": "model-00010-of-00011.safetensors",
|
| 474 |
+
"model.layers.28.mlp.up_proj.weight": "model-00010-of-00011.safetensors",
|
| 475 |
+
"model.layers.28.post_attention_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 476 |
+
"model.layers.28.post_feedforward_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 477 |
+
"model.layers.28.post_feedforward_layernorm_1.weight": "model-00010-of-00011.safetensors",
|
| 478 |
+
"model.layers.28.post_feedforward_layernorm_2.weight": "model-00010-of-00011.safetensors",
|
| 479 |
+
"model.layers.28.pre_feedforward_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 480 |
+
"model.layers.28.pre_feedforward_layernorm_2.weight": "model-00010-of-00011.safetensors",
|
| 481 |
+
"model.layers.28.router.per_expert_scale": "model-00010-of-00011.safetensors",
|
| 482 |
+
"model.layers.28.router.proj.weight": "model-00010-of-00011.safetensors",
|
| 483 |
+
"model.layers.28.router.scale": "model-00010-of-00011.safetensors",
|
| 484 |
+
"model.layers.28.self_attn.k_norm.weight": "model-00010-of-00011.safetensors",
|
| 485 |
+
"model.layers.28.self_attn.k_proj.weight": "model-00010-of-00011.safetensors",
|
| 486 |
+
"model.layers.28.self_attn.o_proj.weight": "model-00010-of-00011.safetensors",
|
| 487 |
+
"model.layers.28.self_attn.q_norm.weight": "model-00010-of-00011.safetensors",
|
| 488 |
+
"model.layers.28.self_attn.q_proj.weight": "model-00010-of-00011.safetensors",
|
| 489 |
+
"model.layers.28.self_attn.v_proj.weight": "model-00010-of-00011.safetensors",
|
| 490 |
+
"model.layers.29.experts.down_proj": "model-00011-of-00011.safetensors",
|
| 491 |
+
"model.layers.29.experts.gate_up_proj": "model-00011-of-00011.safetensors",
|
| 492 |
+
"model.layers.29.input_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 493 |
+
"model.layers.29.layer_scalar": "model-00010-of-00011.safetensors",
|
| 494 |
+
"model.layers.29.mlp.down_proj.weight": "model-00010-of-00011.safetensors",
|
| 495 |
+
"model.layers.29.mlp.gate_proj.weight": "model-00010-of-00011.safetensors",
|
| 496 |
+
"model.layers.29.mlp.up_proj.weight": "model-00010-of-00011.safetensors",
|
| 497 |
+
"model.layers.29.post_attention_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 498 |
+
"model.layers.29.post_feedforward_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 499 |
+
"model.layers.29.post_feedforward_layernorm_1.weight": "model-00011-of-00011.safetensors",
|
| 500 |
+
"model.layers.29.post_feedforward_layernorm_2.weight": "model-00011-of-00011.safetensors",
|
| 501 |
+
"model.layers.29.pre_feedforward_layernorm.weight": "model-00010-of-00011.safetensors",
|
| 502 |
+
"model.layers.29.pre_feedforward_layernorm_2.weight": "model-00011-of-00011.safetensors",
|
| 503 |
+
"model.layers.29.router.per_expert_scale": "model-00010-of-00011.safetensors",
|
| 504 |
+
"model.layers.29.router.proj.weight": "model-00010-of-00011.safetensors",
|
| 505 |
+
"model.layers.29.router.scale": "model-00010-of-00011.safetensors",
|
| 506 |
+
"model.layers.29.self_attn.k_norm.weight": "model-00010-of-00011.safetensors",
|
| 507 |
+
"model.layers.29.self_attn.k_proj.weight": "model-00010-of-00011.safetensors",
|
| 508 |
+
"model.layers.29.self_attn.o_proj.weight": "model-00010-of-00011.safetensors",
|
| 509 |
+
"model.layers.29.self_attn.q_norm.weight": "model-00010-of-00011.safetensors",
|
| 510 |
+
"model.layers.29.self_attn.q_proj.weight": "model-00010-of-00011.safetensors",
|
| 511 |
+
"model.layers.3.experts.down_proj": "model-00002-of-00011.safetensors",
|
| 512 |
+
"model.layers.3.experts.gate_up_proj": "model-00002-of-00011.safetensors",
|
| 513 |
+
"model.layers.3.input_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 514 |
+
"model.layers.3.layer_scalar": "model-00002-of-00011.safetensors",
|
| 515 |
+
"model.layers.3.mlp.down_proj.weight": "model-00002-of-00011.safetensors",
|
| 516 |
+
"model.layers.3.mlp.gate_proj.weight": "model-00002-of-00011.safetensors",
|
| 517 |
+
"model.layers.3.mlp.up_proj.weight": "model-00002-of-00011.safetensors",
|
| 518 |
+
"model.layers.3.post_attention_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 519 |
+
"model.layers.3.post_feedforward_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 520 |
+
"model.layers.3.post_feedforward_layernorm_1.weight": "model-00002-of-00011.safetensors",
|
| 521 |
+
"model.layers.3.post_feedforward_layernorm_2.weight": "model-00002-of-00011.safetensors",
|
| 522 |
+
"model.layers.3.pre_feedforward_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 523 |
+
"model.layers.3.pre_feedforward_layernorm_2.weight": "model-00002-of-00011.safetensors",
|
| 524 |
+
"model.layers.3.router.per_expert_scale": "model-00002-of-00011.safetensors",
|
| 525 |
+
"model.layers.3.router.proj.weight": "model-00002-of-00011.safetensors",
|
| 526 |
+
"model.layers.3.router.scale": "model-00002-of-00011.safetensors",
|
| 527 |
+
"model.layers.3.self_attn.k_norm.weight": "model-00002-of-00011.safetensors",
|
| 528 |
+
"model.layers.3.self_attn.k_proj.weight": "model-00002-of-00011.safetensors",
|
| 529 |
+
"model.layers.3.self_attn.o_proj.weight": "model-00002-of-00011.safetensors",
|
| 530 |
+
"model.layers.3.self_attn.q_norm.weight": "model-00002-of-00011.safetensors",
|
| 531 |
+
"model.layers.3.self_attn.q_proj.weight": "model-00002-of-00011.safetensors",
|
| 532 |
+
"model.layers.3.self_attn.v_proj.weight": "model-00002-of-00011.safetensors",
|
| 533 |
+
"model.layers.4.experts.down_proj": "model-00002-of-00011.safetensors",
|
| 534 |
+
"model.layers.4.experts.gate_up_proj": "model-00002-of-00011.safetensors",
|
| 535 |
+
"model.layers.4.input_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 536 |
+
"model.layers.4.layer_scalar": "model-00002-of-00011.safetensors",
|
| 537 |
+
"model.layers.4.mlp.down_proj.weight": "model-00002-of-00011.safetensors",
|
| 538 |
+
"model.layers.4.mlp.gate_proj.weight": "model-00002-of-00011.safetensors",
|
| 539 |
+
"model.layers.4.mlp.up_proj.weight": "model-00002-of-00011.safetensors",
|
| 540 |
+
"model.layers.4.post_attention_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 541 |
+
"model.layers.4.post_feedforward_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 542 |
+
"model.layers.4.post_feedforward_layernorm_1.weight": "model-00002-of-00011.safetensors",
|
| 543 |
+
"model.layers.4.post_feedforward_layernorm_2.weight": "model-00002-of-00011.safetensors",
|
| 544 |
+
"model.layers.4.pre_feedforward_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 545 |
+
"model.layers.4.pre_feedforward_layernorm_2.weight": "model-00002-of-00011.safetensors",
|
| 546 |
+
"model.layers.4.router.per_expert_scale": "model-00002-of-00011.safetensors",
|
| 547 |
+
"model.layers.4.router.proj.weight": "model-00002-of-00011.safetensors",
|
| 548 |
+
"model.layers.4.router.scale": "model-00002-of-00011.safetensors",
|
| 549 |
+
"model.layers.4.self_attn.k_norm.weight": "model-00002-of-00011.safetensors",
|
| 550 |
+
"model.layers.4.self_attn.k_proj.weight": "model-00002-of-00011.safetensors",
|
| 551 |
+
"model.layers.4.self_attn.o_proj.weight": "model-00002-of-00011.safetensors",
|
| 552 |
+
"model.layers.4.self_attn.q_norm.weight": "model-00002-of-00011.safetensors",
|
| 553 |
+
"model.layers.4.self_attn.q_proj.weight": "model-00002-of-00011.safetensors",
|
| 554 |
+
"model.layers.4.self_attn.v_proj.weight": "model-00002-of-00011.safetensors",
|
| 555 |
+
"model.layers.5.experts.down_proj": "model-00003-of-00011.safetensors",
|
| 556 |
+
"model.layers.5.experts.gate_up_proj": "model-00003-of-00011.safetensors",
|
| 557 |
+
"model.layers.5.input_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 558 |
+
"model.layers.5.layer_scalar": "model-00002-of-00011.safetensors",
|
| 559 |
+
"model.layers.5.mlp.down_proj.weight": "model-00002-of-00011.safetensors",
|
| 560 |
+
"model.layers.5.mlp.gate_proj.weight": "model-00002-of-00011.safetensors",
|
| 561 |
+
"model.layers.5.mlp.up_proj.weight": "model-00002-of-00011.safetensors",
|
| 562 |
+
"model.layers.5.post_attention_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 563 |
+
"model.layers.5.post_feedforward_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 564 |
+
"model.layers.5.post_feedforward_layernorm_1.weight": "model-00003-of-00011.safetensors",
|
| 565 |
+
"model.layers.5.post_feedforward_layernorm_2.weight": "model-00003-of-00011.safetensors",
|
| 566 |
+
"model.layers.5.pre_feedforward_layernorm.weight": "model-00002-of-00011.safetensors",
|
| 567 |
+
"model.layers.5.pre_feedforward_layernorm_2.weight": "model-00003-of-00011.safetensors",
|
| 568 |
+
"model.layers.5.router.per_expert_scale": "model-00002-of-00011.safetensors",
|
| 569 |
+
"model.layers.5.router.proj.weight": "model-00002-of-00011.safetensors",
|
| 570 |
+
"model.layers.5.router.scale": "model-00002-of-00011.safetensors",
|
| 571 |
+
"model.layers.5.self_attn.k_norm.weight": "model-00002-of-00011.safetensors",
|
| 572 |
+
"model.layers.5.self_attn.k_proj.weight": "model-00002-of-00011.safetensors",
|
| 573 |
+
"model.layers.5.self_attn.o_proj.weight": "model-00002-of-00011.safetensors",
|
| 574 |
+
"model.layers.5.self_attn.q_norm.weight": "model-00002-of-00011.safetensors",
|
| 575 |
+
"model.layers.5.self_attn.q_proj.weight": "model-00002-of-00011.safetensors",
|
| 576 |
+
"model.layers.6.experts.down_proj": "model-00003-of-00011.safetensors",
|
| 577 |
+
"model.layers.6.experts.gate_up_proj": "model-00003-of-00011.safetensors",
|
| 578 |
+
"model.layers.6.input_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 579 |
+
"model.layers.6.layer_scalar": "model-00003-of-00011.safetensors",
|
| 580 |
+
"model.layers.6.mlp.down_proj.weight": "model-00003-of-00011.safetensors",
|
| 581 |
+
"model.layers.6.mlp.gate_proj.weight": "model-00003-of-00011.safetensors",
|
| 582 |
+
"model.layers.6.mlp.up_proj.weight": "model-00003-of-00011.safetensors",
|
| 583 |
+
"model.layers.6.post_attention_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 584 |
+
"model.layers.6.post_feedforward_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 585 |
+
"model.layers.6.post_feedforward_layernorm_1.weight": "model-00003-of-00011.safetensors",
|
| 586 |
+
"model.layers.6.post_feedforward_layernorm_2.weight": "model-00003-of-00011.safetensors",
|
| 587 |
+
"model.layers.6.pre_feedforward_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 588 |
+
"model.layers.6.pre_feedforward_layernorm_2.weight": "model-00003-of-00011.safetensors",
|
| 589 |
+
"model.layers.6.router.per_expert_scale": "model-00003-of-00011.safetensors",
|
| 590 |
+
"model.layers.6.router.proj.weight": "model-00003-of-00011.safetensors",
|
| 591 |
+
"model.layers.6.router.scale": "model-00003-of-00011.safetensors",
|
| 592 |
+
"model.layers.6.self_attn.k_norm.weight": "model-00003-of-00011.safetensors",
|
| 593 |
+
"model.layers.6.self_attn.k_proj.weight": "model-00003-of-00011.safetensors",
|
| 594 |
+
"model.layers.6.self_attn.o_proj.weight": "model-00003-of-00011.safetensors",
|
| 595 |
+
"model.layers.6.self_attn.q_norm.weight": "model-00003-of-00011.safetensors",
|
| 596 |
+
"model.layers.6.self_attn.q_proj.weight": "model-00003-of-00011.safetensors",
|
| 597 |
+
"model.layers.6.self_attn.v_proj.weight": "model-00003-of-00011.safetensors",
|
| 598 |
+
"model.layers.7.experts.down_proj": "model-00003-of-00011.safetensors",
|
| 599 |
+
"model.layers.7.experts.gate_up_proj": "model-00003-of-00011.safetensors",
|
| 600 |
+
"model.layers.7.input_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 601 |
+
"model.layers.7.layer_scalar": "model-00003-of-00011.safetensors",
|
| 602 |
+
"model.layers.7.mlp.down_proj.weight": "model-00003-of-00011.safetensors",
|
| 603 |
+
"model.layers.7.mlp.gate_proj.weight": "model-00003-of-00011.safetensors",
|
| 604 |
+
"model.layers.7.mlp.up_proj.weight": "model-00003-of-00011.safetensors",
|
| 605 |
+
"model.layers.7.post_attention_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 606 |
+
"model.layers.7.post_feedforward_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 607 |
+
"model.layers.7.post_feedforward_layernorm_1.weight": "model-00003-of-00011.safetensors",
|
| 608 |
+
"model.layers.7.post_feedforward_layernorm_2.weight": "model-00003-of-00011.safetensors",
|
| 609 |
+
"model.layers.7.pre_feedforward_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 610 |
+
"model.layers.7.pre_feedforward_layernorm_2.weight": "model-00003-of-00011.safetensors",
|
| 611 |
+
"model.layers.7.router.per_expert_scale": "model-00003-of-00011.safetensors",
|
| 612 |
+
"model.layers.7.router.proj.weight": "model-00003-of-00011.safetensors",
|
| 613 |
+
"model.layers.7.router.scale": "model-00003-of-00011.safetensors",
|
| 614 |
+
"model.layers.7.self_attn.k_norm.weight": "model-00003-of-00011.safetensors",
|
| 615 |
+
"model.layers.7.self_attn.k_proj.weight": "model-00003-of-00011.safetensors",
|
| 616 |
+
"model.layers.7.self_attn.o_proj.weight": "model-00003-of-00011.safetensors",
|
| 617 |
+
"model.layers.7.self_attn.q_norm.weight": "model-00003-of-00011.safetensors",
|
| 618 |
+
"model.layers.7.self_attn.q_proj.weight": "model-00003-of-00011.safetensors",
|
| 619 |
+
"model.layers.7.self_attn.v_proj.weight": "model-00003-of-00011.safetensors",
|
| 620 |
+
"model.layers.8.experts.down_proj": "model-00004-of-00011.safetensors",
|
| 621 |
+
"model.layers.8.experts.gate_up_proj": "model-00004-of-00011.safetensors",
|
| 622 |
+
"model.layers.8.input_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 623 |
+
"model.layers.8.layer_scalar": "model-00003-of-00011.safetensors",
|
| 624 |
+
"model.layers.8.mlp.down_proj.weight": "model-00003-of-00011.safetensors",
|
| 625 |
+
"model.layers.8.mlp.gate_proj.weight": "model-00003-of-00011.safetensors",
|
| 626 |
+
"model.layers.8.mlp.up_proj.weight": "model-00003-of-00011.safetensors",
|
| 627 |
+
"model.layers.8.post_attention_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 628 |
+
"model.layers.8.post_feedforward_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 629 |
+
"model.layers.8.post_feedforward_layernorm_1.weight": "model-00004-of-00011.safetensors",
|
| 630 |
+
"model.layers.8.post_feedforward_layernorm_2.weight": "model-00004-of-00011.safetensors",
|
| 631 |
+
"model.layers.8.pre_feedforward_layernorm.weight": "model-00003-of-00011.safetensors",
|
| 632 |
+
"model.layers.8.pre_feedforward_layernorm_2.weight": "model-00004-of-00011.safetensors",
|
| 633 |
+
"model.layers.8.router.per_expert_scale": "model-00003-of-00011.safetensors",
|
| 634 |
+
"model.layers.8.router.proj.weight": "model-00003-of-00011.safetensors",
|
| 635 |
+
"model.layers.8.router.scale": "model-00003-of-00011.safetensors",
|
| 636 |
+
"model.layers.8.self_attn.k_norm.weight": "model-00003-of-00011.safetensors",
|
| 637 |
+
"model.layers.8.self_attn.k_proj.weight": "model-00003-of-00011.safetensors",
|
| 638 |
+
"model.layers.8.self_attn.o_proj.weight": "model-00003-of-00011.safetensors",
|
| 639 |
+
"model.layers.8.self_attn.q_norm.weight": "model-00003-of-00011.safetensors",
|
| 640 |
+
"model.layers.8.self_attn.q_proj.weight": "model-00003-of-00011.safetensors",
|
| 641 |
+
"model.layers.8.self_attn.v_proj.weight": "model-00003-of-00011.safetensors",
|
| 642 |
+
"model.layers.9.experts.down_proj": "model-00004-of-00011.safetensors",
|
| 643 |
+
"model.layers.9.experts.gate_up_proj": "model-00004-of-00011.safetensors",
|
| 644 |
+
"model.layers.9.input_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 645 |
+
"model.layers.9.layer_scalar": "model-00004-of-00011.safetensors",
|
| 646 |
+
"model.layers.9.mlp.down_proj.weight": "model-00004-of-00011.safetensors",
|
| 647 |
+
"model.layers.9.mlp.gate_proj.weight": "model-00004-of-00011.safetensors",
|
| 648 |
+
"model.layers.9.mlp.up_proj.weight": "model-00004-of-00011.safetensors",
|
| 649 |
+
"model.layers.9.post_attention_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 650 |
+
"model.layers.9.post_feedforward_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 651 |
+
"model.layers.9.post_feedforward_layernorm_1.weight": "model-00004-of-00011.safetensors",
|
| 652 |
+
"model.layers.9.post_feedforward_layernorm_2.weight": "model-00004-of-00011.safetensors",
|
| 653 |
+
"model.layers.9.pre_feedforward_layernorm.weight": "model-00004-of-00011.safetensors",
|
| 654 |
+
"model.layers.9.pre_feedforward_layernorm_2.weight": "model-00004-of-00011.safetensors",
|
| 655 |
+
"model.layers.9.router.per_expert_scale": "model-00004-of-00011.safetensors",
|
| 656 |
+
"model.layers.9.router.proj.weight": "model-00004-of-00011.safetensors",
|
| 657 |
+
"model.layers.9.router.scale": "model-00004-of-00011.safetensors",
|
| 658 |
+
"model.layers.9.self_attn.k_norm.weight": "model-00004-of-00011.safetensors",
|
| 659 |
+
"model.layers.9.self_attn.k_proj.weight": "model-00004-of-00011.safetensors",
|
| 660 |
+
"model.layers.9.self_attn.o_proj.weight": "model-00004-of-00011.safetensors",
|
| 661 |
+
"model.layers.9.self_attn.q_norm.weight": "model-00004-of-00011.safetensors",
|
| 662 |
+
"model.layers.9.self_attn.q_proj.weight": "model-00004-of-00011.safetensors",
|
| 663 |
+
"model.layers.9.self_attn.v_proj.weight": "model-00004-of-00011.safetensors",
|
| 664 |
+
"model.norm.weight": "model-00011-of-00011.safetensors"
|
| 665 |
+
}
|
| 666 |
+
}
|
modeling_gemma4.py
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cc8d3a0ce36466ccc1278bf987df5f71db1719b9ca6b4118264f45cb627bfe0f
|
| 3 |
+
size 32169626
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"audio_token": "<|audio|>",
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"boa_token": "<|audio>",
|
| 5 |
+
"boi_token": "<|image>",
|
| 6 |
+
"bos_token": "<bos>",
|
| 7 |
+
"eoa_token": "<audio|>",
|
| 8 |
+
"eoc_token": "<channel|>",
|
| 9 |
+
"eoi_token": "<image|>",
|
| 10 |
+
"eos_token": "<eos>",
|
| 11 |
+
"eot_token": "<turn|>",
|
| 12 |
+
"escape_token": "<|\"|>",
|
| 13 |
+
"etc_token": "<tool_call|>",
|
| 14 |
+
"etd_token": "<tool|>",
|
| 15 |
+
"etr_token": "<tool_response|>",
|
| 16 |
+
"extra_special_tokens": [
|
| 17 |
+
"<|video|>"
|
| 18 |
+
],
|
| 19 |
+
"image_token": "<|image|>",
|
| 20 |
+
"is_local": false,
|
| 21 |
+
"mask_token": "<mask>",
|
| 22 |
+
"model_max_length": 1000000000000000019884624838656,
|
| 23 |
+
"model_specific_special_tokens": {
|
| 24 |
+
"audio_token": "<|audio|>",
|
| 25 |
+
"boa_token": "<|audio>",
|
| 26 |
+
"boi_token": "<|image>",
|
| 27 |
+
"eoa_token": "<audio|>",
|
| 28 |
+
"eoc_token": "<channel|>",
|
| 29 |
+
"eoi_token": "<image|>",
|
| 30 |
+
"eot_token": "<turn|>",
|
| 31 |
+
"escape_token": "<|\"|>",
|
| 32 |
+
"etc_token": "<tool_call|>",
|
| 33 |
+
"etd_token": "<tool|>",
|
| 34 |
+
"etr_token": "<tool_response|>",
|
| 35 |
+
"image_token": "<|image|>",
|
| 36 |
+
"soc_token": "<|channel>",
|
| 37 |
+
"sot_token": "<|turn>",
|
| 38 |
+
"stc_token": "<|tool_call>",
|
| 39 |
+
"std_token": "<|tool>",
|
| 40 |
+
"str_token": "<|tool_response>",
|
| 41 |
+
"think_token": "<|think|>"
|
| 42 |
+
},
|
| 43 |
+
"pad_token": "<pad>",
|
| 44 |
+
"padding_side": "left",
|
| 45 |
+
"processor_class": "Gemma4Processor",
|
| 46 |
+
"response_schema": {
|
| 47 |
+
"properties": {
|
| 48 |
+
"content": {
|
| 49 |
+
"type": "string"
|
| 50 |
+
},
|
| 51 |
+
"role": {
|
| 52 |
+
"const": "assistant"
|
| 53 |
+
},
|
| 54 |
+
"thinking": {
|
| 55 |
+
"type": "string"
|
| 56 |
+
},
|
| 57 |
+
"tool_calls": {
|
| 58 |
+
"items": {
|
| 59 |
+
"properties": {
|
| 60 |
+
"function": {
|
| 61 |
+
"properties": {
|
| 62 |
+
"arguments": {
|
| 63 |
+
"additionalProperties": {},
|
| 64 |
+
"type": "object",
|
| 65 |
+
"x-parser": "gemma4-tool-call"
|
| 66 |
+
},
|
| 67 |
+
"name": {
|
| 68 |
+
"type": "string"
|
| 69 |
+
}
|
| 70 |
+
},
|
| 71 |
+
"type": "object",
|
| 72 |
+
"x-regex": "call\\:(?P<name>\\w+)(?P<arguments>\\{.*\\})"
|
| 73 |
+
},
|
| 74 |
+
"type": {
|
| 75 |
+
"const": "function"
|
| 76 |
+
}
|
| 77 |
+
},
|
| 78 |
+
"type": "object"
|
| 79 |
+
},
|
| 80 |
+
"type": "array",
|
| 81 |
+
"x-regex-iterator": "<\\|tool_call>(.*?)<tool_call\\|>"
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"type": "object",
|
| 85 |
+
"x-regex": "(\\<\\|channel\\>thought\\n(?P<thinking>.*?)\\<channel\\|\\>)?(?P<content>(?:(?!\\<\\|tool_call\\>)(?!\\<turn\\|\\>).)+)?(?P<tool_calls>\\<\\|tool_call\\>.*\\<tool_call\\|\\>)?(?:\\<turn\\|\\>)?"
|
| 86 |
+
},
|
| 87 |
+
"soc_token": "<|channel>",
|
| 88 |
+
"sot_token": "<|turn>",
|
| 89 |
+
"stc_token": "<|tool_call>",
|
| 90 |
+
"std_token": "<|tool>",
|
| 91 |
+
"str_token": "<|tool_response>",
|
| 92 |
+
"think_token": "<|think|>",
|
| 93 |
+
"tokenizer_class": "GemmaTokenizer",
|
| 94 |
+
"unk_token": "<unk>"
|
| 95 |
+
}
|