upload nvfp4
#1
by linzhao-amd - opened
This view is limited to 50 files because it contains too many changes. See the raw diff here.
- .gitattributes +1 -0
- chat_template.jinja +112 -0
- config.json +712 -0
- configuration_deepseek.py +214 -0
- configuration_kimi_k25.py +123 -0
- generation_config.json +8 -0
- kimi_k25_vision_processing.py +251 -0
- media_utils.py +368 -0
- model-00001-of-00119.safetensors +3 -0
- model-00002-of-00119.safetensors +3 -0
- model-00003-of-00119.safetensors +3 -0
- model-00004-of-00119.safetensors +3 -0
- model-00005-of-00119.safetensors +3 -0
- model-00006-of-00119.safetensors +3 -0
- model-00007-of-00119.safetensors +3 -0
- model-00008-of-00119.safetensors +3 -0
- model-00009-of-00119.safetensors +3 -0
- model-00010-of-00119.safetensors +3 -0
- model-00011-of-00119.safetensors +3 -0
- model-00012-of-00119.safetensors +3 -0
- model-00013-of-00119.safetensors +3 -0
- model-00014-of-00119.safetensors +3 -0
- model-00015-of-00119.safetensors +3 -0
- model-00016-of-00119.safetensors +3 -0
- model-00017-of-00119.safetensors +3 -0
- model-00018-of-00119.safetensors +3 -0
- model-00019-of-00119.safetensors +3 -0
- model-00020-of-00119.safetensors +3 -0
- model-00021-of-00119.safetensors +3 -0
- model-00022-of-00119.safetensors +3 -0
- model-00023-of-00119.safetensors +3 -0
- model-00024-of-00119.safetensors +3 -0
- model-00025-of-00119.safetensors +3 -0
- model-00026-of-00119.safetensors +3 -0
- model-00027-of-00119.safetensors +3 -0
- model-00028-of-00119.safetensors +3 -0
- model-00029-of-00119.safetensors +3 -0
- model-00030-of-00119.safetensors +3 -0
- model-00031-of-00119.safetensors +3 -0
- model-00032-of-00119.safetensors +3 -0
- model-00033-of-00119.safetensors +3 -0
- model-00034-of-00119.safetensors +3 -0
- model-00035-of-00119.safetensors +3 -0
- model-00036-of-00119.safetensors +3 -0
- model-00037-of-00119.safetensors +3 -0
- model-00038-of-00119.safetensors +3 -0
- model-00039-of-00119.safetensors +3 -0
- model-00040-of-00119.safetensors +3 -0
- model-00041-of-00119.safetensors +3 -0
- model-00042-of-00119.safetensors +3 -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 |
+
model.safetensors.index.json filter=lfs diff=lfs merge=lfs -text
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- macro render_content(msg) -%}
|
| 2 |
+
{%- set c = msg.get('content') -%}
|
| 3 |
+
{%- if c is string -%}
|
| 4 |
+
{{ c }}
|
| 5 |
+
{%- elif c is not none -%}
|
| 6 |
+
{% for content in c -%}
|
| 7 |
+
{% if content['type'] == 'image' or content['type'] == 'image_url' -%}
|
| 8 |
+
<|media_begin|>image<|media_content|><|media_pad|><|media_end|>
|
| 9 |
+
{% elif content['type'] == 'video' or content['type']== 'video_url'-%}
|
| 10 |
+
<|kimi_k25_video_placeholder|>
|
| 11 |
+
{% else -%}
|
| 12 |
+
{{ content['text'] }}
|
| 13 |
+
{%- endif -%}
|
| 14 |
+
{%- endfor -%}
|
| 15 |
+
{%- endif -%}
|
| 16 |
+
{%- endmacro -%}
|
| 17 |
+
|
| 18 |
+
{% macro set_roles(message) -%}
|
| 19 |
+
{%- set role_name = message.get('name') or message['role'] -%}
|
| 20 |
+
{%- if message['role'] == 'user' -%}
|
| 21 |
+
<|im_user|>{{role_name}}<|im_middle|>
|
| 22 |
+
{%- elif message['role'] == 'assistant' -%}
|
| 23 |
+
<|im_assistant|>{{role_name}}<|im_middle|>
|
| 24 |
+
{%- else -%}
|
| 25 |
+
<|im_system|>{{role_name}}<|im_middle|>
|
| 26 |
+
{%- endif -%}
|
| 27 |
+
{%- endmacro -%}
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
{%- macro render_toolcalls(message) -%}
|
| 31 |
+
<|tool_calls_section_begin|>
|
| 32 |
+
{%- for tool_call in message['tool_calls'] -%}
|
| 33 |
+
{%- set formatted_id = tool_call['id'] -%}
|
| 34 |
+
<|tool_call_begin|>{{ formatted_id }}<|tool_call_argument_begin|>{% if tool_call['function']['arguments'] is string %}{{ tool_call['function']['arguments'] }}{% else %}{{ tool_call['function']['arguments'] | tojson }}{% endif %}<|tool_call_end|>
|
| 35 |
+
{%- endfor -%}
|
| 36 |
+
<|tool_calls_section_end|>
|
| 37 |
+
{%- endmacro -%}
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
{%- set preserve_thinking = preserve_thinking | default(false) -%}
|
| 41 |
+
{# Find last non-tool-call assistant message. If preserve_thinking, keep -1 so hist is empty and all msgs use suffix (retain reasoning). #}
|
| 42 |
+
{%- set ns = namespace(last_non_tool_call_assistant_msg=-1) -%}
|
| 43 |
+
{%- if not preserve_thinking -%}
|
| 44 |
+
{%- for idx in range(messages|length-1, -1, -1) -%}
|
| 45 |
+
{%- if messages[idx]['role'] == 'assistant' and not messages[idx].get('tool_calls') -%}
|
| 46 |
+
{%- set ns.last_non_tool_call_assistant_msg = idx -%}
|
| 47 |
+
{%- break -%}
|
| 48 |
+
{%- endif -%}
|
| 49 |
+
{%- endfor -%}
|
| 50 |
+
{%- endif -%}
|
| 51 |
+
|
| 52 |
+
{# split all messages into history & suffix, reasoning_content in suffix should be reserved.#}
|
| 53 |
+
{%- set hist_msgs = messages[:ns.last_non_tool_call_assistant_msg+1] -%}
|
| 54 |
+
{%- set suffix_msgs = messages[ns.last_non_tool_call_assistant_msg+1:] -%}
|
| 55 |
+
|
| 56 |
+
{%- if tools -%}
|
| 57 |
+
{%- if tools_ts_str -%}
|
| 58 |
+
<|im_system|>tool_declare<|im_middle|>{{ tools_ts_str }}<|im_end|>
|
| 59 |
+
{%- else -%}
|
| 60 |
+
<|im_system|>tool_declare<|im_middle|>{{ tools | tojson(separators=(',', ':')) }}<|im_end|>
|
| 61 |
+
{%- endif -%}
|
| 62 |
+
{%- endif -%}
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
{%- for message in hist_msgs -%}
|
| 66 |
+
{{set_roles(message)}}
|
| 67 |
+
{%- if message['role'] == 'assistant' -%}
|
| 68 |
+
<think></think>{{render_content(message)}}
|
| 69 |
+
{%- if message.get('tool_calls') -%}
|
| 70 |
+
{{render_toolcalls(message)}}
|
| 71 |
+
{%- endif -%}
|
| 72 |
+
{%- elif message['role'] == 'tool' -%}
|
| 73 |
+
{%- set tool_call_id = message.tool_call_id -%}
|
| 74 |
+
## Return of {{ tool_call_id }}
|
| 75 |
+
{{render_content(message)}}
|
| 76 |
+
{%- elif message['content'] is not none -%}
|
| 77 |
+
{{render_content(message)}}
|
| 78 |
+
{%- endif -%}
|
| 79 |
+
<|im_end|>
|
| 80 |
+
{%- endfor -%}
|
| 81 |
+
|
| 82 |
+
{%- for message in suffix_msgs -%}
|
| 83 |
+
{{set_roles(message)}}
|
| 84 |
+
{%- if message['role'] == 'assistant' -%}
|
| 85 |
+
{%- if thinking is defined and thinking is false and preserve_thinking is false -%}
|
| 86 |
+
<think></think>{{render_content(message)}}
|
| 87 |
+
{%- else -%}
|
| 88 |
+
{%- set rc = message.get('reasoning', message.get('reasoning_content', '')) -%}
|
| 89 |
+
<think>{{rc}}</think>{{render_content(message)}}
|
| 90 |
+
{%- endif -%}
|
| 91 |
+
{%- if message.get('tool_calls') -%}
|
| 92 |
+
{{render_toolcalls(message)}}
|
| 93 |
+
{%- endif -%}
|
| 94 |
+
{%- elif message['role'] == 'tool' -%}
|
| 95 |
+
{%- set tool_call_id = message.tool_call_id -%}
|
| 96 |
+
## Return of {{ tool_call_id }}
|
| 97 |
+
{{render_content(message)}}
|
| 98 |
+
{%- elif message['content'] is not none -%}
|
| 99 |
+
{{render_content(message)}}
|
| 100 |
+
{%- endif -%}
|
| 101 |
+
<|im_end|>
|
| 102 |
+
{%- endfor -%}
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
{%- if add_generation_prompt -%}
|
| 106 |
+
<|im_assistant|>assistant<|im_middle|>
|
| 107 |
+
{%- if thinking is defined and thinking is false -%}
|
| 108 |
+
<think></think>
|
| 109 |
+
{%- else -%}
|
| 110 |
+
<think>
|
| 111 |
+
{%- endif -%}
|
| 112 |
+
{%- endif -%}
|
config.json
ADDED
|
@@ -0,0 +1,712 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"KimiK25ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"auto_map": {
|
| 6 |
+
"AutoConfig": "configuration_kimi_k25.KimiK25Config",
|
| 7 |
+
"AutoModel": "modeling_kimi_k25.KimiK25ForConditionalGeneration",
|
| 8 |
+
"AutoModelForCausalLM": "modeling_kimi_k25.KimiK25ForConditionalGeneration"
|
| 9 |
+
},
|
| 10 |
+
"bos_token_id": 163584,
|
| 11 |
+
"dtype": "bfloat16",
|
| 12 |
+
"eos_token_id": 163586,
|
| 13 |
+
"ignore_index": -100,
|
| 14 |
+
"media_placeholder_token_id": 163605,
|
| 15 |
+
"model_type": "kimi_k25",
|
| 16 |
+
"pad_token_id": 163839,
|
| 17 |
+
"quantization_config": {
|
| 18 |
+
"algo_config": null,
|
| 19 |
+
"exclude": [
|
| 20 |
+
"vision_tower.patch_embed.proj",
|
| 21 |
+
"vision_tower.encoder.blocks.0.mlp.fc0",
|
| 22 |
+
"vision_tower.encoder.blocks.0.mlp.fc1",
|
| 23 |
+
"vision_tower.encoder.blocks.0.wqkv",
|
| 24 |
+
"vision_tower.encoder.blocks.0.wo",
|
| 25 |
+
"vision_tower.encoder.blocks.1.mlp.fc0",
|
| 26 |
+
"vision_tower.encoder.blocks.1.mlp.fc1",
|
| 27 |
+
"vision_tower.encoder.blocks.1.wqkv",
|
| 28 |
+
"vision_tower.encoder.blocks.1.wo",
|
| 29 |
+
"vision_tower.encoder.blocks.2.mlp.fc0",
|
| 30 |
+
"vision_tower.encoder.blocks.2.mlp.fc1",
|
| 31 |
+
"vision_tower.encoder.blocks.2.wqkv",
|
| 32 |
+
"vision_tower.encoder.blocks.2.wo",
|
| 33 |
+
"vision_tower.encoder.blocks.3.mlp.fc0",
|
| 34 |
+
"vision_tower.encoder.blocks.3.mlp.fc1",
|
| 35 |
+
"vision_tower.encoder.blocks.3.wqkv",
|
| 36 |
+
"vision_tower.encoder.blocks.3.wo",
|
| 37 |
+
"vision_tower.encoder.blocks.4.mlp.fc0",
|
| 38 |
+
"vision_tower.encoder.blocks.4.mlp.fc1",
|
| 39 |
+
"vision_tower.encoder.blocks.4.wqkv",
|
| 40 |
+
"vision_tower.encoder.blocks.4.wo",
|
| 41 |
+
"vision_tower.encoder.blocks.5.mlp.fc0",
|
| 42 |
+
"vision_tower.encoder.blocks.5.mlp.fc1",
|
| 43 |
+
"vision_tower.encoder.blocks.5.wqkv",
|
| 44 |
+
"vision_tower.encoder.blocks.5.wo",
|
| 45 |
+
"vision_tower.encoder.blocks.6.mlp.fc0",
|
| 46 |
+
"vision_tower.encoder.blocks.6.mlp.fc1",
|
| 47 |
+
"vision_tower.encoder.blocks.6.wqkv",
|
| 48 |
+
"vision_tower.encoder.blocks.6.wo",
|
| 49 |
+
"vision_tower.encoder.blocks.7.mlp.fc0",
|
| 50 |
+
"vision_tower.encoder.blocks.7.mlp.fc1",
|
| 51 |
+
"vision_tower.encoder.blocks.7.wqkv",
|
| 52 |
+
"vision_tower.encoder.blocks.7.wo",
|
| 53 |
+
"vision_tower.encoder.blocks.8.mlp.fc0",
|
| 54 |
+
"vision_tower.encoder.blocks.8.mlp.fc1",
|
| 55 |
+
"vision_tower.encoder.blocks.8.wqkv",
|
| 56 |
+
"vision_tower.encoder.blocks.8.wo",
|
| 57 |
+
"vision_tower.encoder.blocks.9.mlp.fc0",
|
| 58 |
+
"vision_tower.encoder.blocks.9.mlp.fc1",
|
| 59 |
+
"vision_tower.encoder.blocks.9.wqkv",
|
| 60 |
+
"vision_tower.encoder.blocks.9.wo",
|
| 61 |
+
"vision_tower.encoder.blocks.10.mlp.fc0",
|
| 62 |
+
"vision_tower.encoder.blocks.10.mlp.fc1",
|
| 63 |
+
"vision_tower.encoder.blocks.10.wqkv",
|
| 64 |
+
"vision_tower.encoder.blocks.10.wo",
|
| 65 |
+
"vision_tower.encoder.blocks.11.mlp.fc0",
|
| 66 |
+
"vision_tower.encoder.blocks.11.mlp.fc1",
|
| 67 |
+
"vision_tower.encoder.blocks.11.wqkv",
|
| 68 |
+
"vision_tower.encoder.blocks.11.wo",
|
| 69 |
+
"vision_tower.encoder.blocks.12.mlp.fc0",
|
| 70 |
+
"vision_tower.encoder.blocks.12.mlp.fc1",
|
| 71 |
+
"vision_tower.encoder.blocks.12.wqkv",
|
| 72 |
+
"vision_tower.encoder.blocks.12.wo",
|
| 73 |
+
"vision_tower.encoder.blocks.13.mlp.fc0",
|
| 74 |
+
"vision_tower.encoder.blocks.13.mlp.fc1",
|
| 75 |
+
"vision_tower.encoder.blocks.13.wqkv",
|
| 76 |
+
"vision_tower.encoder.blocks.13.wo",
|
| 77 |
+
"vision_tower.encoder.blocks.14.mlp.fc0",
|
| 78 |
+
"vision_tower.encoder.blocks.14.mlp.fc1",
|
| 79 |
+
"vision_tower.encoder.blocks.14.wqkv",
|
| 80 |
+
"vision_tower.encoder.blocks.14.wo",
|
| 81 |
+
"vision_tower.encoder.blocks.15.mlp.fc0",
|
| 82 |
+
"vision_tower.encoder.blocks.15.mlp.fc1",
|
| 83 |
+
"vision_tower.encoder.blocks.15.wqkv",
|
| 84 |
+
"vision_tower.encoder.blocks.15.wo",
|
| 85 |
+
"vision_tower.encoder.blocks.16.mlp.fc0",
|
| 86 |
+
"vision_tower.encoder.blocks.16.mlp.fc1",
|
| 87 |
+
"vision_tower.encoder.blocks.16.wqkv",
|
| 88 |
+
"vision_tower.encoder.blocks.16.wo",
|
| 89 |
+
"vision_tower.encoder.blocks.17.mlp.fc0",
|
| 90 |
+
"vision_tower.encoder.blocks.17.mlp.fc1",
|
| 91 |
+
"vision_tower.encoder.blocks.17.wqkv",
|
| 92 |
+
"vision_tower.encoder.blocks.17.wo",
|
| 93 |
+
"vision_tower.encoder.blocks.18.mlp.fc0",
|
| 94 |
+
"vision_tower.encoder.blocks.18.mlp.fc1",
|
| 95 |
+
"vision_tower.encoder.blocks.18.wqkv",
|
| 96 |
+
"vision_tower.encoder.blocks.18.wo",
|
| 97 |
+
"vision_tower.encoder.blocks.19.mlp.fc0",
|
| 98 |
+
"vision_tower.encoder.blocks.19.mlp.fc1",
|
| 99 |
+
"vision_tower.encoder.blocks.19.wqkv",
|
| 100 |
+
"vision_tower.encoder.blocks.19.wo",
|
| 101 |
+
"vision_tower.encoder.blocks.20.mlp.fc0",
|
| 102 |
+
"vision_tower.encoder.blocks.20.mlp.fc1",
|
| 103 |
+
"vision_tower.encoder.blocks.20.wqkv",
|
| 104 |
+
"vision_tower.encoder.blocks.20.wo",
|
| 105 |
+
"vision_tower.encoder.blocks.21.mlp.fc0",
|
| 106 |
+
"vision_tower.encoder.blocks.21.mlp.fc1",
|
| 107 |
+
"vision_tower.encoder.blocks.21.wqkv",
|
| 108 |
+
"vision_tower.encoder.blocks.21.wo",
|
| 109 |
+
"vision_tower.encoder.blocks.22.mlp.fc0",
|
| 110 |
+
"vision_tower.encoder.blocks.22.mlp.fc1",
|
| 111 |
+
"vision_tower.encoder.blocks.22.wqkv",
|
| 112 |
+
"vision_tower.encoder.blocks.22.wo",
|
| 113 |
+
"vision_tower.encoder.blocks.23.mlp.fc0",
|
| 114 |
+
"vision_tower.encoder.blocks.23.mlp.fc1",
|
| 115 |
+
"vision_tower.encoder.blocks.23.wqkv",
|
| 116 |
+
"vision_tower.encoder.blocks.23.wo",
|
| 117 |
+
"vision_tower.encoder.blocks.24.mlp.fc0",
|
| 118 |
+
"vision_tower.encoder.blocks.24.mlp.fc1",
|
| 119 |
+
"vision_tower.encoder.blocks.24.wqkv",
|
| 120 |
+
"vision_tower.encoder.blocks.24.wo",
|
| 121 |
+
"vision_tower.encoder.blocks.25.mlp.fc0",
|
| 122 |
+
"vision_tower.encoder.blocks.25.mlp.fc1",
|
| 123 |
+
"vision_tower.encoder.blocks.25.wqkv",
|
| 124 |
+
"vision_tower.encoder.blocks.25.wo",
|
| 125 |
+
"vision_tower.encoder.blocks.26.mlp.fc0",
|
| 126 |
+
"vision_tower.encoder.blocks.26.mlp.fc1",
|
| 127 |
+
"vision_tower.encoder.blocks.26.wqkv",
|
| 128 |
+
"vision_tower.encoder.blocks.26.wo",
|
| 129 |
+
"mm_projector.proj.0",
|
| 130 |
+
"mm_projector.proj.2",
|
| 131 |
+
"language_model.model.layers.0.self_attn.q_a_proj",
|
| 132 |
+
"language_model.model.layers.0.self_attn.q_b_proj",
|
| 133 |
+
"language_model.model.layers.0.self_attn.kv_a_proj_with_mqa",
|
| 134 |
+
"language_model.model.layers.0.self_attn.kv_b_proj",
|
| 135 |
+
"language_model.model.layers.0.self_attn.o_proj",
|
| 136 |
+
"language_model.model.layers.1.self_attn.q_a_proj",
|
| 137 |
+
"language_model.model.layers.1.self_attn.q_b_proj",
|
| 138 |
+
"language_model.model.layers.1.self_attn.kv_a_proj_with_mqa",
|
| 139 |
+
"language_model.model.layers.1.self_attn.kv_b_proj",
|
| 140 |
+
"language_model.model.layers.1.self_attn.o_proj",
|
| 141 |
+
"language_model.model.layers.2.self_attn.q_a_proj",
|
| 142 |
+
"language_model.model.layers.2.self_attn.q_b_proj",
|
| 143 |
+
"language_model.model.layers.2.self_attn.kv_a_proj_with_mqa",
|
| 144 |
+
"language_model.model.layers.2.self_attn.kv_b_proj",
|
| 145 |
+
"language_model.model.layers.2.self_attn.o_proj",
|
| 146 |
+
"language_model.model.layers.3.self_attn.q_a_proj",
|
| 147 |
+
"language_model.model.layers.3.self_attn.q_b_proj",
|
| 148 |
+
"language_model.model.layers.3.self_attn.kv_a_proj_with_mqa",
|
| 149 |
+
"language_model.model.layers.3.self_attn.kv_b_proj",
|
| 150 |
+
"language_model.model.layers.3.self_attn.o_proj",
|
| 151 |
+
"language_model.model.layers.4.self_attn.q_a_proj",
|
| 152 |
+
"language_model.model.layers.4.self_attn.q_b_proj",
|
| 153 |
+
"language_model.model.layers.4.self_attn.kv_a_proj_with_mqa",
|
| 154 |
+
"language_model.model.layers.4.self_attn.kv_b_proj",
|
| 155 |
+
"language_model.model.layers.4.self_attn.o_proj",
|
| 156 |
+
"language_model.model.layers.5.self_attn.q_a_proj",
|
| 157 |
+
"language_model.model.layers.5.self_attn.q_b_proj",
|
| 158 |
+
"language_model.model.layers.5.self_attn.kv_a_proj_with_mqa",
|
| 159 |
+
"language_model.model.layers.5.self_attn.kv_b_proj",
|
| 160 |
+
"language_model.model.layers.5.self_attn.o_proj",
|
| 161 |
+
"language_model.model.layers.6.self_attn.q_a_proj",
|
| 162 |
+
"language_model.model.layers.6.self_attn.q_b_proj",
|
| 163 |
+
"language_model.model.layers.6.self_attn.kv_a_proj_with_mqa",
|
| 164 |
+
"language_model.model.layers.6.self_attn.kv_b_proj",
|
| 165 |
+
"language_model.model.layers.6.self_attn.o_proj",
|
| 166 |
+
"language_model.model.layers.7.self_attn.q_a_proj",
|
| 167 |
+
"language_model.model.layers.7.self_attn.q_b_proj",
|
| 168 |
+
"language_model.model.layers.7.self_attn.kv_a_proj_with_mqa",
|
| 169 |
+
"language_model.model.layers.7.self_attn.kv_b_proj",
|
| 170 |
+
"language_model.model.layers.7.self_attn.o_proj",
|
| 171 |
+
"language_model.model.layers.8.self_attn.q_a_proj",
|
| 172 |
+
"language_model.model.layers.8.self_attn.q_b_proj",
|
| 173 |
+
"language_model.model.layers.8.self_attn.kv_a_proj_with_mqa",
|
| 174 |
+
"language_model.model.layers.8.self_attn.kv_b_proj",
|
| 175 |
+
"language_model.model.layers.8.self_attn.o_proj",
|
| 176 |
+
"language_model.model.layers.9.self_attn.q_a_proj",
|
| 177 |
+
"language_model.model.layers.9.self_attn.q_b_proj",
|
| 178 |
+
"language_model.model.layers.9.self_attn.kv_a_proj_with_mqa",
|
| 179 |
+
"language_model.model.layers.9.self_attn.kv_b_proj",
|
| 180 |
+
"language_model.model.layers.9.self_attn.o_proj",
|
| 181 |
+
"language_model.model.layers.10.self_attn.q_a_proj",
|
| 182 |
+
"language_model.model.layers.10.self_attn.q_b_proj",
|
| 183 |
+
"language_model.model.layers.10.self_attn.kv_a_proj_with_mqa",
|
| 184 |
+
"language_model.model.layers.10.self_attn.kv_b_proj",
|
| 185 |
+
"language_model.model.layers.10.self_attn.o_proj",
|
| 186 |
+
"language_model.model.layers.11.self_attn.q_a_proj",
|
| 187 |
+
"language_model.model.layers.11.self_attn.q_b_proj",
|
| 188 |
+
"language_model.model.layers.11.self_attn.kv_a_proj_with_mqa",
|
| 189 |
+
"language_model.model.layers.11.self_attn.kv_b_proj",
|
| 190 |
+
"language_model.model.layers.11.self_attn.o_proj",
|
| 191 |
+
"language_model.model.layers.12.self_attn.q_a_proj",
|
| 192 |
+
"language_model.model.layers.12.self_attn.q_b_proj",
|
| 193 |
+
"language_model.model.layers.12.self_attn.kv_a_proj_with_mqa",
|
| 194 |
+
"language_model.model.layers.12.self_attn.kv_b_proj",
|
| 195 |
+
"language_model.model.layers.12.self_attn.o_proj",
|
| 196 |
+
"language_model.model.layers.13.self_attn.q_a_proj",
|
| 197 |
+
"language_model.model.layers.13.self_attn.q_b_proj",
|
| 198 |
+
"language_model.model.layers.13.self_attn.kv_a_proj_with_mqa",
|
| 199 |
+
"language_model.model.layers.13.self_attn.kv_b_proj",
|
| 200 |
+
"language_model.model.layers.13.self_attn.o_proj",
|
| 201 |
+
"language_model.model.layers.14.self_attn.q_a_proj",
|
| 202 |
+
"language_model.model.layers.14.self_attn.q_b_proj",
|
| 203 |
+
"language_model.model.layers.14.self_attn.kv_a_proj_with_mqa",
|
| 204 |
+
"language_model.model.layers.14.self_attn.kv_b_proj",
|
| 205 |
+
"language_model.model.layers.14.self_attn.o_proj",
|
| 206 |
+
"language_model.model.layers.15.self_attn.q_a_proj",
|
| 207 |
+
"language_model.model.layers.15.self_attn.q_b_proj",
|
| 208 |
+
"language_model.model.layers.15.self_attn.kv_a_proj_with_mqa",
|
| 209 |
+
"language_model.model.layers.15.self_attn.kv_b_proj",
|
| 210 |
+
"language_model.model.layers.15.self_attn.o_proj",
|
| 211 |
+
"language_model.model.layers.16.self_attn.q_a_proj",
|
| 212 |
+
"language_model.model.layers.16.self_attn.q_b_proj",
|
| 213 |
+
"language_model.model.layers.16.self_attn.kv_a_proj_with_mqa",
|
| 214 |
+
"language_model.model.layers.16.self_attn.kv_b_proj",
|
| 215 |
+
"language_model.model.layers.16.self_attn.o_proj",
|
| 216 |
+
"language_model.model.layers.17.self_attn.q_a_proj",
|
| 217 |
+
"language_model.model.layers.17.self_attn.q_b_proj",
|
| 218 |
+
"language_model.model.layers.17.self_attn.kv_a_proj_with_mqa",
|
| 219 |
+
"language_model.model.layers.17.self_attn.kv_b_proj",
|
| 220 |
+
"language_model.model.layers.17.self_attn.o_proj",
|
| 221 |
+
"language_model.model.layers.18.self_attn.q_a_proj",
|
| 222 |
+
"language_model.model.layers.18.self_attn.q_b_proj",
|
| 223 |
+
"language_model.model.layers.18.self_attn.kv_a_proj_with_mqa",
|
| 224 |
+
"language_model.model.layers.18.self_attn.kv_b_proj",
|
| 225 |
+
"language_model.model.layers.18.self_attn.o_proj",
|
| 226 |
+
"language_model.model.layers.19.self_attn.q_a_proj",
|
| 227 |
+
"language_model.model.layers.19.self_attn.q_b_proj",
|
| 228 |
+
"language_model.model.layers.19.self_attn.kv_a_proj_with_mqa",
|
| 229 |
+
"language_model.model.layers.19.self_attn.kv_b_proj",
|
| 230 |
+
"language_model.model.layers.19.self_attn.o_proj",
|
| 231 |
+
"language_model.model.layers.20.self_attn.q_a_proj",
|
| 232 |
+
"language_model.model.layers.20.self_attn.q_b_proj",
|
| 233 |
+
"language_model.model.layers.20.self_attn.kv_a_proj_with_mqa",
|
| 234 |
+
"language_model.model.layers.20.self_attn.kv_b_proj",
|
| 235 |
+
"language_model.model.layers.20.self_attn.o_proj",
|
| 236 |
+
"language_model.model.layers.21.self_attn.q_a_proj",
|
| 237 |
+
"language_model.model.layers.21.self_attn.q_b_proj",
|
| 238 |
+
"language_model.model.layers.21.self_attn.kv_a_proj_with_mqa",
|
| 239 |
+
"language_model.model.layers.21.self_attn.kv_b_proj",
|
| 240 |
+
"language_model.model.layers.21.self_attn.o_proj",
|
| 241 |
+
"language_model.model.layers.22.self_attn.q_a_proj",
|
| 242 |
+
"language_model.model.layers.22.self_attn.q_b_proj",
|
| 243 |
+
"language_model.model.layers.22.self_attn.kv_a_proj_with_mqa",
|
| 244 |
+
"language_model.model.layers.22.self_attn.kv_b_proj",
|
| 245 |
+
"language_model.model.layers.22.self_attn.o_proj",
|
| 246 |
+
"language_model.model.layers.23.self_attn.q_a_proj",
|
| 247 |
+
"language_model.model.layers.23.self_attn.q_b_proj",
|
| 248 |
+
"language_model.model.layers.23.self_attn.kv_a_proj_with_mqa",
|
| 249 |
+
"language_model.model.layers.23.self_attn.kv_b_proj",
|
| 250 |
+
"language_model.model.layers.23.self_attn.o_proj",
|
| 251 |
+
"language_model.model.layers.24.self_attn.q_a_proj",
|
| 252 |
+
"language_model.model.layers.24.self_attn.q_b_proj",
|
| 253 |
+
"language_model.model.layers.24.self_attn.kv_a_proj_with_mqa",
|
| 254 |
+
"language_model.model.layers.24.self_attn.kv_b_proj",
|
| 255 |
+
"language_model.model.layers.24.self_attn.o_proj",
|
| 256 |
+
"language_model.model.layers.25.self_attn.q_a_proj",
|
| 257 |
+
"language_model.model.layers.25.self_attn.q_b_proj",
|
| 258 |
+
"language_model.model.layers.25.self_attn.kv_a_proj_with_mqa",
|
| 259 |
+
"language_model.model.layers.25.self_attn.kv_b_proj",
|
| 260 |
+
"language_model.model.layers.25.self_attn.o_proj",
|
| 261 |
+
"language_model.model.layers.26.self_attn.q_a_proj",
|
| 262 |
+
"language_model.model.layers.26.self_attn.q_b_proj",
|
| 263 |
+
"language_model.model.layers.26.self_attn.kv_a_proj_with_mqa",
|
| 264 |
+
"language_model.model.layers.26.self_attn.kv_b_proj",
|
| 265 |
+
"language_model.model.layers.26.self_attn.o_proj",
|
| 266 |
+
"language_model.model.layers.27.self_attn.q_a_proj",
|
| 267 |
+
"language_model.model.layers.27.self_attn.q_b_proj",
|
| 268 |
+
"language_model.model.layers.27.self_attn.kv_a_proj_with_mqa",
|
| 269 |
+
"language_model.model.layers.27.self_attn.kv_b_proj",
|
| 270 |
+
"language_model.model.layers.27.self_attn.o_proj",
|
| 271 |
+
"language_model.model.layers.28.self_attn.q_a_proj",
|
| 272 |
+
"language_model.model.layers.28.self_attn.q_b_proj",
|
| 273 |
+
"language_model.model.layers.28.self_attn.kv_a_proj_with_mqa",
|
| 274 |
+
"language_model.model.layers.28.self_attn.kv_b_proj",
|
| 275 |
+
"language_model.model.layers.28.self_attn.o_proj",
|
| 276 |
+
"language_model.model.layers.29.self_attn.q_a_proj",
|
| 277 |
+
"language_model.model.layers.29.self_attn.q_b_proj",
|
| 278 |
+
"language_model.model.layers.29.self_attn.kv_a_proj_with_mqa",
|
| 279 |
+
"language_model.model.layers.29.self_attn.kv_b_proj",
|
| 280 |
+
"language_model.model.layers.29.self_attn.o_proj",
|
| 281 |
+
"language_model.model.layers.30.self_attn.q_a_proj",
|
| 282 |
+
"language_model.model.layers.30.self_attn.q_b_proj",
|
| 283 |
+
"language_model.model.layers.30.self_attn.kv_a_proj_with_mqa",
|
| 284 |
+
"language_model.model.layers.30.self_attn.kv_b_proj",
|
| 285 |
+
"language_model.model.layers.30.self_attn.o_proj",
|
| 286 |
+
"language_model.model.layers.31.self_attn.q_a_proj",
|
| 287 |
+
"language_model.model.layers.31.self_attn.q_b_proj",
|
| 288 |
+
"language_model.model.layers.31.self_attn.kv_a_proj_with_mqa",
|
| 289 |
+
"language_model.model.layers.31.self_attn.kv_b_proj",
|
| 290 |
+
"language_model.model.layers.31.self_attn.o_proj",
|
| 291 |
+
"language_model.model.layers.32.self_attn.q_a_proj",
|
| 292 |
+
"language_model.model.layers.32.self_attn.q_b_proj",
|
| 293 |
+
"language_model.model.layers.32.self_attn.kv_a_proj_with_mqa",
|
| 294 |
+
"language_model.model.layers.32.self_attn.kv_b_proj",
|
| 295 |
+
"language_model.model.layers.32.self_attn.o_proj",
|
| 296 |
+
"language_model.model.layers.33.self_attn.q_a_proj",
|
| 297 |
+
"language_model.model.layers.33.self_attn.q_b_proj",
|
| 298 |
+
"language_model.model.layers.33.self_attn.kv_a_proj_with_mqa",
|
| 299 |
+
"language_model.model.layers.33.self_attn.kv_b_proj",
|
| 300 |
+
"language_model.model.layers.33.self_attn.o_proj",
|
| 301 |
+
"language_model.model.layers.34.self_attn.q_a_proj",
|
| 302 |
+
"language_model.model.layers.34.self_attn.q_b_proj",
|
| 303 |
+
"language_model.model.layers.34.self_attn.kv_a_proj_with_mqa",
|
| 304 |
+
"language_model.model.layers.34.self_attn.kv_b_proj",
|
| 305 |
+
"language_model.model.layers.34.self_attn.o_proj",
|
| 306 |
+
"language_model.model.layers.35.self_attn.q_a_proj",
|
| 307 |
+
"language_model.model.layers.35.self_attn.q_b_proj",
|
| 308 |
+
"language_model.model.layers.35.self_attn.kv_a_proj_with_mqa",
|
| 309 |
+
"language_model.model.layers.35.self_attn.kv_b_proj",
|
| 310 |
+
"language_model.model.layers.35.self_attn.o_proj",
|
| 311 |
+
"language_model.model.layers.36.self_attn.q_a_proj",
|
| 312 |
+
"language_model.model.layers.36.self_attn.q_b_proj",
|
| 313 |
+
"language_model.model.layers.36.self_attn.kv_a_proj_with_mqa",
|
| 314 |
+
"language_model.model.layers.36.self_attn.kv_b_proj",
|
| 315 |
+
"language_model.model.layers.36.self_attn.o_proj",
|
| 316 |
+
"language_model.model.layers.37.self_attn.q_a_proj",
|
| 317 |
+
"language_model.model.layers.37.self_attn.q_b_proj",
|
| 318 |
+
"language_model.model.layers.37.self_attn.kv_a_proj_with_mqa",
|
| 319 |
+
"language_model.model.layers.37.self_attn.kv_b_proj",
|
| 320 |
+
"language_model.model.layers.37.self_attn.o_proj",
|
| 321 |
+
"language_model.model.layers.38.self_attn.q_a_proj",
|
| 322 |
+
"language_model.model.layers.38.self_attn.q_b_proj",
|
| 323 |
+
"language_model.model.layers.38.self_attn.kv_a_proj_with_mqa",
|
| 324 |
+
"language_model.model.layers.38.self_attn.kv_b_proj",
|
| 325 |
+
"language_model.model.layers.38.self_attn.o_proj",
|
| 326 |
+
"language_model.model.layers.39.self_attn.q_a_proj",
|
| 327 |
+
"language_model.model.layers.39.self_attn.q_b_proj",
|
| 328 |
+
"language_model.model.layers.39.self_attn.kv_a_proj_with_mqa",
|
| 329 |
+
"language_model.model.layers.39.self_attn.kv_b_proj",
|
| 330 |
+
"language_model.model.layers.39.self_attn.o_proj",
|
| 331 |
+
"language_model.model.layers.40.self_attn.q_a_proj",
|
| 332 |
+
"language_model.model.layers.40.self_attn.q_b_proj",
|
| 333 |
+
"language_model.model.layers.40.self_attn.kv_a_proj_with_mqa",
|
| 334 |
+
"language_model.model.layers.40.self_attn.kv_b_proj",
|
| 335 |
+
"language_model.model.layers.40.self_attn.o_proj",
|
| 336 |
+
"language_model.model.layers.41.self_attn.q_a_proj",
|
| 337 |
+
"language_model.model.layers.41.self_attn.q_b_proj",
|
| 338 |
+
"language_model.model.layers.41.self_attn.kv_a_proj_with_mqa",
|
| 339 |
+
"language_model.model.layers.41.self_attn.kv_b_proj",
|
| 340 |
+
"language_model.model.layers.41.self_attn.o_proj",
|
| 341 |
+
"language_model.model.layers.42.self_attn.q_a_proj",
|
| 342 |
+
"language_model.model.layers.42.self_attn.q_b_proj",
|
| 343 |
+
"language_model.model.layers.42.self_attn.kv_a_proj_with_mqa",
|
| 344 |
+
"language_model.model.layers.42.self_attn.kv_b_proj",
|
| 345 |
+
"language_model.model.layers.42.self_attn.o_proj",
|
| 346 |
+
"language_model.model.layers.43.self_attn.q_a_proj",
|
| 347 |
+
"language_model.model.layers.43.self_attn.q_b_proj",
|
| 348 |
+
"language_model.model.layers.43.self_attn.kv_a_proj_with_mqa",
|
| 349 |
+
"language_model.model.layers.43.self_attn.kv_b_proj",
|
| 350 |
+
"language_model.model.layers.43.self_attn.o_proj",
|
| 351 |
+
"language_model.model.layers.44.self_attn.q_a_proj",
|
| 352 |
+
"language_model.model.layers.44.self_attn.q_b_proj",
|
| 353 |
+
"language_model.model.layers.44.self_attn.kv_a_proj_with_mqa",
|
| 354 |
+
"language_model.model.layers.44.self_attn.kv_b_proj",
|
| 355 |
+
"language_model.model.layers.44.self_attn.o_proj",
|
| 356 |
+
"language_model.model.layers.45.self_attn.q_a_proj",
|
| 357 |
+
"language_model.model.layers.45.self_attn.q_b_proj",
|
| 358 |
+
"language_model.model.layers.45.self_attn.kv_a_proj_with_mqa",
|
| 359 |
+
"language_model.model.layers.45.self_attn.kv_b_proj",
|
| 360 |
+
"language_model.model.layers.45.self_attn.o_proj",
|
| 361 |
+
"language_model.model.layers.46.self_attn.q_a_proj",
|
| 362 |
+
"language_model.model.layers.46.self_attn.q_b_proj",
|
| 363 |
+
"language_model.model.layers.46.self_attn.kv_a_proj_with_mqa",
|
| 364 |
+
"language_model.model.layers.46.self_attn.kv_b_proj",
|
| 365 |
+
"language_model.model.layers.46.self_attn.o_proj",
|
| 366 |
+
"language_model.model.layers.47.self_attn.q_a_proj",
|
| 367 |
+
"language_model.model.layers.47.self_attn.q_b_proj",
|
| 368 |
+
"language_model.model.layers.47.self_attn.kv_a_proj_with_mqa",
|
| 369 |
+
"language_model.model.layers.47.self_attn.kv_b_proj",
|
| 370 |
+
"language_model.model.layers.47.self_attn.o_proj",
|
| 371 |
+
"language_model.model.layers.48.self_attn.q_a_proj",
|
| 372 |
+
"language_model.model.layers.48.self_attn.q_b_proj",
|
| 373 |
+
"language_model.model.layers.48.self_attn.kv_a_proj_with_mqa",
|
| 374 |
+
"language_model.model.layers.48.self_attn.kv_b_proj",
|
| 375 |
+
"language_model.model.layers.48.self_attn.o_proj",
|
| 376 |
+
"language_model.model.layers.49.self_attn.q_a_proj",
|
| 377 |
+
"language_model.model.layers.49.self_attn.q_b_proj",
|
| 378 |
+
"language_model.model.layers.49.self_attn.kv_a_proj_with_mqa",
|
| 379 |
+
"language_model.model.layers.49.self_attn.kv_b_proj",
|
| 380 |
+
"language_model.model.layers.49.self_attn.o_proj",
|
| 381 |
+
"language_model.model.layers.50.self_attn.q_a_proj",
|
| 382 |
+
"language_model.model.layers.50.self_attn.q_b_proj",
|
| 383 |
+
"language_model.model.layers.50.self_attn.kv_a_proj_with_mqa",
|
| 384 |
+
"language_model.model.layers.50.self_attn.kv_b_proj",
|
| 385 |
+
"language_model.model.layers.50.self_attn.o_proj",
|
| 386 |
+
"language_model.model.layers.51.self_attn.q_a_proj",
|
| 387 |
+
"language_model.model.layers.51.self_attn.q_b_proj",
|
| 388 |
+
"language_model.model.layers.51.self_attn.kv_a_proj_with_mqa",
|
| 389 |
+
"language_model.model.layers.51.self_attn.kv_b_proj",
|
| 390 |
+
"language_model.model.layers.51.self_attn.o_proj",
|
| 391 |
+
"language_model.model.layers.52.self_attn.q_a_proj",
|
| 392 |
+
"language_model.model.layers.52.self_attn.q_b_proj",
|
| 393 |
+
"language_model.model.layers.52.self_attn.kv_a_proj_with_mqa",
|
| 394 |
+
"language_model.model.layers.52.self_attn.kv_b_proj",
|
| 395 |
+
"language_model.model.layers.52.self_attn.o_proj",
|
| 396 |
+
"language_model.model.layers.53.self_attn.q_a_proj",
|
| 397 |
+
"language_model.model.layers.53.self_attn.q_b_proj",
|
| 398 |
+
"language_model.model.layers.53.self_attn.kv_a_proj_with_mqa",
|
| 399 |
+
"language_model.model.layers.53.self_attn.kv_b_proj",
|
| 400 |
+
"language_model.model.layers.53.self_attn.o_proj",
|
| 401 |
+
"language_model.model.layers.54.self_attn.q_a_proj",
|
| 402 |
+
"language_model.model.layers.54.self_attn.q_b_proj",
|
| 403 |
+
"language_model.model.layers.54.self_attn.kv_a_proj_with_mqa",
|
| 404 |
+
"language_model.model.layers.54.self_attn.kv_b_proj",
|
| 405 |
+
"language_model.model.layers.54.self_attn.o_proj",
|
| 406 |
+
"language_model.model.layers.55.self_attn.q_a_proj",
|
| 407 |
+
"language_model.model.layers.55.self_attn.q_b_proj",
|
| 408 |
+
"language_model.model.layers.55.self_attn.kv_a_proj_with_mqa",
|
| 409 |
+
"language_model.model.layers.55.self_attn.kv_b_proj",
|
| 410 |
+
"language_model.model.layers.55.self_attn.o_proj",
|
| 411 |
+
"language_model.model.layers.56.self_attn.q_a_proj",
|
| 412 |
+
"language_model.model.layers.56.self_attn.q_b_proj",
|
| 413 |
+
"language_model.model.layers.56.self_attn.kv_a_proj_with_mqa",
|
| 414 |
+
"language_model.model.layers.56.self_attn.kv_b_proj",
|
| 415 |
+
"language_model.model.layers.56.self_attn.o_proj",
|
| 416 |
+
"language_model.model.layers.57.self_attn.q_a_proj",
|
| 417 |
+
"language_model.model.layers.57.self_attn.q_b_proj",
|
| 418 |
+
"language_model.model.layers.57.self_attn.kv_a_proj_with_mqa",
|
| 419 |
+
"language_model.model.layers.57.self_attn.kv_b_proj",
|
| 420 |
+
"language_model.model.layers.57.self_attn.o_proj",
|
| 421 |
+
"language_model.model.layers.58.self_attn.q_a_proj",
|
| 422 |
+
"language_model.model.layers.58.self_attn.q_b_proj",
|
| 423 |
+
"language_model.model.layers.58.self_attn.kv_a_proj_with_mqa",
|
| 424 |
+
"language_model.model.layers.58.self_attn.kv_b_proj",
|
| 425 |
+
"language_model.model.layers.58.self_attn.o_proj",
|
| 426 |
+
"language_model.model.layers.59.self_attn.q_a_proj",
|
| 427 |
+
"language_model.model.layers.59.self_attn.q_b_proj",
|
| 428 |
+
"language_model.model.layers.59.self_attn.kv_a_proj_with_mqa",
|
| 429 |
+
"language_model.model.layers.59.self_attn.kv_b_proj",
|
| 430 |
+
"language_model.model.layers.59.self_attn.o_proj",
|
| 431 |
+
"language_model.model.layers.60.self_attn.q_a_proj",
|
| 432 |
+
"language_model.model.layers.60.self_attn.q_b_proj",
|
| 433 |
+
"language_model.model.layers.60.self_attn.kv_a_proj_with_mqa",
|
| 434 |
+
"language_model.model.layers.60.self_attn.kv_b_proj",
|
| 435 |
+
"language_model.model.layers.60.self_attn.o_proj",
|
| 436 |
+
"language_model.lm_head"
|
| 437 |
+
],
|
| 438 |
+
"export": {
|
| 439 |
+
"kv_cache_group": [],
|
| 440 |
+
"min_kv_scale": 0.0,
|
| 441 |
+
"pack_method": "reorder",
|
| 442 |
+
"weight_format": "real_quantized",
|
| 443 |
+
"weight_merge_groups": null
|
| 444 |
+
},
|
| 445 |
+
"global_quant_config": {
|
| 446 |
+
"bias": null,
|
| 447 |
+
"input_tensors": [
|
| 448 |
+
{
|
| 449 |
+
"block_size": null,
|
| 450 |
+
"ch_axis": -1,
|
| 451 |
+
"dtype": "fp4",
|
| 452 |
+
"enable_buffer_reuse": false,
|
| 453 |
+
"group_size": 16,
|
| 454 |
+
"is_dynamic": true,
|
| 455 |
+
"is_scale_quant": false,
|
| 456 |
+
"max_input_numel": 4194304,
|
| 457 |
+
"mx_element_dtype": null,
|
| 458 |
+
"observer_cls": "PerBlockMXObserver",
|
| 459 |
+
"qscheme": "per_group",
|
| 460 |
+
"round_method": "half_even",
|
| 461 |
+
"scale_calculation_mode": null,
|
| 462 |
+
"scale_format": "float32",
|
| 463 |
+
"scale_type": "float32",
|
| 464 |
+
"symmetric": null
|
| 465 |
+
},
|
| 466 |
+
{
|
| 467 |
+
"block_size": null,
|
| 468 |
+
"ch_axis": null,
|
| 469 |
+
"dtype": "fp8_e4m3",
|
| 470 |
+
"enable_buffer_reuse": false,
|
| 471 |
+
"group_size": null,
|
| 472 |
+
"is_dynamic": false,
|
| 473 |
+
"is_scale_quant": true,
|
| 474 |
+
"max_input_numel": 4194304,
|
| 475 |
+
"mx_element_dtype": null,
|
| 476 |
+
"observer_cls": "PerTensorMinMaxObserver",
|
| 477 |
+
"qscheme": "per_tensor",
|
| 478 |
+
"round_method": "half_even",
|
| 479 |
+
"scale_calculation_mode": null,
|
| 480 |
+
"scale_format": null,
|
| 481 |
+
"scale_type": "float32",
|
| 482 |
+
"symmetric": true
|
| 483 |
+
}
|
| 484 |
+
],
|
| 485 |
+
"output_tensors": null,
|
| 486 |
+
"target_device": null,
|
| 487 |
+
"weight": [
|
| 488 |
+
{
|
| 489 |
+
"block_size": null,
|
| 490 |
+
"ch_axis": -1,
|
| 491 |
+
"dtype": "fp4",
|
| 492 |
+
"enable_buffer_reuse": false,
|
| 493 |
+
"group_size": 16,
|
| 494 |
+
"is_dynamic": false,
|
| 495 |
+
"is_scale_quant": false,
|
| 496 |
+
"max_input_numel": 4194304,
|
| 497 |
+
"mx_element_dtype": null,
|
| 498 |
+
"observer_cls": "PerBlockMXObserver",
|
| 499 |
+
"qscheme": "per_group",
|
| 500 |
+
"round_method": "half_even",
|
| 501 |
+
"scale_calculation_mode": null,
|
| 502 |
+
"scale_format": "float32",
|
| 503 |
+
"scale_type": "float32",
|
| 504 |
+
"symmetric": null
|
| 505 |
+
},
|
| 506 |
+
{
|
| 507 |
+
"block_size": null,
|
| 508 |
+
"ch_axis": null,
|
| 509 |
+
"dtype": "fp8_e4m3",
|
| 510 |
+
"enable_buffer_reuse": false,
|
| 511 |
+
"group_size": null,
|
| 512 |
+
"is_dynamic": false,
|
| 513 |
+
"is_scale_quant": true,
|
| 514 |
+
"max_input_numel": 4194304,
|
| 515 |
+
"mx_element_dtype": null,
|
| 516 |
+
"observer_cls": "PerTensorMinMaxObserver",
|
| 517 |
+
"qscheme": "per_tensor",
|
| 518 |
+
"round_method": "half_even",
|
| 519 |
+
"scale_calculation_mode": null,
|
| 520 |
+
"scale_format": null,
|
| 521 |
+
"scale_type": "float32",
|
| 522 |
+
"symmetric": true
|
| 523 |
+
}
|
| 524 |
+
]
|
| 525 |
+
},
|
| 526 |
+
"kv_cache_post_rope": false,
|
| 527 |
+
"kv_cache_quant_config": {},
|
| 528 |
+
"layer_quant_config": {},
|
| 529 |
+
"layer_type_quant_config": {},
|
| 530 |
+
"quant_method": "quark",
|
| 531 |
+
"quant_mode": "eager_mode",
|
| 532 |
+
"softmax_quant_spec": null,
|
| 533 |
+
"version": "0.12+13caa7b4951"
|
| 534 |
+
},
|
| 535 |
+
"text_config": {
|
| 536 |
+
"_name_or_path": "",
|
| 537 |
+
"add_cross_attention": false,
|
| 538 |
+
"architectures": [
|
| 539 |
+
"DeepseekV3ForCausalLM"
|
| 540 |
+
],
|
| 541 |
+
"attention_bias": false,
|
| 542 |
+
"attention_dropout": 0.0,
|
| 543 |
+
"auto_map": {
|
| 544 |
+
"AutoConfig": "configuration_deepseek.DeepseekV3Config",
|
| 545 |
+
"AutoModel": "modeling_deepseek.DeepseekV3Model",
|
| 546 |
+
"AutoModelForCausalLM": "modeling_deepseek.DeepseekV3ForCausalLM"
|
| 547 |
+
},
|
| 548 |
+
"aux_loss_alpha": 0.001,
|
| 549 |
+
"bad_words_ids": null,
|
| 550 |
+
"begin_suppress_tokens": null,
|
| 551 |
+
"bos_token_id": 163584,
|
| 552 |
+
"chunk_size_feed_forward": 0,
|
| 553 |
+
"cross_attention_hidden_size": null,
|
| 554 |
+
"decoder_start_token_id": null,
|
| 555 |
+
"diversity_penalty": 0.0,
|
| 556 |
+
"do_sample": false,
|
| 557 |
+
"dtype": "bfloat16",
|
| 558 |
+
"early_stopping": false,
|
| 559 |
+
"encoder_no_repeat_ngram_size": 0,
|
| 560 |
+
"eos_token_id": 163586,
|
| 561 |
+
"ep_size": 1,
|
| 562 |
+
"exponential_decay_length_penalty": null,
|
| 563 |
+
"finetuning_task": null,
|
| 564 |
+
"first_k_dense_replace": 1,
|
| 565 |
+
"forced_bos_token_id": null,
|
| 566 |
+
"forced_eos_token_id": null,
|
| 567 |
+
"hidden_act": "silu",
|
| 568 |
+
"hidden_size": 7168,
|
| 569 |
+
"id2label": {
|
| 570 |
+
"0": "LABEL_0",
|
| 571 |
+
"1": "LABEL_1"
|
| 572 |
+
},
|
| 573 |
+
"initializer_range": 0.02,
|
| 574 |
+
"intermediate_size": 18432,
|
| 575 |
+
"is_decoder": false,
|
| 576 |
+
"is_encoder_decoder": false,
|
| 577 |
+
"kv_lora_rank": 512,
|
| 578 |
+
"label2id": {
|
| 579 |
+
"LABEL_0": 0,
|
| 580 |
+
"LABEL_1": 1
|
| 581 |
+
},
|
| 582 |
+
"length_penalty": 1.0,
|
| 583 |
+
"max_length": 20,
|
| 584 |
+
"max_position_embeddings": 262144,
|
| 585 |
+
"min_length": 0,
|
| 586 |
+
"model_type": "deepseek_v3",
|
| 587 |
+
"moe_intermediate_size": 2048,
|
| 588 |
+
"moe_layer_freq": 1,
|
| 589 |
+
"n_group": 1,
|
| 590 |
+
"n_routed_experts": 384,
|
| 591 |
+
"n_shared_experts": 1,
|
| 592 |
+
"no_repeat_ngram_size": 0,
|
| 593 |
+
"norm_topk_prob": true,
|
| 594 |
+
"num_attention_heads": 64,
|
| 595 |
+
"num_beam_groups": 1,
|
| 596 |
+
"num_beams": 1,
|
| 597 |
+
"num_experts_per_tok": 8,
|
| 598 |
+
"num_hidden_layers": 61,
|
| 599 |
+
"num_key_value_heads": 64,
|
| 600 |
+
"num_nextn_predict_layers": 0,
|
| 601 |
+
"num_return_sequences": 1,
|
| 602 |
+
"output_attentions": false,
|
| 603 |
+
"output_hidden_states": false,
|
| 604 |
+
"output_scores": false,
|
| 605 |
+
"pad_token_id": 163839,
|
| 606 |
+
"prefix": null,
|
| 607 |
+
"pretraining_tp": 1,
|
| 608 |
+
"problem_type": null,
|
| 609 |
+
"pruned_heads": {},
|
| 610 |
+
"q_lora_rank": 1536,
|
| 611 |
+
"qk_nope_head_dim": 128,
|
| 612 |
+
"qk_rope_head_dim": 64,
|
| 613 |
+
"quantization_config": {
|
| 614 |
+
"config_groups": {
|
| 615 |
+
"group_0": {
|
| 616 |
+
"input_activations": null,
|
| 617 |
+
"output_activations": null,
|
| 618 |
+
"targets": [
|
| 619 |
+
"Linear"
|
| 620 |
+
],
|
| 621 |
+
"weights": {
|
| 622 |
+
"actorder": null,
|
| 623 |
+
"block_structure": null,
|
| 624 |
+
"dynamic": false,
|
| 625 |
+
"group_size": 32,
|
| 626 |
+
"num_bits": 4,
|
| 627 |
+
"observer": "minmax",
|
| 628 |
+
"observer_kwargs": {},
|
| 629 |
+
"strategy": "group",
|
| 630 |
+
"symmetric": true,
|
| 631 |
+
"type": "int"
|
| 632 |
+
}
|
| 633 |
+
}
|
| 634 |
+
},
|
| 635 |
+
"format": "pack-quantized",
|
| 636 |
+
"ignore": [
|
| 637 |
+
"re:.*self_attn.*",
|
| 638 |
+
"re:.*shared_experts.*",
|
| 639 |
+
"re:.*mlp\\.(gate|up|gate_up|down)_proj.*",
|
| 640 |
+
"re:.*lm_head.*",
|
| 641 |
+
"re:vision_tower.*",
|
| 642 |
+
"re:mm_projector.*"
|
| 643 |
+
],
|
| 644 |
+
"kv_cache_scheme": null,
|
| 645 |
+
"quant_method": "compressed-tensors",
|
| 646 |
+
"quantization_status": "compressed"
|
| 647 |
+
},
|
| 648 |
+
"remove_invalid_values": false,
|
| 649 |
+
"repetition_penalty": 1.0,
|
| 650 |
+
"return_dict": true,
|
| 651 |
+
"return_dict_in_generate": false,
|
| 652 |
+
"rms_norm_eps": 1e-05,
|
| 653 |
+
"rope_scaling": {
|
| 654 |
+
"beta_fast": 32.0,
|
| 655 |
+
"beta_slow": 1.0,
|
| 656 |
+
"factor": 64.0,
|
| 657 |
+
"mscale": 1.0,
|
| 658 |
+
"mscale_all_dim": 1.0,
|
| 659 |
+
"original_max_position_embeddings": 4096,
|
| 660 |
+
"type": "yarn"
|
| 661 |
+
},
|
| 662 |
+
"rope_theta": 50000.0,
|
| 663 |
+
"routed_scaling_factor": 2.827,
|
| 664 |
+
"scoring_func": "sigmoid",
|
| 665 |
+
"sep_token_id": null,
|
| 666 |
+
"seq_aux": true,
|
| 667 |
+
"suppress_tokens": null,
|
| 668 |
+
"task_specific_params": null,
|
| 669 |
+
"temperature": 1.0,
|
| 670 |
+
"tf_legacy_loss": false,
|
| 671 |
+
"tie_encoder_decoder": false,
|
| 672 |
+
"tie_word_embeddings": false,
|
| 673 |
+
"tokenizer_class": null,
|
| 674 |
+
"top_k": 50,
|
| 675 |
+
"top_p": 1.0,
|
| 676 |
+
"topk_group": 1,
|
| 677 |
+
"topk_method": "noaux_tc",
|
| 678 |
+
"torchscript": false,
|
| 679 |
+
"typical_p": 1.0,
|
| 680 |
+
"use_bfloat16": false,
|
| 681 |
+
"use_cache": true,
|
| 682 |
+
"v_head_dim": 128,
|
| 683 |
+
"vocab_size": 163840
|
| 684 |
+
},
|
| 685 |
+
"tie_word_embeddings": false,
|
| 686 |
+
"transformers_version": "4.57.6",
|
| 687 |
+
"use_unified_vision_chunk": true,
|
| 688 |
+
"video_placeholder": "<|kimi_k25_video_placeholder|>",
|
| 689 |
+
"vision_config": {
|
| 690 |
+
"init_pos_emb_height": 64,
|
| 691 |
+
"init_pos_emb_time": 4,
|
| 692 |
+
"init_pos_emb_width": 64,
|
| 693 |
+
"merge_kernel_size": [
|
| 694 |
+
2,
|
| 695 |
+
2
|
| 696 |
+
],
|
| 697 |
+
"merge_type": "sd2_tpool",
|
| 698 |
+
"mm_hidden_size": 1152,
|
| 699 |
+
"mm_projector_type": "patchmerger",
|
| 700 |
+
"model_type": "",
|
| 701 |
+
"patch_size": 14,
|
| 702 |
+
"pos_emb_type": "divided_fixed",
|
| 703 |
+
"projector_hidden_act": "gelu",
|
| 704 |
+
"projector_ln_eps": 1e-05,
|
| 705 |
+
"text_hidden_size": 7168,
|
| 706 |
+
"video_attn_type": "spatial_temporal",
|
| 707 |
+
"vt_hidden_size": 1152,
|
| 708 |
+
"vt_intermediate_size": 4304,
|
| 709 |
+
"vt_num_attention_heads": 16,
|
| 710 |
+
"vt_num_hidden_layers": 27
|
| 711 |
+
}
|
| 712 |
+
}
|
configuration_deepseek.py
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copy from https://huggingface.co/deepseek-ai/DeepSeek-V3/blob/main/configuration_deepseek.py
|
| 2 |
+
|
| 3 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 4 |
+
from transformers.utils import logging
|
| 5 |
+
|
| 6 |
+
logger = logging.get_logger(__name__)
|
| 7 |
+
|
| 8 |
+
DEEPSEEK_PRETRAINED_CONFIG_ARCHIVE_MAP = {}
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
class DeepseekV3Config(PretrainedConfig):
|
| 12 |
+
r"""
|
| 13 |
+
This is the configuration class to store the configuration of a [`DeepseekV3Model`]. It is used to instantiate an DeepSeek
|
| 14 |
+
model according to the specified arguments, defining the model architecture. Instantiating a configuration with the
|
| 15 |
+
defaults will yield a similar configuration to that of the DeepSeek-V3.
|
| 16 |
+
|
| 17 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 18 |
+
documentation from [`PretrainedConfig`] for more information.
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
Args:
|
| 22 |
+
vocab_size (`int`, *optional*, defaults to 129280):
|
| 23 |
+
Vocabulary size of the Deep model. Defines the number of different tokens that can be represented by the
|
| 24 |
+
`inputs_ids` passed when calling [`DeepseekV3Model`]
|
| 25 |
+
hidden_size (`int`, *optional*, defaults to 4096):
|
| 26 |
+
Dimension of the hidden representations.
|
| 27 |
+
intermediate_size (`int`, *optional*, defaults to 11008):
|
| 28 |
+
Dimension of the MLP representations.
|
| 29 |
+
moe_intermediate_size (`int`, *optional*, defaults to 1407):
|
| 30 |
+
Dimension of the MoE representations.
|
| 31 |
+
num_hidden_layers (`int`, *optional*, defaults to 32):
|
| 32 |
+
Number of hidden layers in the Transformer decoder.
|
| 33 |
+
num_nextn_predict_layers (`int`, *optional*, defaults to 1):
|
| 34 |
+
Number of nextn predict layers in the DeepSeekV3 Model.
|
| 35 |
+
num_attention_heads (`int`, *optional*, defaults to 32):
|
| 36 |
+
Number of attention heads for each attention layer in the Transformer decoder.
|
| 37 |
+
n_shared_experts (`int`, *optional*, defaults to None):
|
| 38 |
+
Number of shared experts, None means dense model.
|
| 39 |
+
n_routed_experts (`int`, *optional*, defaults to None):
|
| 40 |
+
Number of routed experts, None means dense model.
|
| 41 |
+
routed_scaling_factor (`float`, *optional*, defaults to 1.0):
|
| 42 |
+
Scaling factor or routed experts.
|
| 43 |
+
topk_method (`str`, *optional*, defaults to `gready`):
|
| 44 |
+
Topk method used in routed gate.
|
| 45 |
+
n_group (`int`, *optional*, defaults to None):
|
| 46 |
+
Number of groups for routed experts.
|
| 47 |
+
topk_group (`int`, *optional*, defaults to None):
|
| 48 |
+
Number of selected groups for each token(for each token, ensuring the selected experts is only within `topk_group` groups).
|
| 49 |
+
num_experts_per_tok (`int`, *optional*, defaults to None):
|
| 50 |
+
Number of selected experts, None means dense model.
|
| 51 |
+
moe_layer_freq (`int`, *optional*, defaults to 1):
|
| 52 |
+
The frequency of the MoE layer: one expert layer for every `moe_layer_freq - 1` dense layers.
|
| 53 |
+
first_k_dense_replace (`int`, *optional*, defaults to 0):
|
| 54 |
+
Number of dense layers in shallow layers(embed->dense->dense->...->dense->moe->moe...->lm_head).
|
| 55 |
+
\--k dense layers--/
|
| 56 |
+
norm_topk_prob (`bool`, *optional*, defaults to False):
|
| 57 |
+
Whether to normalize the weights of the routed experts.
|
| 58 |
+
scoring_func (`str`, *optional*, defaults to 'softmax'):
|
| 59 |
+
Method of computing expert weights.
|
| 60 |
+
aux_loss_alpha (`float`, *optional*, defaults to 0.001):
|
| 61 |
+
Auxiliary loss weight coefficient.
|
| 62 |
+
seq_aux = (`bool`, *optional*, defaults to True):
|
| 63 |
+
Whether to compute the auxiliary loss for each individual sample.
|
| 64 |
+
num_key_value_heads (`int`, *optional*):
|
| 65 |
+
This is the number of key_value heads that should be used to implement Grouped Query Attention. If
|
| 66 |
+
`num_key_value_heads=num_attention_heads`, the model will use Multi Head Attention (MHA), if
|
| 67 |
+
`num_key_value_heads=1 the model will use Multi Query Attention (MQA) otherwise GQA is used. When
|
| 68 |
+
converting a multi-head checkpoint to a GQA checkpoint, each group key and value head should be constructed
|
| 69 |
+
by meanpooling all the original heads within that group. For more details checkout [this
|
| 70 |
+
paper](https://arxiv.org/pdf/2305.13245.pdf). If it is not specified, will default to
|
| 71 |
+
`num_attention_heads`.
|
| 72 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"silu"`):
|
| 73 |
+
The non-linear activation function (function or string) in the decoder.
|
| 74 |
+
max_position_embeddings (`int`, *optional*, defaults to 2048):
|
| 75 |
+
The maximum sequence length that this model might ever be used with.
|
| 76 |
+
initializer_range (`float`, *optional*, defaults to 0.02):
|
| 77 |
+
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
|
| 78 |
+
rms_norm_eps (`float`, *optional*, defaults to 1e-06):
|
| 79 |
+
The epsilon used by the rms normalization layers.
|
| 80 |
+
use_cache (`bool`, *optional*, defaults to `True`):
|
| 81 |
+
Whether or not the model should return the last key/values attentions (not used by all models). Only
|
| 82 |
+
relevant if `config.is_decoder=True`.
|
| 83 |
+
pad_token_id (`int`, *optional*):
|
| 84 |
+
Padding token id.
|
| 85 |
+
bos_token_id (`int`, *optional*, defaults to 1):
|
| 86 |
+
Beginning of stream token id.
|
| 87 |
+
eos_token_id (`int`, *optional*, defaults to 2):
|
| 88 |
+
End of stream token id.
|
| 89 |
+
pretraining_tp (`int`, *optional*, defaults to 1):
|
| 90 |
+
Experimental feature. Tensor parallelism rank used during pretraining. Please refer to [this
|
| 91 |
+
document](https://huggingface.co/docs/transformers/parallelism) to understand more about it. This value is
|
| 92 |
+
necessary to ensure exact reproducibility of the pretraining results. Please refer to [this
|
| 93 |
+
issue](https://github.com/pytorch/pytorch/issues/76232).
|
| 94 |
+
tie_word_embeddings (`bool`, *optional*, defaults to `False`):
|
| 95 |
+
Whether to tie weight embeddings
|
| 96 |
+
rope_theta (`float`, *optional*, defaults to 10000.0):
|
| 97 |
+
The base period of the RoPE embeddings.
|
| 98 |
+
rope_scaling (`Dict`, *optional*):
|
| 99 |
+
Dictionary containing the scaling configuration for the RoPE embeddings. Currently supports two scaling
|
| 100 |
+
strategies: linear and dynamic. Their scaling factor must be a float greater than 1. The expected format is
|
| 101 |
+
`{"type": strategy name, "factor": scaling factor}`. When using this flag, don't update
|
| 102 |
+
`max_position_embeddings` to the expected new maximum.
|
| 103 |
+
attention_bias (`bool`, defaults to `False`, *optional*, defaults to `False`):
|
| 104 |
+
Whether to use a bias in the query, key, value and output projection layers during self-attention.
|
| 105 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
| 106 |
+
The dropout ratio for the attention probabilities.
|
| 107 |
+
|
| 108 |
+
```python
|
| 109 |
+
>>> from transformers import DeepseekV3Model, DeepseekV3Config
|
| 110 |
+
|
| 111 |
+
>>> # Initializing a Deepseek-V3 style configuration
|
| 112 |
+
>>> configuration = DeepseekV3Config()
|
| 113 |
+
|
| 114 |
+
>>> # Accessing the model configuration
|
| 115 |
+
>>> configuration = model.config
|
| 116 |
+
```"""
|
| 117 |
+
|
| 118 |
+
model_type = "deepseek_v3"
|
| 119 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 120 |
+
|
| 121 |
+
def __init__(
|
| 122 |
+
self,
|
| 123 |
+
vocab_size=129280,
|
| 124 |
+
hidden_size=7168,
|
| 125 |
+
intermediate_size=18432,
|
| 126 |
+
moe_intermediate_size=2048,
|
| 127 |
+
num_hidden_layers=61,
|
| 128 |
+
num_nextn_predict_layers=1,
|
| 129 |
+
num_attention_heads=128,
|
| 130 |
+
num_key_value_heads=128,
|
| 131 |
+
n_shared_experts=1,
|
| 132 |
+
n_routed_experts=256,
|
| 133 |
+
ep_size=1,
|
| 134 |
+
routed_scaling_factor=2.5,
|
| 135 |
+
kv_lora_rank=512,
|
| 136 |
+
q_lora_rank=1536,
|
| 137 |
+
qk_rope_head_dim=64,
|
| 138 |
+
v_head_dim=128,
|
| 139 |
+
qk_nope_head_dim=128,
|
| 140 |
+
topk_method='noaux_tc',
|
| 141 |
+
n_group=8,
|
| 142 |
+
topk_group=4,
|
| 143 |
+
num_experts_per_tok=8,
|
| 144 |
+
moe_layer_freq=1,
|
| 145 |
+
first_k_dense_replace=3,
|
| 146 |
+
norm_topk_prob=True,
|
| 147 |
+
scoring_func='sigmoid',
|
| 148 |
+
aux_loss_alpha=0.001,
|
| 149 |
+
seq_aux=True,
|
| 150 |
+
hidden_act="silu",
|
| 151 |
+
max_position_embeddings=4096,
|
| 152 |
+
initializer_range=0.02,
|
| 153 |
+
rms_norm_eps=1e-6,
|
| 154 |
+
use_cache=True,
|
| 155 |
+
pad_token_id=None,
|
| 156 |
+
bos_token_id=0,
|
| 157 |
+
eos_token_id=1,
|
| 158 |
+
pretraining_tp=1,
|
| 159 |
+
tie_word_embeddings=False,
|
| 160 |
+
rope_theta=10000.0,
|
| 161 |
+
rope_scaling=None,
|
| 162 |
+
attention_bias=False,
|
| 163 |
+
attention_dropout=0.0,
|
| 164 |
+
**kwargs,
|
| 165 |
+
):
|
| 166 |
+
self.vocab_size = vocab_size
|
| 167 |
+
self.max_position_embeddings = max_position_embeddings
|
| 168 |
+
self.hidden_size = hidden_size
|
| 169 |
+
self.intermediate_size = intermediate_size
|
| 170 |
+
self.moe_intermediate_size = moe_intermediate_size
|
| 171 |
+
self.num_hidden_layers = num_hidden_layers
|
| 172 |
+
self.num_nextn_predict_layers = num_nextn_predict_layers
|
| 173 |
+
self.num_attention_heads = num_attention_heads
|
| 174 |
+
self.n_shared_experts = n_shared_experts
|
| 175 |
+
self.n_routed_experts = n_routed_experts
|
| 176 |
+
self.ep_size = ep_size
|
| 177 |
+
self.routed_scaling_factor = routed_scaling_factor
|
| 178 |
+
self.kv_lora_rank = kv_lora_rank
|
| 179 |
+
self.q_lora_rank = q_lora_rank
|
| 180 |
+
self.qk_rope_head_dim = qk_rope_head_dim
|
| 181 |
+
self.v_head_dim = v_head_dim
|
| 182 |
+
self.qk_nope_head_dim = qk_nope_head_dim
|
| 183 |
+
self.topk_method = topk_method
|
| 184 |
+
self.n_group = n_group
|
| 185 |
+
self.topk_group = topk_group
|
| 186 |
+
self.num_experts_per_tok = num_experts_per_tok
|
| 187 |
+
self.moe_layer_freq = moe_layer_freq
|
| 188 |
+
self.first_k_dense_replace = first_k_dense_replace
|
| 189 |
+
self.norm_topk_prob = norm_topk_prob
|
| 190 |
+
self.scoring_func = scoring_func
|
| 191 |
+
self.aux_loss_alpha = aux_loss_alpha
|
| 192 |
+
self.seq_aux = seq_aux
|
| 193 |
+
# for backward compatibility
|
| 194 |
+
if num_key_value_heads is None:
|
| 195 |
+
num_key_value_heads = num_attention_heads
|
| 196 |
+
|
| 197 |
+
self.num_key_value_heads = num_key_value_heads
|
| 198 |
+
self.hidden_act = hidden_act
|
| 199 |
+
self.initializer_range = initializer_range
|
| 200 |
+
self.rms_norm_eps = rms_norm_eps
|
| 201 |
+
self.pretraining_tp = pretraining_tp
|
| 202 |
+
self.use_cache = use_cache
|
| 203 |
+
self.rope_theta = rope_theta
|
| 204 |
+
self.rope_scaling = rope_scaling
|
| 205 |
+
self.attention_bias = attention_bias
|
| 206 |
+
self.attention_dropout = attention_dropout
|
| 207 |
+
|
| 208 |
+
super().__init__(
|
| 209 |
+
pad_token_id=pad_token_id,
|
| 210 |
+
bos_token_id=bos_token_id,
|
| 211 |
+
eos_token_id=eos_token_id,
|
| 212 |
+
tie_word_embeddings=tie_word_embeddings,
|
| 213 |
+
**kwargs,
|
| 214 |
+
)
|
configuration_kimi_k25.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 2 |
+
|
| 3 |
+
try:
|
| 4 |
+
from configuration_deepseek import DeepseekV3Config
|
| 5 |
+
except ImportError:
|
| 6 |
+
from .configuration_deepseek import DeepseekV3Config
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class KimiK25VisionConfig(PretrainedConfig):
|
| 10 |
+
|
| 11 |
+
def __init__(
|
| 12 |
+
self,
|
| 13 |
+
patch_size: int = 14,
|
| 14 |
+
init_pos_emb_height: int = 64,
|
| 15 |
+
init_pos_emb_width: int = 64,
|
| 16 |
+
init_pos_emb_time: int = 4,
|
| 17 |
+
pos_emb_type: str = 'divided_fixed',
|
| 18 |
+
vt_num_attention_heads: int = 16,
|
| 19 |
+
vt_num_hidden_layers: int = 27,
|
| 20 |
+
vt_hidden_size: int = 1152,
|
| 21 |
+
vt_intermediate_size: int = 4304,
|
| 22 |
+
merge_kernel_size: tuple = (2, 2),
|
| 23 |
+
video_attn_type: str = 'spatial_temporal',
|
| 24 |
+
merge_type: str = 'sd2_tpool',
|
| 25 |
+
_attn_implementation: str = 'flash_attention_2',
|
| 26 |
+
# MM Projector parameters
|
| 27 |
+
mm_projector_type: str = 'patchmerger',
|
| 28 |
+
mm_hidden_size: int | None = None,
|
| 29 |
+
projector_hidden_act: str = "gelu",
|
| 30 |
+
projector_ln_eps: float = 1e-5,
|
| 31 |
+
# Other parameters
|
| 32 |
+
ignore_index: int = -100,
|
| 33 |
+
media_placeholder_token_id: int = 163605,
|
| 34 |
+
pad_token_id: int = 0,
|
| 35 |
+
use_unified_vision_chunk: bool = True,
|
| 36 |
+
video_placeholder="<|kimi_k25_video_placeholder|>",
|
| 37 |
+
text_hidden_size=7168,
|
| 38 |
+
**vision_config_kwargs):
|
| 39 |
+
|
| 40 |
+
self.patch_size = patch_size
|
| 41 |
+
self.init_pos_emb_height = init_pos_emb_height
|
| 42 |
+
self.init_pos_emb_width = init_pos_emb_width
|
| 43 |
+
self.init_pos_emb_time = init_pos_emb_time
|
| 44 |
+
self.pos_emb_type = pos_emb_type
|
| 45 |
+
self.vt_num_attention_heads = vt_num_attention_heads
|
| 46 |
+
self.vt_num_hidden_layers = vt_num_hidden_layers
|
| 47 |
+
self.vt_hidden_size = vt_hidden_size
|
| 48 |
+
self.vt_intermediate_size = vt_intermediate_size
|
| 49 |
+
self.merge_kernel_size = merge_kernel_size
|
| 50 |
+
self.video_attn_type = video_attn_type
|
| 51 |
+
self.merge_type = merge_type
|
| 52 |
+
self._attn_implementation = _attn_implementation
|
| 53 |
+
|
| 54 |
+
# MM Projector config
|
| 55 |
+
self.mm_projector_type = mm_projector_type
|
| 56 |
+
self.mm_hidden_size = mm_hidden_size if mm_hidden_size is not None else vt_hidden_size
|
| 57 |
+
self.projector_hidden_act = projector_hidden_act
|
| 58 |
+
self.projector_ln_eps = projector_ln_eps
|
| 59 |
+
self.text_hidden_size = text_hidden_size
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
class KimiK25Config(PretrainedConfig):
|
| 63 |
+
"""Kimi-K2.5 model configuration.
|
| 64 |
+
|
| 65 |
+
Args:
|
| 66 |
+
text_config (dict | DeepseekV3Config): Configuration for the text model.
|
| 67 |
+
|
| 68 |
+
Vision Tower Parameters (from MoonViT3dConfig):
|
| 69 |
+
patch_size (int): Patch size for vision tower.
|
| 70 |
+
init_pos_emb_height (int): Initial position embedding height.
|
| 71 |
+
init_pos_emb_width (int): Initial position embedding width.
|
| 72 |
+
init_pos_emb_time (int): Initial position embedding time dimension.
|
| 73 |
+
pos_emb_type (str): Type of position embedding.
|
| 74 |
+
vt_num_attention_heads (int): Number of attention heads in vision tower.
|
| 75 |
+
vt_num_hidden_layers (int): Number of hidden layers in vision tower.
|
| 76 |
+
vt_hidden_size (int): Hidden size of vision tower.
|
| 77 |
+
vt_intermediate_size (int): Intermediate size in vision tower FFN.
|
| 78 |
+
merge_kernel_size (tuple): Kernel size for patch merging.
|
| 79 |
+
video_attn_type (str): Type of video attention.
|
| 80 |
+
merge_type (str): Type of merge operation.
|
| 81 |
+
_attn_implementation (str): Attention implementation type.
|
| 82 |
+
|
| 83 |
+
MM Projector Parameters (from MultiModalProjectorConfig):
|
| 84 |
+
mm_projector_type (str): Type of multimodal projector.
|
| 85 |
+
mm_hidden_size (int): Hidden size from vision tower (should match vt_hidden_size).
|
| 86 |
+
projector_hidden_act (str): Activation function for projector.
|
| 87 |
+
projector_ln_eps (float): Layer norm epsilon for projector.
|
| 88 |
+
|
| 89 |
+
Other Parameters:
|
| 90 |
+
ignore_index (int): The ignore index for the loss function.
|
| 91 |
+
media_placeholder_token_id (int): The token ID to use for media placeholders.
|
| 92 |
+
pad_token_id (int): The token ID to use for padding.
|
| 93 |
+
"""
|
| 94 |
+
|
| 95 |
+
model_type = "kimi_k25"
|
| 96 |
+
|
| 97 |
+
def __init__(
|
| 98 |
+
self,
|
| 99 |
+
text_config: dict | DeepseekV3Config = None,
|
| 100 |
+
vision_config: dict | KimiK25VisionConfig = None,
|
| 101 |
+
# Other parameters
|
| 102 |
+
ignore_index: int = -100,
|
| 103 |
+
media_placeholder_token_id: int = 163605,
|
| 104 |
+
pad_token_id: int = 0,
|
| 105 |
+
use_unified_vision_chunk: bool = True,
|
| 106 |
+
video_placeholder="<|kimi_k25_video_placeholder|>",
|
| 107 |
+
**kwargs,
|
| 108 |
+
):
|
| 109 |
+
if isinstance(text_config, dict):
|
| 110 |
+
text_config = DeepseekV3Config(**text_config)
|
| 111 |
+
if isinstance(vision_config, dict):
|
| 112 |
+
vision_config = KimiK25VisionConfig(**vision_config)
|
| 113 |
+
self.text_config = text_config
|
| 114 |
+
self.vision_config = vision_config
|
| 115 |
+
# Other config
|
| 116 |
+
self.ignore_index = ignore_index
|
| 117 |
+
self.media_placeholder_token_id = media_placeholder_token_id
|
| 118 |
+
self.use_unified_vision_chunk = use_unified_vision_chunk
|
| 119 |
+
self.video_placeholder = video_placeholder
|
| 120 |
+
if getattr(self.text_config, "quantization_config", None) is not None:
|
| 121 |
+
self.quantization_config = self.text_config.quantization_config
|
| 122 |
+
|
| 123 |
+
super().__init__(pad_token_id=pad_token_id, **kwargs)
|
generation_config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 163584,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": 163586,
|
| 6 |
+
"pad_token_id": 163839,
|
| 7 |
+
"transformers_version": "4.57.6"
|
| 8 |
+
}
|
kimi_k25_vision_processing.py
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Image processor class for Kimi-K2.5.
|
| 2 |
+
"""
|
| 3 |
+
|
| 4 |
+
import json
|
| 5 |
+
from typing import Any, Dict, Optional, Union
|
| 6 |
+
|
| 7 |
+
import numpy as np
|
| 8 |
+
import torch
|
| 9 |
+
from PIL import Image
|
| 10 |
+
from transformers.image_processing_utils import (BaseImageProcessor,
|
| 11 |
+
BatchFeature)
|
| 12 |
+
from transformers.utils import TensorType
|
| 13 |
+
|
| 14 |
+
from .media_utils import (MediaInput, VideoChunkInput, _to_tensor,
|
| 15 |
+
ensure_media_type, get_video_meta, image_to_np,
|
| 16 |
+
navit_patchify, navit_resize_image,
|
| 17 |
+
navit_resize_video, normalize,
|
| 18 |
+
real_sample_fps_and_max_num_frames, timestamp_as_str)
|
| 19 |
+
|
| 20 |
+
try:
|
| 21 |
+
from mecord import VideoReader
|
| 22 |
+
except ImportError:
|
| 23 |
+
VideoReader = None
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def resampling(video_bytes: bytes,
|
| 27 |
+
sample_indices: list[int],
|
| 28 |
+
key_indices=None,
|
| 29 |
+
frame_time_info=None,
|
| 30 |
+
num_threads=4) -> str:
|
| 31 |
+
video = VideoReader(video_bytes,
|
| 32 |
+
num_threads=num_threads,
|
| 33 |
+
frame_time_info=frame_time_info,
|
| 34 |
+
key_indices=key_indices)
|
| 35 |
+
# extract target frames
|
| 36 |
+
frames = video[sample_indices]
|
| 37 |
+
frames = [Image.fromarray(frame) for frame in frames]
|
| 38 |
+
return frames
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
class KimiK25VisionProcessor(BaseImageProcessor):
|
| 42 |
+
model_type = "kimi_k25"
|
| 43 |
+
|
| 44 |
+
def __init__(
|
| 45 |
+
self,
|
| 46 |
+
media_proc_cfg: dict,
|
| 47 |
+
**kwargs,
|
| 48 |
+
):
|
| 49 |
+
super().__init__(**kwargs)
|
| 50 |
+
self.media_proc_cfg = media_proc_cfg
|
| 51 |
+
self.num_frames_per_chunk = media_proc_cfg[
|
| 52 |
+
'temporal_merge_kernel_size']
|
| 53 |
+
|
| 54 |
+
def media_tokens_calculator(self, media: MediaInput):
|
| 55 |
+
media = ensure_media_type(media)
|
| 56 |
+
ret = self.get_resize_config(media)
|
| 57 |
+
return ret['num_tokens']
|
| 58 |
+
|
| 59 |
+
@classmethod
|
| 60 |
+
def make_chunk_prompt(cls, timestamp_text: str) -> str:
|
| 61 |
+
return f"{timestamp_text}<|media_begin|>video<|media_content|><|media_pad|><|media_end|>"
|
| 62 |
+
|
| 63 |
+
def split_video_chunks(self,
|
| 64 |
+
video_url: str | bytes) -> list[list[Image.Image]]:
|
| 65 |
+
# video_url should be base64 str or bytes
|
| 66 |
+
video_spec = get_video_meta(video_url)
|
| 67 |
+
sample_fps = min(self.media_proc_cfg['sample_fps'], video_spec.fps)
|
| 68 |
+
sampled_nframes = max(
|
| 69 |
+
round(video_spec.num_frames * sample_fps / video_spec.fps), 1)
|
| 70 |
+
frame_inds = np.linspace(0, video_spec.num_frames - 1,
|
| 71 |
+
sampled_nframes).round().astype(int)
|
| 72 |
+
frame_inds = frame_inds.tolist()
|
| 73 |
+
sampled_frame_ids = []
|
| 74 |
+
temporal_merge_kernel_size = self.media_proc_cfg[
|
| 75 |
+
"temporal_merge_kernel_size"]
|
| 76 |
+
num_chunks = 0
|
| 77 |
+
chunk_timestamp = []
|
| 78 |
+
for i in range(0, len(frame_inds), temporal_merge_kernel_size):
|
| 79 |
+
sampled_frame_ids.extend(frame_inds[i:i +
|
| 80 |
+
temporal_merge_kernel_size])
|
| 81 |
+
start_time = frame_inds[i] / float(video_spec.fps)
|
| 82 |
+
timestamp_text = timestamp_as_str(
|
| 83 |
+
start_time, self.media_proc_cfg["timestamp_mode"])
|
| 84 |
+
chunk_timestamp.append(timestamp_text)
|
| 85 |
+
num_chunks += 1
|
| 86 |
+
|
| 87 |
+
sampled_frames = resampling(video_url, sampled_frame_ids)
|
| 88 |
+
chunks = []
|
| 89 |
+
for chunk_id in range(num_chunks):
|
| 90 |
+
chunk = sampled_frames[chunk_id *
|
| 91 |
+
temporal_merge_kernel_size:(chunk_id + 1) *
|
| 92 |
+
temporal_merge_kernel_size]
|
| 93 |
+
chunks.append(
|
| 94 |
+
VideoChunkInput(type="video_chunk",
|
| 95 |
+
video_chunk=chunk,
|
| 96 |
+
prompt=self.make_chunk_prompt(
|
| 97 |
+
chunk_timestamp[chunk_id])))
|
| 98 |
+
return chunks
|
| 99 |
+
|
| 100 |
+
def get_resize_config(self, media_input: MediaInput) -> dict:
|
| 101 |
+
if media_input['type'] == 'image':
|
| 102 |
+
w, h = media_input['image'].size
|
| 103 |
+
ret = navit_resize_image(
|
| 104 |
+
w, h, self.media_proc_cfg['patch_size'],
|
| 105 |
+
self.media_proc_cfg['merge_kernel_size'],
|
| 106 |
+
self.media_proc_cfg['in_patch_limit'],
|
| 107 |
+
self.media_proc_cfg['patch_limit_on_one_side'],
|
| 108 |
+
self.media_proc_cfg['fixed_output_tokens'])
|
| 109 |
+
return ret
|
| 110 |
+
elif media_input['type'] == 'video_chunk':
|
| 111 |
+
frame = media_input['video_chunk'][0]
|
| 112 |
+
width, height = frame.size
|
| 113 |
+
num_frames = len(media_input["video_chunk"])
|
| 114 |
+
fps = 1.0
|
| 115 |
+
|
| 116 |
+
sample_fps, max_num_frames_each_video = real_sample_fps_and_max_num_frames(
|
| 117 |
+
media_input["type"],
|
| 118 |
+
self.media_proc_cfg['sample_fps'],
|
| 119 |
+
self.media_proc_cfg['max_num_frames_each_video'],
|
| 120 |
+
)
|
| 121 |
+
|
| 122 |
+
in_patch_limit_each_frame = self.media_proc_cfg[
|
| 123 |
+
'in_patch_limit_each_frame']
|
| 124 |
+
if in_patch_limit_each_frame is None:
|
| 125 |
+
in_patch_limit_each_frame = self.media_proc_cfg[
|
| 126 |
+
'in_patch_limit']
|
| 127 |
+
|
| 128 |
+
ret = navit_resize_video(
|
| 129 |
+
width,
|
| 130 |
+
height,
|
| 131 |
+
num_frames,
|
| 132 |
+
fps,
|
| 133 |
+
sample_fps,
|
| 134 |
+
self.media_proc_cfg['patch_size'],
|
| 135 |
+
self.media_proc_cfg['merge_kernel_size'],
|
| 136 |
+
in_patch_limit_each_frame,
|
| 137 |
+
self.media_proc_cfg['patch_limit_on_one_side'],
|
| 138 |
+
self.media_proc_cfg['in_patch_limit_video'],
|
| 139 |
+
max_num_frames_each_video,
|
| 140 |
+
self.media_proc_cfg['fixed_output_tokens'],
|
| 141 |
+
)
|
| 142 |
+
return ret
|
| 143 |
+
else:
|
| 144 |
+
raise ValueError("Unsupported type: {}".format(
|
| 145 |
+
media_input['type']))
|
| 146 |
+
|
| 147 |
+
def resize_image(self, image: Image.Image, new_width: int, new_height: int,
|
| 148 |
+
pad_width: int, pad_height: int) -> np.ndarray:
|
| 149 |
+
image_np = image_to_np(image, (new_width, new_height), "resize")
|
| 150 |
+
image_np = np.pad(
|
| 151 |
+
image_np,
|
| 152 |
+
((0, pad_height), (0, pad_width), (0, 0)),
|
| 153 |
+
mode="constant",
|
| 154 |
+
constant_values=0,
|
| 155 |
+
)
|
| 156 |
+
return image_np
|
| 157 |
+
|
| 158 |
+
def preprocess(
|
| 159 |
+
self,
|
| 160 |
+
medias: list[MediaInput],
|
| 161 |
+
return_tensors: Optional[Union[str, TensorType]] = None,
|
| 162 |
+
) -> BatchFeature:
|
| 163 |
+
"""
|
| 164 |
+
Preprocess a atom vision input (images/video_chunk) into model-ready tensors.
|
| 165 |
+
|
| 166 |
+
Args:
|
| 167 |
+
medias: List of MediaInput.
|
| 168 |
+
return_tensors: Desired output format ('pt', 'np', 'tf', or None).
|
| 169 |
+
|
| 170 |
+
Returns:
|
| 171 |
+
BatchFeature containing 'pixel_values' and 'grid_thws' tensors.
|
| 172 |
+
"""
|
| 173 |
+
if not isinstance(medias, list):
|
| 174 |
+
medias = [medias]
|
| 175 |
+
if medias:
|
| 176 |
+
pixel_values = []
|
| 177 |
+
for item in medias:
|
| 178 |
+
item = ensure_media_type(item)
|
| 179 |
+
resize_config = self.get_resize_config(item)
|
| 180 |
+
new_width, new_height, pad_width, pad_height = resize_config[
|
| 181 |
+
'new_width'], resize_config['new_height'], resize_config[
|
| 182 |
+
'pad_width'], resize_config['pad_height']
|
| 183 |
+
if item['type'] == 'image':
|
| 184 |
+
image = item['image']
|
| 185 |
+
image_np = self.resize_image(image, new_width, new_height,
|
| 186 |
+
pad_width, pad_height)
|
| 187 |
+
pixel_values.append(np.expand_dims(image_np, axis=0))
|
| 188 |
+
elif item['type'] == 'video_chunk':
|
| 189 |
+
pixels = []
|
| 190 |
+
for frame in item['video_chunk']:
|
| 191 |
+
frame_np = self.resize_image(frame, new_width,
|
| 192 |
+
new_height, pad_width,
|
| 193 |
+
pad_height)
|
| 194 |
+
pixels.append(frame_np)
|
| 195 |
+
pixel_values.append(np.stack(pixels, axis=0))
|
| 196 |
+
else:
|
| 197 |
+
raise ValueError("Unsupported type: {}".format(
|
| 198 |
+
item['type']))
|
| 199 |
+
normalized_pixel_values = []
|
| 200 |
+
image_std_inv = 1.0 / np.array(self.media_proc_cfg['image_std'])
|
| 201 |
+
image_mean = np.array(self.media_proc_cfg['image_mean'])
|
| 202 |
+
for pixels in pixel_values:
|
| 203 |
+
pixels = normalize(pixels, image_mean, image_std_inv)
|
| 204 |
+
pixels_and_thw = navit_patchify(
|
| 205 |
+
pixels,
|
| 206 |
+
self.media_proc_cfg['patch_size'],
|
| 207 |
+
)
|
| 208 |
+
normalized_pixel_values.append(pixels_and_thw)
|
| 209 |
+
|
| 210 |
+
pixel_values = torch.cat([
|
| 211 |
+
_to_tensor(pixel_value['pixel_values'])
|
| 212 |
+
for pixel_value in normalized_pixel_values
|
| 213 |
+
])
|
| 214 |
+
grid_thws = torch.cat([
|
| 215 |
+
_to_tensor(pixel_value['grid_thw'],
|
| 216 |
+
dtype=torch.int64).unsqueeze(0)
|
| 217 |
+
for pixel_value in normalized_pixel_values
|
| 218 |
+
])
|
| 219 |
+
|
| 220 |
+
data = {
|
| 221 |
+
'pixel_values': pixel_values,
|
| 222 |
+
'grid_thws': grid_thws,
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
else:
|
| 226 |
+
data = {}
|
| 227 |
+
|
| 228 |
+
return BatchFeature(data=data, tensor_type=return_tensors)
|
| 229 |
+
|
| 230 |
+
def __repr__(self):
|
| 231 |
+
return f"KimiK25VisionProcessor(media_proc_cfg={self.media_proc_cfg})"
|
| 232 |
+
|
| 233 |
+
def to_dict(self) -> Dict[str, Any]:
|
| 234 |
+
output = super().to_dict()
|
| 235 |
+
output["media_proc_cfg"] = self.media_proc_cfg
|
| 236 |
+
if "media_processor" in output:
|
| 237 |
+
del output["media_processor"]
|
| 238 |
+
return output
|
| 239 |
+
|
| 240 |
+
@classmethod
|
| 241 |
+
def from_dict(cls, config_dict: Dict[str, Any], **kwargs):
|
| 242 |
+
config = config_dict.copy()
|
| 243 |
+
media_proc_cfg = config.pop("media_proc_cfg", {})
|
| 244 |
+
return cls(media_proc_cfg=media_proc_cfg, **config, **kwargs)
|
| 245 |
+
|
| 246 |
+
def to_json_string(self):
|
| 247 |
+
dictionary = self.to_dict()
|
| 248 |
+
for key, value in dictionary.items():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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import base64
|
| 2 |
+
import io
|
| 3 |
+
import math
|
| 4 |
+
import os
|
| 5 |
+
from datetime import datetime, timezone
|
| 6 |
+
from typing import List, Literal, Optional, TypedDict
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
from PIL import Image
|
| 10 |
+
from pydantic import BaseModel, Field
|
| 11 |
+
|
| 12 |
+
try:
|
| 13 |
+
from mecord import VideoReader
|
| 14 |
+
except ImportError:
|
| 15 |
+
VideoReader = None
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class VideoSpec(BaseModel):
|
| 19 |
+
media_type: str = Literal['video']
|
| 20 |
+
height: int = Field(..., gt=0, description="video frame height")
|
| 21 |
+
width: int = Field(..., gt=0, description="video frame width")
|
| 22 |
+
num_frames: int = Field(..., gt=0, description="num frames")
|
| 23 |
+
fps: float = Field(..., gt=0, description="average fps")
|
| 24 |
+
|
| 25 |
+
# optional, help to accelerate video reading
|
| 26 |
+
key_indices: list[int] = Field(None, description="key indices")
|
| 27 |
+
frame_time_info: dict = Field(None, description="frame time info")
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
class ImageInput(TypedDict):
|
| 31 |
+
type: Literal['image']
|
| 32 |
+
image: Image.Image
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class VideoChunkInput(TypedDict):
|
| 36 |
+
type: Literal['video_chunk']
|
| 37 |
+
video_chunk: List[Image.Image]
|
| 38 |
+
prompt: Optional[str] = None
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
MediaInput = ImageInput | VideoChunkInput
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
def get_video_meta(video_src: bytes | str | os.PathLike,
|
| 45 |
+
accurate: bool = True) -> dict:
|
| 46 |
+
"""Get the dimensions of a video."""
|
| 47 |
+
if isinstance(video_src, os.PathLike):
|
| 48 |
+
video_src = str(video_src)
|
| 49 |
+
# if b64 string, decode to bytes
|
| 50 |
+
if isinstance(video_src,
|
| 51 |
+
str) and video_src.startswith('data:video/mp4;base64,'):
|
| 52 |
+
video_src = base64.b64decode(video_src.split(',')[1])
|
| 53 |
+
video = VideoReader(video_src, auto_init=accurate, num_threads=1)
|
| 54 |
+
assert video.num_frames > 0, "Invalid video format."
|
| 55 |
+
assert video.original_width > 0 and video.original_height > 0, (
|
| 56 |
+
"Invalid video format.")
|
| 57 |
+
assert video.avg_fps > 0, "Invalid video format."
|
| 58 |
+
return VideoSpec(media_type='video',
|
| 59 |
+
height=video.original_height,
|
| 60 |
+
width=video.original_width,
|
| 61 |
+
num_frames=video.num_frames,
|
| 62 |
+
fps=video.avg_fps,
|
| 63 |
+
key_indices=video.key_indices,
|
| 64 |
+
frame_time_info=video.frame_time_info)
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
def timestamp_as_str(timestamp: float,
|
| 68 |
+
timestamp_mode: str = "hh:mm:ss.fff") -> str:
|
| 69 |
+
"""Convert a timestamp to a string in the format of HH:MM:SS.mmm."""
|
| 70 |
+
if timestamp_mode == "hh:mm:ss.fff":
|
| 71 |
+
return (datetime.fromtimestamp(timestamp,
|
| 72 |
+
tz=timezone.utc).strftime("%H:%M:%S") +
|
| 73 |
+
f".{int((timestamp % 1) * 1000):03d}")
|
| 74 |
+
elif timestamp_mode == "mm:ss.fff":
|
| 75 |
+
return (datetime.fromtimestamp(timestamp,
|
| 76 |
+
tz=timezone.utc).strftime("%M:%S") +
|
| 77 |
+
f".{int((timestamp % 1) * 1000):03d}")
|
| 78 |
+
elif timestamp_mode == "mm:ss":
|
| 79 |
+
return datetime.fromtimestamp(timestamp,
|
| 80 |
+
tz=timezone.utc).strftime("%M:%S")
|
| 81 |
+
else:
|
| 82 |
+
raise ValueError(f"Invalid timestamp mode: {timestamp_mode}")
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
def navit_resize_image(
|
| 86 |
+
width: int,
|
| 87 |
+
height: int,
|
| 88 |
+
patch_size: int,
|
| 89 |
+
merge_kernel_size: int,
|
| 90 |
+
in_patch_limit: int,
|
| 91 |
+
patch_limit_on_one_side: int,
|
| 92 |
+
fixed_output_tokens: int | None,
|
| 93 |
+
):
|
| 94 |
+
# Apply the patch limits.
|
| 95 |
+
s1 = math.sqrt(
|
| 96 |
+
in_patch_limit /
|
| 97 |
+
(max(1.0, width // patch_size) * max(1.0, height // patch_size)))
|
| 98 |
+
s2 = patch_limit_on_one_side * patch_size / width
|
| 99 |
+
s3 = patch_limit_on_one_side * patch_size / height
|
| 100 |
+
scale = min(1.0, s1, s2, s3)
|
| 101 |
+
new_w, new_h = max(1, int(width * scale)), max(1, int(height * scale))
|
| 102 |
+
new_w = min(new_w, patch_limit_on_one_side * patch_size)
|
| 103 |
+
new_h = min(new_h, patch_limit_on_one_side * patch_size)
|
| 104 |
+
|
| 105 |
+
# Calculate the padding to make the height and width divisible by the merge kernel size and patch size.
|
| 106 |
+
factor = merge_kernel_size * patch_size
|
| 107 |
+
|
| 108 |
+
pad_height = (factor - new_h % factor) % factor
|
| 109 |
+
pad_width = (factor - new_w % factor) % factor
|
| 110 |
+
|
| 111 |
+
if fixed_output_tokens is not None:
|
| 112 |
+
num_tokens = fixed_output_tokens
|
| 113 |
+
else:
|
| 114 |
+
# Calculate new dimensions after padding and patching
|
| 115 |
+
token_height = (new_h + pad_height) // factor
|
| 116 |
+
token_width = (new_w + pad_width) // factor
|
| 117 |
+
|
| 118 |
+
assert token_height * merge_kernel_size <= patch_limit_on_one_side, (
|
| 119 |
+
f"token_height {token_height} * merge_kernel_size {merge_kernel_size} > patch_limit_on_one_side {patch_limit_on_one_side}"
|
| 120 |
+
)
|
| 121 |
+
assert token_width * merge_kernel_size <= patch_limit_on_one_side, (
|
| 122 |
+
f"token_width {token_width} * merge_kernel_size {merge_kernel_size} > patch_limit_on_one_side {patch_limit_on_one_side}"
|
| 123 |
+
)
|
| 124 |
+
|
| 125 |
+
num_tokens = token_height * token_width
|
| 126 |
+
return {
|
| 127 |
+
"num_tokens": num_tokens,
|
| 128 |
+
"new_width": new_w,
|
| 129 |
+
"new_height": new_h,
|
| 130 |
+
"pad_width": pad_width,
|
| 131 |
+
"pad_height": pad_height,
|
| 132 |
+
"sampled_nframes": 1,
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
def navit_resize_video(
|
| 137 |
+
width: int,
|
| 138 |
+
height: int,
|
| 139 |
+
nframes: int,
|
| 140 |
+
avg_fps: float,
|
| 141 |
+
sample_fps: float,
|
| 142 |
+
patch_size: int,
|
| 143 |
+
merge_kernel_size: int,
|
| 144 |
+
in_patch_limit_each_frame: int,
|
| 145 |
+
patch_limit_on_one_side: int,
|
| 146 |
+
in_patch_limit_total: int | None,
|
| 147 |
+
max_num_frames_each_video: int | None,
|
| 148 |
+
fixed_output_tokens_each_frame: int | None,
|
| 149 |
+
):
|
| 150 |
+
sample_fps = min(sample_fps, avg_fps)
|
| 151 |
+
# Calculate the number of frames to sample based on target FPS
|
| 152 |
+
sampled_nframes = max(round(nframes * sample_fps / avg_fps), 1)
|
| 153 |
+
if max_num_frames_each_video is not None:
|
| 154 |
+
sampled_nframes = min(sampled_nframes, max_num_frames_each_video)
|
| 155 |
+
|
| 156 |
+
if in_patch_limit_total is not None:
|
| 157 |
+
in_patch_limit_each_frame = min(
|
| 158 |
+
round(in_patch_limit_total / sampled_nframes),
|
| 159 |
+
in_patch_limit_each_frame)
|
| 160 |
+
|
| 161 |
+
ret = navit_resize_image(
|
| 162 |
+
width,
|
| 163 |
+
height,
|
| 164 |
+
patch_size,
|
| 165 |
+
merge_kernel_size,
|
| 166 |
+
in_patch_limit_each_frame,
|
| 167 |
+
patch_limit_on_one_side,
|
| 168 |
+
fixed_output_tokens_each_frame,
|
| 169 |
+
)
|
| 170 |
+
ret["sampled_nframes"] = sampled_nframes
|
| 171 |
+
return ret
|
| 172 |
+
|
| 173 |
+
|
| 174 |
+
def real_sample_fps_and_max_num_frames(
|
| 175 |
+
type_name: Literal["video", "video_chunk"],
|
| 176 |
+
sample_fps: float,
|
| 177 |
+
max_num_frames_each_video: int | None,
|
| 178 |
+
) -> tuple[int, int | None]:
|
| 179 |
+
if type_name == "video":
|
| 180 |
+
return sample_fps, max_num_frames_each_video
|
| 181 |
+
elif type_name == "video_chunk":
|
| 182 |
+
max_num_frames_each_video = None
|
| 183 |
+
sample_fps = math.inf
|
| 184 |
+
return sample_fps, max_num_frames_each_video
|
| 185 |
+
else:
|
| 186 |
+
return math.inf, None
|
| 187 |
+
|
| 188 |
+
|
| 189 |
+
def _to_pil(data: str | bytes):
|
| 190 |
+
if isinstance(data, Image.Image):
|
| 191 |
+
|
| 192 |
+
return data.convert("RGB")
|
| 193 |
+
elif isinstance(data, str):
|
| 194 |
+
if data.startswith("data:"):
|
| 195 |
+
raw_base64 = data.split(",")[1]
|
| 196 |
+
return Image.open(io.BytesIO(
|
| 197 |
+
base64.b64decode(raw_base64))).convert("RGB")
|
| 198 |
+
else:
|
| 199 |
+
return Image.open(data).convert("RGB")
|
| 200 |
+
elif isinstance(data, bytes):
|
| 201 |
+
return Image.open(io.BytesIO(data)).convert("RGB")
|
| 202 |
+
else:
|
| 203 |
+
raise ValueError(f"Unsupported data type: {type(data)}")
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
def ensure_media_type(media: MediaInput) -> MediaInput:
|
| 207 |
+
if media['type'] == 'image':
|
| 208 |
+
media['image'] = _to_pil(media['image'])
|
| 209 |
+
return media
|
| 210 |
+
elif media['type'] == 'video_chunk':
|
| 211 |
+
media['video_chunk'] = [
|
| 212 |
+
_to_pil(frame) for frame in media['video_chunk']
|
| 213 |
+
]
|
| 214 |
+
return media
|
| 215 |
+
else:
|
| 216 |
+
raise ValueError(f"Unsupported media type: {media['type']}")
|
| 217 |
+
|
| 218 |
+
|
| 219 |
+
def image_to_np(
|
| 220 |
+
image: Image.Image,
|
| 221 |
+
resize_to: tuple[int, int] | None = None,
|
| 222 |
+
mode: str = "resize",
|
| 223 |
+
raise_error_for_ill_resize: bool = True,
|
| 224 |
+
) -> np.ndarray:
|
| 225 |
+
"""Convert an image to a numpy array.
|
| 226 |
+
|
| 227 |
+
Args:
|
| 228 |
+
content: The image to convert.
|
| 229 |
+
resize_to: The size to resize the image to.
|
| 230 |
+
mode: The mode to resize the image to.
|
| 231 |
+
raise_error_for_ill_resize: Whether to raise an error for ill-sized resize.
|
| 232 |
+
|
| 233 |
+
Returns:
|
| 234 |
+
A numpy array.
|
| 235 |
+
"""
|
| 236 |
+
assert isinstance(image, Image.Image), "image must be a PIL Image"
|
| 237 |
+
if resize_to is not None:
|
| 238 |
+
if mode == "resize":
|
| 239 |
+
image = image.resize(resize_to, resample=Image.Resampling.BICUBIC)
|
| 240 |
+
|
| 241 |
+
elif mode == "rescale_and_pad_to_center":
|
| 242 |
+
scale = min(resize_to[0] / image.width,
|
| 243 |
+
resize_to[1] / image.height, 1.0)
|
| 244 |
+
new_width = round(image.width * scale)
|
| 245 |
+
new_height = round(image.height * scale)
|
| 246 |
+
if new_width == 0 or new_height == 0:
|
| 247 |
+
if raise_error_for_ill_resize:
|
| 248 |
+
raise ValueError(
|
| 249 |
+
f"Invalid resize to: {resize_to}, from image size: {image.size}"
|
| 250 |
+
)
|
| 251 |
+
else:
|
| 252 |
+
return np.zeros((resize_to[1], resize_to[0], 3),
|
| 253 |
+
dtype=np.uint8)
|
| 254 |
+
|
| 255 |
+
image = image.resize((new_width, new_height),
|
| 256 |
+
resample=Image.Resampling.BICUBIC)
|
| 257 |
+
padding_left = (resize_to[0] - new_width) // 2
|
| 258 |
+
padding_right = resize_to[0] - new_width - padding_left
|
| 259 |
+
padding_top = (resize_to[1] - new_height) // 2
|
| 260 |
+
padding_bottom = resize_to[1] - new_height - padding_top
|
| 261 |
+
image = np.asarray(image)
|
| 262 |
+
image = np.pad(
|
| 263 |
+
image,
|
| 264 |
+
((padding_top, padding_bottom), (padding_left, padding_right),
|
| 265 |
+
(0, 0)),
|
| 266 |
+
mode="constant",
|
| 267 |
+
constant_values=0,
|
| 268 |
+
)
|
| 269 |
+
assert image.shape == (resize_to[1], resize_to[0], 3)
|
| 270 |
+
|
| 271 |
+
elif mode == "rescale_and_pad_to_rightbottom":
|
| 272 |
+
scale = min(resize_to[0] / image.width,
|
| 273 |
+
resize_to[1] / image.height, 1.0)
|
| 274 |
+
new_width = round(image.width * scale)
|
| 275 |
+
new_height = round(image.height * scale)
|
| 276 |
+
if new_width == 0 or new_height == 0:
|
| 277 |
+
if raise_error_for_ill_resize:
|
| 278 |
+
raise ValueError(
|
| 279 |
+
f"Invalid resize to: {resize_to}, from image size: {image.size}"
|
| 280 |
+
)
|
| 281 |
+
else:
|
| 282 |
+
return np.zeros((resize_to[1], resize_to[0], 3),
|
| 283 |
+
dtype=np.uint8)
|
| 284 |
+
|
| 285 |
+
image = image.resize((new_width, new_height),
|
| 286 |
+
resample=Image.Resampling.BICUBIC)
|
| 287 |
+
padding_right = resize_to[0] - new_width
|
| 288 |
+
padding_bottom = resize_to[1] - new_height
|
| 289 |
+
image = np.asarray(image)
|
| 290 |
+
image = np.pad(
|
| 291 |
+
image,
|
| 292 |
+
((0, padding_bottom), (0, padding_right), (0, 0)),
|
| 293 |
+
mode="constant",
|
| 294 |
+
constant_values=0,
|
| 295 |
+
)
|
| 296 |
+
assert image.shape == (resize_to[1], resize_to[0], 3)
|
| 297 |
+
|
| 298 |
+
else:
|
| 299 |
+
raise ValueError(f"Invalid mode: {mode}")
|
| 300 |
+
|
| 301 |
+
if isinstance(image, Image.Image):
|
| 302 |
+
return np.asarray(image)
|
| 303 |
+
else:
|
| 304 |
+
return image
|
| 305 |
+
|
| 306 |
+
|
| 307 |
+
def navit_patchify(pixel_values: np.ndarray,
|
| 308 |
+
patch_size: int) -> dict[str, np.ndarray]:
|
| 309 |
+
"""Reshape the pixel values to a navit shape.
|
| 310 |
+
|
| 311 |
+
Args:
|
| 312 |
+
pixel_values: np.ndarray, shape (t, h, w, c)
|
| 313 |
+
patch_size: int
|
| 314 |
+
|
| 315 |
+
Returns:
|
| 316 |
+
dict[str, np.ndarray]
|
| 317 |
+
- patches: np.ndarray, shape (t * h//patch_size * w//patch_size, c, patch_size, patch_size)
|
| 318 |
+
- grid_thw: np.ndarray, (t, h//patch_size, w//patch_size)
|
| 319 |
+
"""
|
| 320 |
+
T, H, W, C = pixel_values.shape
|
| 321 |
+
assert C == 3, "pixel_values must have 3 channels"
|
| 322 |
+
|
| 323 |
+
patches = pixel_values.reshape(T, H // patch_size, patch_size,
|
| 324 |
+
W // patch_size, patch_size, C)
|
| 325 |
+
# (T, H//patch_size, W//patch_size, C, patch_size, patch_size)
|
| 326 |
+
patches = patches.transpose(0, 1, 3, 5, 2, 4)
|
| 327 |
+
patches = patches.reshape(-1, C, patch_size, patch_size)
|
| 328 |
+
grid_thw = np.array([T, H // patch_size, W // patch_size])
|
| 329 |
+
return {"pixel_values": patches, "grid_thw": grid_thw}
|
| 330 |
+
|
| 331 |
+
|
| 332 |
+
def normalize(x: np.ndarray,
|
| 333 |
+
mean,
|
| 334 |
+
std_inv,
|
| 335 |
+
pixels_dtype: np.dtype = np.float32) -> np.ndarray:
|
| 336 |
+
"""Normalize the image.
|
| 337 |
+
|
| 338 |
+
Args:
|
| 339 |
+
x: The image to normalize. The shape is (..., 3). The dtype is uint8. The range is [0, 255].
|
| 340 |
+
mean: The mean of the image.
|
| 341 |
+
std_inv: The inverse of the std of the image.
|
| 342 |
+
pixels_dtype: The dtype of the image.
|
| 343 |
+
Returns:
|
| 344 |
+
The normalized image. The shape is (..., 3). The dtype is determined by the pixels_dtype.
|
| 345 |
+
"""
|
| 346 |
+
x = (x / 255.0).astype(pixels_dtype)
|
| 347 |
+
x -= mean
|
| 348 |
+
x *= std_inv
|
| 349 |
+
return x
|
| 350 |
+
|
| 351 |
+
|
| 352 |
+
def _to_tensor(data, **kwargs):
|
| 353 |
+
import torch
|
| 354 |
+
|
| 355 |
+
if isinstance(data, np.ndarray):
|
| 356 |
+
return torch.from_numpy(data).to(**kwargs)
|
| 357 |
+
elif isinstance(data, torch.Tensor):
|
| 358 |
+
return data.to(**kwargs)
|
| 359 |
+
elif isinstance(data, list):
|
| 360 |
+
return [_to_tensor(item, **kwargs) for item in data]
|
| 361 |
+
elif isinstance(data, tuple):
|
| 362 |
+
return tuple(_to_tensor(item, **kwargs) for item in data)
|
| 363 |
+
elif isinstance(data, dict):
|
| 364 |
+
return {k: _to_tensor(v, **kwargs) for k, v in data.items()}
|
| 365 |
+
elif data is None:
|
| 366 |
+
return None
|
| 367 |
+
else:
|
| 368 |
+
raise ValueError(f"Unsupported data type: {type(data)}")
|
model-00001-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:77a75493828a842fcd9c14b1fbe0e2f811e8bedd13ab6110b87b15b7e59cca36
|
| 3 |
+
size 4999509288
|
model-00002-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba77afe8bdea9b3b4c6cfff792ce062c6c433d9d56164c0a1738da5b581bffa7
|
| 3 |
+
size 4997054960
|
model-00003-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:44700ce97e57a4be9cde2fe465e618c49277bb0c96443e78c444c1521da881a0
|
| 3 |
+
size 4997469344
|
model-00004-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bacbe527c826512b97dee20294c2b332c538df2f14bfb343648694dc5b585892
|
| 3 |
+
size 4996137176
|
model-00005-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5d391829b01425f828d218854a79740782b84fd2b5ebefecfa780a55005666de
|
| 3 |
+
size 4997469224
|
model-00006-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ed0570bd83a3546fc5a76616c042c58223ec41774f74ab6a8a09c18198847f4e
|
| 3 |
+
size 4996137296
|
model-00007-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f9fa7a02dfdd0ecc7cf82d5c75c9b5bec02b61a83a565a8e47ae9f44b8e4fe10
|
| 3 |
+
size 4997469104
|
model-00008-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5ccb14300375810dcbe5c2dffdf99103f954a37bcfbce62efb8110b4f08d3325
|
| 3 |
+
size 4996137416
|
model-00009-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:906fe773fbeca2831b2210de9b9bef64f59de4e938be94af1d15cdb7cb3f1da1
|
| 3 |
+
size 4997468984
|
model-00010-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5ec3a0d946552f9576b6979dd9d4146fa5fa730a41f3dbfcd70b77f55f4dd90d
|
| 3 |
+
size 4996137536
|
model-00011-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1992bafdf6fa282a4b6c2643f46c06d005a9a3dcefb53044aff41095be753488
|
| 3 |
+
size 4997468864
|
model-00012-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5b35f6e0e7e32567c6bbd39a4e5ce3ad598650bea51b7288828ae2e20c653a98
|
| 3 |
+
size 4996137656
|
model-00013-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:325cfd11c11ea2f7ff145981693c525f491f47b727e7eb529350d5503a1a23f4
|
| 3 |
+
size 4997468784
|
model-00014-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a96bbe18bf39e357b22d81b6178e621f80fc045128d425c3066b362db84c2d53
|
| 3 |
+
size 4996137736
|
model-00015-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ed0dae6587962c48288f5c30c0a6c09524c2da1e2a71c37fd95a0b12fc48b8b2
|
| 3 |
+
size 4997468784
|
model-00016-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:75aa9590824da3a20f3a7f69c7b10f4fb1e67266f7a65a98c8bc0edf84a77226
|
| 3 |
+
size 4996137736
|
model-00017-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c2f7f156ffa4602d249c38d9bd26545e19d6a68eb75c9f255aa21d91a29a42a8
|
| 3 |
+
size 4997468784
|
model-00018-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:0999734434ecc135c5ba476b49c69589b6705ae6ed2f80279f8eb1b425df48ee
|
| 3 |
+
size 4996137736
|
model-00019-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:91fa659e9e8ad089870406fb5494dc104678d1e3b2ebafd961e24597ceb7e388
|
| 3 |
+
size 4997470416
|
model-00020-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:666b21f70ba1db493d5ffd06af5432a060426ffd274981334901e7ad32928182
|
| 3 |
+
size 4996140152
|
model-00021-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5a8f84c86eb471563f3d3d51341fe57ce7cfc1b3f6c3f63d96c358f0d8793812
|
| 3 |
+
size 4997471120
|
model-00022-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8beda06991a3170cf23ff47ad753048cb232b69fc3cf856a79ad856d8848f3c1
|
| 3 |
+
size 4996140152
|
model-00023-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bb398fe67cda3af7318075b083985a2c205685ae2a793788a667bf5ac38dee3a
|
| 3 |
+
size 4997471120
|
model-00024-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c9f11714ce369eb45147601dd18e3cfca3628fd6dd37a463c8aa97c16262dc21
|
| 3 |
+
size 4996140152
|
model-00025-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bfe35fac0631da59bf4f957002daf26d3ef80db935e296944e450c91c37054f5
|
| 3 |
+
size 4997471120
|
model-00026-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:791f434c80418f3c5a2da183dfec447f2197abd35f95697b00122b0fec7b287b
|
| 3 |
+
size 4996140152
|
model-00027-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:a19997a36fd7bce89b24d10c45fc65e08ea6a9bd88d77024c8161ffbfdb83717
|
| 3 |
+
size 4997471120
|
model-00028-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4f80a3fe8b608db353be55085c1fd407173b409884c0b4c25dea196f5c6d0691
|
| 3 |
+
size 4996140152
|
model-00029-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ea061972fd9b8f89154b3c3c945843e66ba18fd04514f5442dbc6abf8385c29
|
| 3 |
+
size 4997471120
|
model-00030-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d2fb46c1ae8e6773ad141cc99fbf1fef9dfc0ae76c57948e1b2be5968569de04
|
| 3 |
+
size 4993417088
|
model-00031-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8d9b4e433c8eed1ab2d8474dd52c6b3bc54ec4d3c9ec6f626aaa32a0144efc2
|
| 3 |
+
size 5000194200
|
model-00032-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ffc91671dd32146bfb2fe0a7f97c662ef5342cf8c88af2e796841fb0274cf4e7
|
| 3 |
+
size 4997472400
|
model-00033-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87a0fdf8e1404a70502fed5ce9323f5d28bcadf9291c9edc68d15303d4b7b906
|
| 3 |
+
size 4996138872
|
model-00034-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3c295bed3493264aa43ed7d3f9c6a71d03cc3bb9a9a6aaef29c4cc9bb820c2d8
|
| 3 |
+
size 4997472184
|
model-00035-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b899fffb7cb106dcb75c666348cdbac292f2c1e3a88bfd039e8392a914d43e90
|
| 3 |
+
size 4996139088
|
model-00036-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fac4e2d921754fc66ad87dd329483291de4cca79e0cd0d17d5fd6302a6561b25
|
| 3 |
+
size 4997472064
|
model-00037-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:49bb8b65c1f032256c5e50dd52be56dee2c28655e77e99eb4c01de0231489217
|
| 3 |
+
size 4996139208
|
model-00038-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:6dd7ad07083bbcef3a8064f7605c3b1eb995739835351792beb298d4b4414323
|
| 3 |
+
size 4997471944
|
model-00039-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:52f16d0bae9c9388fd4f2092cba1aa9482981f4a36e6a55ef71958ba3545bcf2
|
| 3 |
+
size 4996139328
|
model-00040-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:180a6248a182e9d48ff2abd39b8bbd57c53b4a3dfddc3f177af5ddb5b2a0c2c1
|
| 3 |
+
size 4997471824
|
model-00041-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d6dea05436fd657b83c05c57971db86cbab60f6798e64f3b6ab8cab4e13dc73c
|
| 3 |
+
size 4996139448
|
model-00042-of-00119.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d2ed16abb8835b8b21ccccacf5b2b7707ab5e80b57f2cb0dc0a5a4dad58157bd
|
| 3 |
+
size 4997471704
|