Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- added_tokens.json +107 -0
- chat_template.jinja +88 -0
- config.json +102 -0
- configuration_minicpm.py +101 -0
- generation_config.json +16 -0
- image_processing_minicpmv.py +501 -0
- merges.txt +0 -0
- modeling_navit_siglip.py +937 -0
- openvino_detokenizer.bin +3 -0
- openvino_detokenizer.xml +222 -0
- openvino_language_model.bin +3 -0
- openvino_language_model.xml +0 -0
- openvino_resampler_model.bin +3 -0
- openvino_resampler_model.xml +2179 -0
- openvino_text_embeddings_model.bin +3 -0
- openvino_text_embeddings_model.xml +227 -0
- openvino_tokenizer.bin +3 -0
- openvino_tokenizer.xml +773 -0
- openvino_vision_embeddings_model.bin +3 -0
- openvino_vision_embeddings_model.xml +0 -0
- preprocessor_config.json +47 -0
- processing_minicpmv.py +255 -0
- processor_config.json +6 -0
- special_tokens_map.json +112 -0
- tokenization_minicpmv_fast.py +66 -0
- tokenizer.json +3 -0
- tokenizer_config.json +954 -0
- vocab.json +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
added_tokens.json
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"</box>": 151674,
|
| 3 |
+
"</image>": 151670,
|
| 4 |
+
"</image_id>": 151682,
|
| 5 |
+
"</point>": 151678,
|
| 6 |
+
"</quad>": 151676,
|
| 7 |
+
"</ref>": 151672,
|
| 8 |
+
"</slice>": 151680,
|
| 9 |
+
"</think>": 151668,
|
| 10 |
+
"</tool_call>": 151658,
|
| 11 |
+
"</tool_response>": 151666,
|
| 12 |
+
"</unit>": 151684,
|
| 13 |
+
"<box>": 151673,
|
| 14 |
+
"<image>": 151669,
|
| 15 |
+
"<image_id>": 151681,
|
| 16 |
+
"<point>": 151677,
|
| 17 |
+
"<quad>": 151675,
|
| 18 |
+
"<ref>": 151671,
|
| 19 |
+
"<slice>": 151679,
|
| 20 |
+
"<think>": 151667,
|
| 21 |
+
"<tool_call>": 151657,
|
| 22 |
+
"<tool_response>": 151665,
|
| 23 |
+
"<unit>": 151683,
|
| 24 |
+
"<|box_end|>": 151649,
|
| 25 |
+
"<|box_start|>": 151648,
|
| 26 |
+
"<|endoftext|>": 151643,
|
| 27 |
+
"<|file_sep|>": 151664,
|
| 28 |
+
"<|fim_middle|>": 151660,
|
| 29 |
+
"<|fim_pad|>": 151662,
|
| 30 |
+
"<|fim_prefix|>": 151659,
|
| 31 |
+
"<|fim_suffix|>": 151661,
|
| 32 |
+
"<|im_end|>": 151645,
|
| 33 |
+
"<|im_start|>": 151644,
|
| 34 |
+
"<|image_pad|>": 151655,
|
| 35 |
+
"<|object_ref_end|>": 151647,
|
| 36 |
+
"<|object_ref_start|>": 151646,
|
| 37 |
+
"<|quad_end|>": 151651,
|
| 38 |
+
"<|quad_start|>": 151650,
|
| 39 |
+
"<|repo_name|>": 151663,
|
| 40 |
+
"<|reserved_0|>": 151685,
|
| 41 |
+
"<|reserved_10|>": 151695,
|
| 42 |
+
"<|reserved_11|>": 151696,
|
| 43 |
+
"<|reserved_12|>": 151697,
|
| 44 |
+
"<|reserved_13|>": 151698,
|
| 45 |
+
"<|reserved_14|>": 151699,
|
| 46 |
+
"<|reserved_15|>": 151700,
|
| 47 |
+
"<|reserved_16|>": 151701,
|
| 48 |
+
"<|reserved_17|>": 151702,
|
| 49 |
+
"<|reserved_18|>": 151703,
|
| 50 |
+
"<|reserved_19|>": 151704,
|
| 51 |
+
"<|reserved_1|>": 151686,
|
| 52 |
+
"<|reserved_20|>": 151705,
|
| 53 |
+
"<|reserved_21|>": 151706,
|
| 54 |
+
"<|reserved_22|>": 151707,
|
| 55 |
+
"<|reserved_23|>": 151708,
|
| 56 |
+
"<|reserved_24|>": 151709,
|
| 57 |
+
"<|reserved_25|>": 151710,
|
| 58 |
+
"<|reserved_26|>": 151711,
|
| 59 |
+
"<|reserved_27|>": 151712,
|
| 60 |
+
"<|reserved_28|>": 151713,
|
| 61 |
+
"<|reserved_29|>": 151714,
|
| 62 |
+
"<|reserved_2|>": 151687,
|
| 63 |
+
"<|reserved_30|>": 151715,
|
| 64 |
+
"<|reserved_31|>": 151716,
|
| 65 |
+
"<|reserved_32|>": 151717,
|
| 66 |
+
"<|reserved_33|>": 151718,
|
| 67 |
+
"<|reserved_34|>": 151719,
|
| 68 |
+
"<|reserved_35|>": 151720,
|
| 69 |
+
"<|reserved_36|>": 151721,
|
| 70 |
+
"<|reserved_37|>": 151722,
|
| 71 |
+
"<|reserved_38|>": 151723,
|
| 72 |
+
"<|reserved_39|>": 151724,
|
| 73 |
+
"<|reserved_3|>": 151688,
|
| 74 |
+
"<|reserved_40|>": 151725,
|
| 75 |
+
"<|reserved_41|>": 151726,
|
| 76 |
+
"<|reserved_42|>": 151727,
|
| 77 |
+
"<|reserved_43|>": 151728,
|
| 78 |
+
"<|reserved_44|>": 151729,
|
| 79 |
+
"<|reserved_45|>": 151730,
|
| 80 |
+
"<|reserved_46|>": 151731,
|
| 81 |
+
"<|reserved_47|>": 151732,
|
| 82 |
+
"<|reserved_48|>": 151733,
|
| 83 |
+
"<|reserved_49|>": 151734,
|
| 84 |
+
"<|reserved_4|>": 151689,
|
| 85 |
+
"<|reserved_50|>": 151735,
|
| 86 |
+
"<|reserved_51|>": 151736,
|
| 87 |
+
"<|reserved_52|>": 151737,
|
| 88 |
+
"<|reserved_53|>": 151738,
|
| 89 |
+
"<|reserved_54|>": 151739,
|
| 90 |
+
"<|reserved_55|>": 151740,
|
| 91 |
+
"<|reserved_56|>": 151741,
|
| 92 |
+
"<|reserved_57|>": 151742,
|
| 93 |
+
"<|reserved_58|>": 151743,
|
| 94 |
+
"<|reserved_59|>": 151744,
|
| 95 |
+
"<|reserved_5|>": 151690,
|
| 96 |
+
"<|reserved_60|>": 151745,
|
| 97 |
+
"<|reserved_61|>": 151746,
|
| 98 |
+
"<|reserved_62|>": 151747,
|
| 99 |
+
"<|reserved_6|>": 151691,
|
| 100 |
+
"<|reserved_7|>": 151692,
|
| 101 |
+
"<|reserved_8|>": 151693,
|
| 102 |
+
"<|reserved_9|>": 151694,
|
| 103 |
+
"<|video_pad|>": 151656,
|
| 104 |
+
"<|vision_end|>": 151653,
|
| 105 |
+
"<|vision_pad|>": 151654,
|
| 106 |
+
"<|vision_start|>": 151652
|
| 107 |
+
}
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0].role == 'system' %}
|
| 4 |
+
{{- messages[0].content + '\n\n' }}
|
| 5 |
+
{%- endif %}
|
| 6 |
+
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 7 |
+
{%- for tool in tools %}
|
| 8 |
+
{{- "\n" }}
|
| 9 |
+
{{- tool | tojson }}
|
| 10 |
+
{%- endfor %}
|
| 11 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 12 |
+
{%- else %}
|
| 13 |
+
{%- if messages[0].role == 'system' %}
|
| 14 |
+
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
| 15 |
+
{%- endif %}
|
| 16 |
+
{%- endif %}
|
| 17 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 18 |
+
{%- for message in messages[::-1] %}
|
| 19 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 20 |
+
{%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
|
| 21 |
+
{%- set ns.multi_step_tool = false %}
|
| 22 |
+
{%- set ns.last_query_index = index %}
|
| 23 |
+
{%- endif %}
|
| 24 |
+
{%- endfor %}
|
| 25 |
+
{%- for message in messages %}
|
| 26 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 27 |
+
{{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }}
|
| 28 |
+
{%- elif message.role == "assistant" %}
|
| 29 |
+
{%- set content = message.content %}
|
| 30 |
+
{%- set reasoning_content = '' %}
|
| 31 |
+
{%- if message.reasoning_content is defined and message.reasoning_content is not none %}
|
| 32 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 33 |
+
{%- else %}
|
| 34 |
+
{%- if '</think>' in message.content %}
|
| 35 |
+
{%- set content = message.content.split('</think>')[-1].lstrip('\n') %}
|
| 36 |
+
{%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 37 |
+
{%- endif %}
|
| 38 |
+
{%- endif %}
|
| 39 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 40 |
+
{%- if loop.last or (not loop.last and reasoning_content) %}
|
| 41 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 42 |
+
{%- else %}
|
| 43 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 44 |
+
{%- endif %}
|
| 45 |
+
{%- else %}
|
| 46 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 47 |
+
{%- endif %}
|
| 48 |
+
{%- if message.tool_calls %}
|
| 49 |
+
{%- for tool_call in message.tool_calls %}
|
| 50 |
+
{%- if (loop.first and content) or (not loop.first) %}
|
| 51 |
+
{{- '\n' }}
|
| 52 |
+
{%- endif %}
|
| 53 |
+
{%- if tool_call.function %}
|
| 54 |
+
{%- set tool_call = tool_call.function %}
|
| 55 |
+
{%- endif %}
|
| 56 |
+
{{- '<tool_call>\n{"name": "' }}
|
| 57 |
+
{{- tool_call.name }}
|
| 58 |
+
{{- '", "arguments": ' }}
|
| 59 |
+
{%- if tool_call.arguments is string %}
|
| 60 |
+
{{- tool_call.arguments }}
|
| 61 |
+
{%- else %}
|
| 62 |
+
{{- tool_call.arguments | tojson }}
|
| 63 |
+
{%- endif %}
|
| 64 |
+
{{- '}\n</tool_call>' }}
|
| 65 |
+
{%- endfor %}
|
| 66 |
+
{%- endif %}
|
| 67 |
+
{{- '<|im_end|>\n' }}
|
| 68 |
+
{%- elif message.role == "tool" %}
|
| 69 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 70 |
+
{{- '<|im_start|>user' }}
|
| 71 |
+
{%- endif %}
|
| 72 |
+
{{- '\n<tool_response>\n' }}
|
| 73 |
+
{{- message.content }}
|
| 74 |
+
{{- '\n</tool_response>' }}
|
| 75 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 76 |
+
{{- '<|im_end|>\n' }}
|
| 77 |
+
{%- endif %}
|
| 78 |
+
{%- endif %}
|
| 79 |
+
{%- endfor %}
|
| 80 |
+
{%- if add_generation_prompt %}
|
| 81 |
+
{{- '<|im_start|>assistant\n' }}
|
| 82 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 83 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 84 |
+
{%- endif %}
|
| 85 |
+
{%- if enable_thinking is defined and enable_thinking is true %}
|
| 86 |
+
{{- '<think>\n' }}
|
| 87 |
+
{%- endif %}
|
| 88 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"MiniCPMV"
|
| 4 |
+
],
|
| 5 |
+
"attention_bias": false,
|
| 6 |
+
"attention_dropout": 0.0,
|
| 7 |
+
"auto_map": {
|
| 8 |
+
"AutoConfig": "configuration_minicpm.MiniCPMVConfig",
|
| 9 |
+
"AutoModel": "modeling_minicpmv.MiniCPMV",
|
| 10 |
+
"AutoModelForCausalLM": "modeling_minicpmv.MiniCPMV"
|
| 11 |
+
},
|
| 12 |
+
"batch_3d_resampler": true,
|
| 13 |
+
"batch_vision_input": true,
|
| 14 |
+
"bos_token_id": 151643,
|
| 15 |
+
"drop_vision_last_layer": false,
|
| 16 |
+
"eos_token_id": 151645,
|
| 17 |
+
"head_dim": 128,
|
| 18 |
+
"hidden_act": "silu",
|
| 19 |
+
"hidden_size": 4096,
|
| 20 |
+
"image_size": 448,
|
| 21 |
+
"initializer_range": 0.02,
|
| 22 |
+
"intermediate_size": 12288,
|
| 23 |
+
"layer_types": [
|
| 24 |
+
"full_attention",
|
| 25 |
+
"full_attention",
|
| 26 |
+
"full_attention",
|
| 27 |
+
"full_attention",
|
| 28 |
+
"full_attention",
|
| 29 |
+
"full_attention",
|
| 30 |
+
"full_attention",
|
| 31 |
+
"full_attention",
|
| 32 |
+
"full_attention",
|
| 33 |
+
"full_attention",
|
| 34 |
+
"full_attention",
|
| 35 |
+
"full_attention",
|
| 36 |
+
"full_attention",
|
| 37 |
+
"full_attention",
|
| 38 |
+
"full_attention",
|
| 39 |
+
"full_attention",
|
| 40 |
+
"full_attention",
|
| 41 |
+
"full_attention",
|
| 42 |
+
"full_attention",
|
| 43 |
+
"full_attention",
|
| 44 |
+
"full_attention",
|
| 45 |
+
"full_attention",
|
| 46 |
+
"full_attention",
|
| 47 |
+
"full_attention",
|
| 48 |
+
"full_attention",
|
| 49 |
+
"full_attention",
|
| 50 |
+
"full_attention",
|
| 51 |
+
"full_attention",
|
| 52 |
+
"full_attention",
|
| 53 |
+
"full_attention",
|
| 54 |
+
"full_attention",
|
| 55 |
+
"full_attention",
|
| 56 |
+
"full_attention",
|
| 57 |
+
"full_attention",
|
| 58 |
+
"full_attention",
|
| 59 |
+
"full_attention"
|
| 60 |
+
],
|
| 61 |
+
"max_position_embeddings": 40960,
|
| 62 |
+
"max_window_layers": 36,
|
| 63 |
+
"model_type": "minicpmv",
|
| 64 |
+
"num_attention_heads": 32,
|
| 65 |
+
"num_hidden_layers": 36,
|
| 66 |
+
"num_key_value_heads": 8,
|
| 67 |
+
"patch_size": 14,
|
| 68 |
+
"query_num": 64,
|
| 69 |
+
"rms_norm_eps": 1e-06,
|
| 70 |
+
"rope_scaling": null,
|
| 71 |
+
"rope_theta": 1000000,
|
| 72 |
+
"slice_config": {
|
| 73 |
+
"max_slice_nums": 9,
|
| 74 |
+
"model_type": "minicpmv",
|
| 75 |
+
"patch_size": 14,
|
| 76 |
+
"scale_resolution": 448
|
| 77 |
+
},
|
| 78 |
+
"slice_mode": true,
|
| 79 |
+
"sliding_window": null,
|
| 80 |
+
"tie_word_embeddings": false,
|
| 81 |
+
"torch_dtype": "bfloat16",
|
| 82 |
+
"transformers_version": "4.53.3",
|
| 83 |
+
"use_cache": true,
|
| 84 |
+
"use_image_id": true,
|
| 85 |
+
"use_sliding_window": false,
|
| 86 |
+
"version": 4.5,
|
| 87 |
+
"vision_batch_size": 16,
|
| 88 |
+
"vision_config": {
|
| 89 |
+
"attention_dropout": 0.0,
|
| 90 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 91 |
+
"hidden_size": 1152,
|
| 92 |
+
"image_size": 980,
|
| 93 |
+
"intermediate_size": 4304,
|
| 94 |
+
"layer_norm_eps": 1e-06,
|
| 95 |
+
"model_type": "siglip_vision_model",
|
| 96 |
+
"num_attention_heads": 16,
|
| 97 |
+
"num_channels": 3,
|
| 98 |
+
"num_hidden_layers": 27,
|
| 99 |
+
"patch_size": 14
|
| 100 |
+
},
|
| 101 |
+
"vocab_size": 151748
|
| 102 |
+
}
|
configuration_minicpm.py
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
""" MiniCPMV model configuration"""
|
| 3 |
+
|
| 4 |
+
import os
|
| 5 |
+
from typing import Union
|
| 6 |
+
|
| 7 |
+
from transformers.utils import logging
|
| 8 |
+
from transformers import Qwen3Config, PretrainedConfig
|
| 9 |
+
from .modeling_navit_siglip import SiglipVisionConfig
|
| 10 |
+
|
| 11 |
+
logger = logging.get_logger(__name__)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
class MiniCPMVSliceConfig(PretrainedConfig):
|
| 15 |
+
model_type = "minicpmv"
|
| 16 |
+
|
| 17 |
+
def __init__(
|
| 18 |
+
self,
|
| 19 |
+
patch_size=14,
|
| 20 |
+
max_slice_nums=9,
|
| 21 |
+
scale_resolution=448,
|
| 22 |
+
**kwargs,
|
| 23 |
+
):
|
| 24 |
+
super().__init__(**kwargs)
|
| 25 |
+
self.patch_size = patch_size
|
| 26 |
+
self.max_slice_nums = max_slice_nums
|
| 27 |
+
self.scale_resolution = scale_resolution
|
| 28 |
+
|
| 29 |
+
@classmethod
|
| 30 |
+
def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> "PretrainedConfig":
|
| 31 |
+
cls._set_token_in_kwargs(kwargs)
|
| 32 |
+
|
| 33 |
+
config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
|
| 34 |
+
|
| 35 |
+
if config_dict.get("model_type") == "minicpmv":
|
| 36 |
+
config_dict = config_dict["slice_config"]
|
| 37 |
+
|
| 38 |
+
if "model_type" in config_dict and hasattr(cls, "model_type") and config_dict["model_type"] != cls.model_type:
|
| 39 |
+
logger.warning(
|
| 40 |
+
f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
|
| 41 |
+
f"{cls.model_type}. This is not supported for all configurations of models and can yield errors."
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
return cls.from_dict(config_dict, **kwargs)
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
class MiniCPMVConfig(Qwen3Config):
|
| 49 |
+
model_type = "minicpmv"
|
| 50 |
+
keys_to_ignore_at_inference = ["past_key_values"]
|
| 51 |
+
|
| 52 |
+
default_vision_config = {
|
| 53 |
+
"hidden_size": 1152,
|
| 54 |
+
"image_size": 980,
|
| 55 |
+
"intermediate_size": 4304,
|
| 56 |
+
"model_type": "siglip",
|
| 57 |
+
"num_attention_heads": 16,
|
| 58 |
+
"num_hidden_layers": 27,
|
| 59 |
+
"patch_size": 14,
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
def __init__(
|
| 63 |
+
self,
|
| 64 |
+
use_cache=True,
|
| 65 |
+
query_num=64,
|
| 66 |
+
image_size=448,
|
| 67 |
+
drop_vision_last_layer=True,
|
| 68 |
+
batch_vision_input=True,
|
| 69 |
+
slice_config=None,
|
| 70 |
+
vision_config=None,
|
| 71 |
+
use_image_id=True,
|
| 72 |
+
vision_batch_size=16,
|
| 73 |
+
batch_3d_resampler=True,
|
| 74 |
+
**kwargs,
|
| 75 |
+
):
|
| 76 |
+
self.use_cache = use_cache
|
| 77 |
+
self.query_num = query_num
|
| 78 |
+
self.image_size = image_size
|
| 79 |
+
self.drop_vision_last_layer = drop_vision_last_layer
|
| 80 |
+
self.batch_vision_input = batch_vision_input
|
| 81 |
+
self.use_image_id = use_image_id
|
| 82 |
+
self.vision_batch_size = vision_batch_size
|
| 83 |
+
self.batch_3d_resampler = batch_3d_resampler
|
| 84 |
+
|
| 85 |
+
if slice_config is None:
|
| 86 |
+
self.slice_config = MiniCPMVSliceConfig(max_slice_nums=1)
|
| 87 |
+
else:
|
| 88 |
+
self.slice_config = MiniCPMVSliceConfig(**slice_config)
|
| 89 |
+
self.slice_mode = True
|
| 90 |
+
|
| 91 |
+
# same as HuggingFaceM4/siglip-so400m-14-980-flash-attn2-navit add tgt_sizes
|
| 92 |
+
if vision_config is None:
|
| 93 |
+
self.vision_config = SiglipVisionConfig(**self.default_vision_config)
|
| 94 |
+
elif isinstance(vision_config, dict):
|
| 95 |
+
self.vision_config = SiglipVisionConfig(**vision_config)
|
| 96 |
+
elif isinstance(vision_config, SiglipVisionConfig):
|
| 97 |
+
self.vision_config = vision_config
|
| 98 |
+
|
| 99 |
+
self.patch_size = self.vision_config.patch_size
|
| 100 |
+
|
| 101 |
+
super().__init__(**kwargs)
|
generation_config.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"chat_template_kwargs": {
|
| 4 |
+
"enable_thinking": false
|
| 5 |
+
},
|
| 6 |
+
"do_sample": true,
|
| 7 |
+
"eos_token_id": [
|
| 8 |
+
151645,
|
| 9 |
+
151643
|
| 10 |
+
],
|
| 11 |
+
"pad_token_id": 151643,
|
| 12 |
+
"temperature": 0.6,
|
| 13 |
+
"top_k": 20,
|
| 14 |
+
"top_p": 0.95,
|
| 15 |
+
"transformers_version": "4.53.3"
|
| 16 |
+
}
|
image_processing_minicpmv.py
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
import PIL.Image
|
| 7 |
+
import PIL.ImageSequence
|
| 8 |
+
import numpy as np
|
| 9 |
+
import PIL
|
| 10 |
+
from PIL import Image
|
| 11 |
+
|
| 12 |
+
from transformers.utils import TensorType, requires_backends, is_torch_dtype, is_torch_device
|
| 13 |
+
from transformers.image_processing_utils import BaseImageProcessor, BatchFeature
|
| 14 |
+
from transformers import AutoImageProcessor
|
| 15 |
+
from transformers.image_transforms import to_channel_dimension_format
|
| 16 |
+
from transformers.image_utils import (
|
| 17 |
+
ImageInput,
|
| 18 |
+
make_list_of_images,
|
| 19 |
+
valid_images,
|
| 20 |
+
is_torch_tensor,
|
| 21 |
+
is_batched,
|
| 22 |
+
to_numpy_array,
|
| 23 |
+
infer_channel_dimension_format,
|
| 24 |
+
ChannelDimension
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def recursive_converter(converter, value):
|
| 29 |
+
if isinstance(value, list):
|
| 30 |
+
new_value = []
|
| 31 |
+
for v in value:
|
| 32 |
+
new_value += [recursive_converter(converter, v)]
|
| 33 |
+
return new_value
|
| 34 |
+
else:
|
| 35 |
+
return converter(value)
|
| 36 |
+
|
| 37 |
+
def list_depth(lst):
|
| 38 |
+
if not isinstance(lst, list) and not isinstance(lst, np.ndarray):
|
| 39 |
+
return 0
|
| 40 |
+
# if not lst: # 空列表
|
| 41 |
+
# return 1
|
| 42 |
+
return 1 + max(list_depth(item) for item in lst)
|
| 43 |
+
|
| 44 |
+
class MiniCPMVBatchFeature(BatchFeature):
|
| 45 |
+
r"""
|
| 46 |
+
Extend from BatchFeature for supporting various image size
|
| 47 |
+
"""
|
| 48 |
+
def __init__(self, data: Optional[Dict[str, Any]] = None, tensor_type: Union[None, str, TensorType] = None):
|
| 49 |
+
super().__init__(data)
|
| 50 |
+
self.convert_to_tensors(tensor_type=tensor_type)
|
| 51 |
+
|
| 52 |
+
def convert_to_tensors(self, tensor_type: Optional[Union[str, TensorType]] = None):
|
| 53 |
+
if tensor_type is None:
|
| 54 |
+
return self
|
| 55 |
+
|
| 56 |
+
is_tensor, as_tensor = self._get_is_as_tensor_fns(tensor_type)
|
| 57 |
+
|
| 58 |
+
def converter(value):
|
| 59 |
+
try:
|
| 60 |
+
if not is_tensor(value):
|
| 61 |
+
tensor = as_tensor(value)
|
| 62 |
+
return tensor
|
| 63 |
+
except: # noqa E722
|
| 64 |
+
if key == "overflowing_values":
|
| 65 |
+
raise ValueError("Unable to create tensor returning overflowing values of different lengths. ")
|
| 66 |
+
raise ValueError(
|
| 67 |
+
"Unable to create tensor, you should probably activate padding "
|
| 68 |
+
"with 'padding=True' to have batched tensors with the same length."
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
|
| 72 |
+
for key, value in self.items():
|
| 73 |
+
self[key] = recursive_converter(converter, value)
|
| 74 |
+
return self
|
| 75 |
+
|
| 76 |
+
def to(self, *args, **kwargs) -> "MiniCPMVBatchFeature":
|
| 77 |
+
requires_backends(self, ["torch"])
|
| 78 |
+
import torch
|
| 79 |
+
|
| 80 |
+
def cast_tensor(v):
|
| 81 |
+
# check if v is a floating point
|
| 82 |
+
if torch.is_floating_point(v):
|
| 83 |
+
# cast and send to device
|
| 84 |
+
return v.to(*args, **kwargs)
|
| 85 |
+
elif device is not None:
|
| 86 |
+
return v.to(device=device)
|
| 87 |
+
else:
|
| 88 |
+
return v
|
| 89 |
+
|
| 90 |
+
new_data = {}
|
| 91 |
+
device = kwargs.get("device")
|
| 92 |
+
# Check if the args are a device or a dtype
|
| 93 |
+
if device is None and len(args) > 0:
|
| 94 |
+
# device should be always the first argument
|
| 95 |
+
arg = args[0]
|
| 96 |
+
if is_torch_dtype(arg):
|
| 97 |
+
# The first argument is a dtype
|
| 98 |
+
pass
|
| 99 |
+
elif isinstance(arg, str) or is_torch_device(arg) or isinstance(arg, int):
|
| 100 |
+
device = arg
|
| 101 |
+
else:
|
| 102 |
+
# it's something else
|
| 103 |
+
raise ValueError(f"Attempting to cast a BatchFeature to type {str(arg)}. This is not supported.")
|
| 104 |
+
# We cast only floating point tensors to avoid issues with tokenizers casting `LongTensor` to `FloatTensor`
|
| 105 |
+
for k, v in self.items():
|
| 106 |
+
new_data[k] = recursive_converter(cast_tensor, v)
|
| 107 |
+
self.data = new_data
|
| 108 |
+
return self
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
class MiniCPMVImageProcessor(BaseImageProcessor):
|
| 112 |
+
model_input_names = ["pixel_values"]
|
| 113 |
+
|
| 114 |
+
def __init__(
|
| 115 |
+
self,
|
| 116 |
+
max_slice_nums=9,
|
| 117 |
+
scale_resolution=448,
|
| 118 |
+
patch_size=14,
|
| 119 |
+
**kwargs):
|
| 120 |
+
super().__init__(**kwargs)
|
| 121 |
+
self.max_slice_nums = max_slice_nums
|
| 122 |
+
self.scale_resolution = scale_resolution
|
| 123 |
+
self.patch_size = patch_size
|
| 124 |
+
self.use_image_id = kwargs.pop("use_image_id", False)
|
| 125 |
+
self.image_feature_size = kwargs.pop("image_feature_size", 64)
|
| 126 |
+
self.im_start_token = kwargs.pop("im_start", "<image>")
|
| 127 |
+
self.im_end_token = kwargs.pop("im_end", "</image>")
|
| 128 |
+
self.slice_start_token = kwargs.pop("slice_start", "<slice>")
|
| 129 |
+
self.slice_end_token = kwargs.pop("slice_end", "</slice>")
|
| 130 |
+
self.unk_token = kwargs.pop("unk", "<unk>")
|
| 131 |
+
self.im_id_start = kwargs.pop("im_id_start", "<image_id>")
|
| 132 |
+
self.im_id_end = kwargs.pop("im_id_end", "</image_id>")
|
| 133 |
+
self.slice_mode = kwargs.pop("slice_mode", True)
|
| 134 |
+
self.mean = np.array(kwargs.pop("norm_mean", [0.5, 0.5, 0.5]))
|
| 135 |
+
self.std = np.array(kwargs.pop("norm_std", [0.5, 0.5, 0.5]))
|
| 136 |
+
self.version = kwargs.pop("version", 2.0)
|
| 137 |
+
|
| 138 |
+
def ensure_divide(self, length, patch_size):
|
| 139 |
+
return max(round(length / patch_size) * patch_size, patch_size)
|
| 140 |
+
|
| 141 |
+
def find_best_resize(self,
|
| 142 |
+
original_size,
|
| 143 |
+
scale_resolution,
|
| 144 |
+
patch_size,
|
| 145 |
+
allow_upscale=False):
|
| 146 |
+
width, height = original_size
|
| 147 |
+
if (width * height >
|
| 148 |
+
scale_resolution * scale_resolution) or allow_upscale:
|
| 149 |
+
r = width / height
|
| 150 |
+
height = int(scale_resolution / math.sqrt(r))
|
| 151 |
+
width = int(height * r)
|
| 152 |
+
best_width = self.ensure_divide(width, patch_size)
|
| 153 |
+
best_height = self.ensure_divide(height, patch_size)
|
| 154 |
+
return (best_width, best_height)
|
| 155 |
+
|
| 156 |
+
def get_refine_size(self,
|
| 157 |
+
original_size,
|
| 158 |
+
grid,
|
| 159 |
+
scale_resolution,
|
| 160 |
+
patch_size,
|
| 161 |
+
allow_upscale=False):
|
| 162 |
+
width, height = original_size
|
| 163 |
+
grid_x, grid_y = grid
|
| 164 |
+
|
| 165 |
+
refine_width = self.ensure_divide(width, grid_x)
|
| 166 |
+
refine_height = self.ensure_divide(height, grid_y)
|
| 167 |
+
|
| 168 |
+
grid_width = refine_width / grid_x
|
| 169 |
+
grid_height = refine_height / grid_y
|
| 170 |
+
|
| 171 |
+
best_grid_size = self.find_best_resize((grid_width, grid_height),
|
| 172 |
+
scale_resolution,
|
| 173 |
+
patch_size,
|
| 174 |
+
allow_upscale=allow_upscale)
|
| 175 |
+
refine_size = (best_grid_size[0] * grid_x, best_grid_size[1] * grid_y)
|
| 176 |
+
return refine_size
|
| 177 |
+
|
| 178 |
+
def split_to_patches(self, image, grid):
|
| 179 |
+
patches = []
|
| 180 |
+
width, height = image.size
|
| 181 |
+
grid_x = int(width / grid[0])
|
| 182 |
+
grid_y = int(height / grid[1])
|
| 183 |
+
for i in range(0, height, grid_y):
|
| 184 |
+
images = []
|
| 185 |
+
for j in range(0, width, grid_x):
|
| 186 |
+
box = (j, i, j + grid_x, i + grid_y)
|
| 187 |
+
patch = image.crop(box)
|
| 188 |
+
images.append(patch)
|
| 189 |
+
patches.append(images)
|
| 190 |
+
return patches
|
| 191 |
+
|
| 192 |
+
def slice_image(
|
| 193 |
+
self, image, max_slice_nums=9, scale_resolution=448, patch_size=14, never_split=False
|
| 194 |
+
):
|
| 195 |
+
original_size = image.size
|
| 196 |
+
source_image = None
|
| 197 |
+
best_grid = self.get_sliced_grid(original_size, max_slice_nums, never_split)
|
| 198 |
+
patches = []
|
| 199 |
+
|
| 200 |
+
if best_grid is None:
|
| 201 |
+
# dont need to slice, upsample
|
| 202 |
+
best_size = self.find_best_resize(
|
| 203 |
+
original_size, scale_resolution, patch_size, allow_upscale=True
|
| 204 |
+
)
|
| 205 |
+
source_image = image.resize(best_size, resample=Image.Resampling.BICUBIC)
|
| 206 |
+
else:
|
| 207 |
+
# source image, down-sampling and ensure divided by patch_size
|
| 208 |
+
best_resize = self.find_best_resize(original_size, scale_resolution, patch_size)
|
| 209 |
+
source_image = image.copy().resize(best_resize, resample=Image.Resampling.BICUBIC)
|
| 210 |
+
refine_size = self.get_refine_size(
|
| 211 |
+
original_size, best_grid, scale_resolution, patch_size, allow_upscale=True
|
| 212 |
+
)
|
| 213 |
+
refine_image = image.resize(refine_size, resample=Image.Resampling.BICUBIC)
|
| 214 |
+
patches = self.split_to_patches(refine_image, best_grid)
|
| 215 |
+
|
| 216 |
+
return source_image, patches, best_grid
|
| 217 |
+
|
| 218 |
+
def get_grid_placeholder(self, grid):
|
| 219 |
+
if grid is None:
|
| 220 |
+
return ""
|
| 221 |
+
slice_image_placeholder = (
|
| 222 |
+
self.slice_start_token
|
| 223 |
+
+ self.unk_token * self.image_feature_size
|
| 224 |
+
+ self.slice_end_token
|
| 225 |
+
)
|
| 226 |
+
|
| 227 |
+
cols = grid[0]
|
| 228 |
+
rows = grid[1]
|
| 229 |
+
slices = []
|
| 230 |
+
for i in range(rows):
|
| 231 |
+
lines = []
|
| 232 |
+
for j in range(cols):
|
| 233 |
+
lines.append(slice_image_placeholder)
|
| 234 |
+
slices.append("".join(lines))
|
| 235 |
+
|
| 236 |
+
slice_placeholder = "\n".join(slices)
|
| 237 |
+
return slice_placeholder
|
| 238 |
+
|
| 239 |
+
def get_image_id_placeholder(self, idx=0):
|
| 240 |
+
return f"{self.im_id_start}{idx}{self.im_id_end}"
|
| 241 |
+
|
| 242 |
+
def get_sliced_images(self, image, max_slice_nums=None):
|
| 243 |
+
slice_images = []
|
| 244 |
+
|
| 245 |
+
if not self.slice_mode:
|
| 246 |
+
return [image]
|
| 247 |
+
|
| 248 |
+
max_slice_nums = self.max_slice_nums if max_slice_nums is None else int(max_slice_nums)
|
| 249 |
+
assert max_slice_nums > 0
|
| 250 |
+
source_image, patches, sliced_grid = self.slice_image(
|
| 251 |
+
image,
|
| 252 |
+
max_slice_nums, # default: 9
|
| 253 |
+
self.scale_resolution, # default: 448
|
| 254 |
+
self.patch_size # default: 14
|
| 255 |
+
)
|
| 256 |
+
|
| 257 |
+
slice_images.append(source_image)
|
| 258 |
+
if len(patches) > 0:
|
| 259 |
+
for i in range(len(patches)):
|
| 260 |
+
for j in range(len(patches[0])):
|
| 261 |
+
slice_images.append(patches[i][j])
|
| 262 |
+
return slice_images
|
| 263 |
+
|
| 264 |
+
def get_sliced_grid(self, image_size, max_slice_nums, nerver_split=False):
|
| 265 |
+
original_width, original_height = image_size
|
| 266 |
+
log_ratio = math.log(original_width / original_height)
|
| 267 |
+
ratio = original_width * original_height / (self.scale_resolution * self.scale_resolution)
|
| 268 |
+
multiple = min(math.ceil(ratio), max_slice_nums)
|
| 269 |
+
if multiple <= 1 or nerver_split:
|
| 270 |
+
return None
|
| 271 |
+
candidate_split_grids_nums = []
|
| 272 |
+
for i in [multiple - 1, multiple, multiple + 1]:
|
| 273 |
+
if i == 1 or i > max_slice_nums:
|
| 274 |
+
continue
|
| 275 |
+
candidate_split_grids_nums.append(i)
|
| 276 |
+
|
| 277 |
+
candidate_grids = []
|
| 278 |
+
for split_grids_nums in candidate_split_grids_nums:
|
| 279 |
+
m = 1
|
| 280 |
+
while m <= split_grids_nums:
|
| 281 |
+
if split_grids_nums % m == 0:
|
| 282 |
+
candidate_grids.append([m, split_grids_nums // m])
|
| 283 |
+
m += 1
|
| 284 |
+
|
| 285 |
+
best_grid = [1, 1]
|
| 286 |
+
min_error = float("inf")
|
| 287 |
+
for grid in candidate_grids:
|
| 288 |
+
error = abs(log_ratio - math.log(grid[0] / grid[1]))
|
| 289 |
+
if error < min_error:
|
| 290 |
+
best_grid = grid
|
| 291 |
+
min_error = error
|
| 292 |
+
|
| 293 |
+
return best_grid
|
| 294 |
+
|
| 295 |
+
def get_slice_image_placeholder(self, image_size, image_idx=0, max_slice_nums=None, use_image_id=None):
|
| 296 |
+
max_slice_nums = self.max_slice_nums if max_slice_nums is None else int(max_slice_nums)
|
| 297 |
+
assert max_slice_nums > 0
|
| 298 |
+
grid = self.get_sliced_grid(image_size=image_size, max_slice_nums=max_slice_nums)
|
| 299 |
+
|
| 300 |
+
image_placeholder = (
|
| 301 |
+
self.im_start_token
|
| 302 |
+
+ self.unk_token * self.image_feature_size
|
| 303 |
+
+ self.im_end_token
|
| 304 |
+
)
|
| 305 |
+
use_image_id = self.use_image_id if use_image_id is None else bool(use_image_id)
|
| 306 |
+
if use_image_id:
|
| 307 |
+
final_placeholder = self.get_image_id_placeholder(image_idx) + image_placeholder
|
| 308 |
+
else:
|
| 309 |
+
final_placeholder = image_placeholder
|
| 310 |
+
|
| 311 |
+
if self.slice_mode:
|
| 312 |
+
final_placeholder = final_placeholder + self.get_grid_placeholder(grid=grid)
|
| 313 |
+
return final_placeholder
|
| 314 |
+
|
| 315 |
+
def to_pil_image(self, image, rescale=None) -> PIL.Image.Image:
|
| 316 |
+
"""
|
| 317 |
+
Converts `image` to a PIL Image. Optionally rescales it and puts the channel dimension back as the last axis if
|
| 318 |
+
needed.
|
| 319 |
+
|
| 320 |
+
Args:
|
| 321 |
+
image (`PIL.Image.Image` or `numpy.ndarray` or `torch.Tensor`):
|
| 322 |
+
The image to convert to the PIL Image format.
|
| 323 |
+
rescale (`bool`, *optional*):
|
| 324 |
+
Whether or not to apply the scaling factor (to make pixel values integers between 0 and 255). Will
|
| 325 |
+
default to `True` if the image type is a floating type, `False` otherwise.
|
| 326 |
+
"""
|
| 327 |
+
if isinstance(image, PIL.Image.Image):
|
| 328 |
+
return image
|
| 329 |
+
if is_torch_tensor(image):
|
| 330 |
+
image = image.numpy()
|
| 331 |
+
|
| 332 |
+
if isinstance(image, np.ndarray):
|
| 333 |
+
if rescale is None:
|
| 334 |
+
# rescale default to the array being of floating type.
|
| 335 |
+
rescale = isinstance(image.flat[0], np.floating)
|
| 336 |
+
# If the channel as been moved to first dim, we put it back at the end.
|
| 337 |
+
if image.ndim == 3 and image.shape[0] in [1, 3]:
|
| 338 |
+
image = image.transpose(1, 2, 0)
|
| 339 |
+
if rescale:
|
| 340 |
+
image = image * 255
|
| 341 |
+
image = image.astype(np.uint8)
|
| 342 |
+
return PIL.Image.fromarray(image)
|
| 343 |
+
return image
|
| 344 |
+
|
| 345 |
+
def reshape_by_patch(self, image):
|
| 346 |
+
"""
|
| 347 |
+
:param image: shape [3, H, W]
|
| 348 |
+
:param patch_size:
|
| 349 |
+
:return: [3, patch_size, HW/patch_size]
|
| 350 |
+
"""
|
| 351 |
+
image = torch.from_numpy(image)
|
| 352 |
+
patch_size = self.patch_size
|
| 353 |
+
patches = torch.nn.functional.unfold(
|
| 354 |
+
image,
|
| 355 |
+
(patch_size, patch_size),
|
| 356 |
+
stride=(patch_size, patch_size)
|
| 357 |
+
)
|
| 358 |
+
|
| 359 |
+
patches = patches.reshape(image.size(0), patch_size, patch_size, -1)
|
| 360 |
+
patches = patches.permute(0, 1, 3, 2).reshape(image.size(0), patch_size, -1)
|
| 361 |
+
return patches.numpy()
|
| 362 |
+
|
| 363 |
+
def preprocess(
|
| 364 |
+
self,
|
| 365 |
+
images: Union[Image.Image, List[Image.Image], List[List[Image.Image]]],
|
| 366 |
+
do_pad: Optional[bool] = True, # TODO: add pad for MiniCPM-Llama3-V-2_5
|
| 367 |
+
max_slice_nums: int = None,
|
| 368 |
+
temporal_ids: Optional[Union[List[List[int]], List[List[List[int]]]]] = None,
|
| 369 |
+
return_tensors: Optional[Union[str, TensorType]] = None,
|
| 370 |
+
**kwargs
|
| 371 |
+
) -> MiniCPMVBatchFeature:
|
| 372 |
+
if isinstance(images, Image.Image):
|
| 373 |
+
images_list = [[images]]
|
| 374 |
+
elif isinstance(images[0], Image.Image):
|
| 375 |
+
images_list = [images]
|
| 376 |
+
else:
|
| 377 |
+
images_list = images
|
| 378 |
+
|
| 379 |
+
if temporal_ids is not None:
|
| 380 |
+
if list_depth(temporal_ids) == 2:
|
| 381 |
+
temporal_ids = [temporal_ids]
|
| 382 |
+
|
| 383 |
+
new_images_list = []
|
| 384 |
+
image_sizes_list = []
|
| 385 |
+
tgt_sizes_list = []
|
| 386 |
+
temporal_ids_list = []
|
| 387 |
+
skip_image_idx_list = []
|
| 388 |
+
|
| 389 |
+
for batch_idx, _images in enumerate(images_list):
|
| 390 |
+
if _images is None or len(_images) == 0:
|
| 391 |
+
new_images_list.append([])
|
| 392 |
+
image_sizes_list.append([])
|
| 393 |
+
tgt_sizes_list.append([])
|
| 394 |
+
temporal_ids_list.append([])
|
| 395 |
+
skip_image_idx_list.append([])
|
| 396 |
+
continue
|
| 397 |
+
if not valid_images(_images):
|
| 398 |
+
raise ValueError(
|
| 399 |
+
"Invalid image type. Must be of type PIL.Image.Image, numpy.ndarray, "
|
| 400 |
+
"torch.Tensor, tf.Tensor or jax.ndarray."
|
| 401 |
+
)
|
| 402 |
+
|
| 403 |
+
_images = [self.to_pil_image(image).convert("RGB") for image in _images]
|
| 404 |
+
input_data_format = infer_channel_dimension_format(np.array(_images[0]))
|
| 405 |
+
|
| 406 |
+
new_images = []
|
| 407 |
+
image_sizes = [image.size for image in _images]
|
| 408 |
+
tgt_sizes = []
|
| 409 |
+
tp_ids = []
|
| 410 |
+
skip_image_idx = []
|
| 411 |
+
|
| 412 |
+
# for image in _images:
|
| 413 |
+
# image_patches = self.get_sliced_images(image, max_slice_nums)
|
| 414 |
+
# image_patches = [to_numpy_array(image).astype(np.float32) / 255 for image in image_patches]
|
| 415 |
+
# image_patches = [
|
| 416 |
+
# self.normalize(image=image, mean=self.mean, std=self.std, input_data_format=input_data_format)
|
| 417 |
+
# for image in image_patches
|
| 418 |
+
# ]
|
| 419 |
+
# image_patches = [
|
| 420 |
+
# to_channel_dimension_format(image, ChannelDimension.FIRST, input_channel_dim=input_data_format)
|
| 421 |
+
# for image in image_patches
|
| 422 |
+
# ]
|
| 423 |
+
# for slice_image in image_patches:
|
| 424 |
+
# new_images.append(self.reshape_by_patch(slice_image))
|
| 425 |
+
# tgt_sizes.append(np.array((slice_image.shape[1] // self.patch_size, slice_image.shape[2] // self.patch_size)))
|
| 426 |
+
|
| 427 |
+
if temporal_ids is None:
|
| 428 |
+
# no temporal ids
|
| 429 |
+
for image in _images:
|
| 430 |
+
image_patches = self.get_sliced_images(image, max_slice_nums)
|
| 431 |
+
image_patches = [to_numpy_array(image).astype(np.float32) / 255 for image in image_patches]
|
| 432 |
+
image_patches = [
|
| 433 |
+
self.normalize(image=image, mean=self.mean, std=self.std, input_data_format=input_data_format)
|
| 434 |
+
for image in image_patches
|
| 435 |
+
]
|
| 436 |
+
image_patches = [
|
| 437 |
+
to_channel_dimension_format(image, ChannelDimension.FIRST, input_channel_dim=input_data_format)
|
| 438 |
+
for image in image_patches
|
| 439 |
+
]
|
| 440 |
+
for slice_image in image_patches:
|
| 441 |
+
new_images.append(self.reshape_by_patch(slice_image))
|
| 442 |
+
tgt_sizes.append(np.array((slice_image.shape[1] // self.patch_size, slice_image.shape[2] // self.patch_size)))
|
| 443 |
+
|
| 444 |
+
tp_ids.extend([[-1]] * len(image_patches))
|
| 445 |
+
else:
|
| 446 |
+
temporal_ids_flatten = list(chain.from_iterable(temporal_ids[batch_idx]))
|
| 447 |
+
assert len(temporal_ids_flatten) == len(_images)
|
| 448 |
+
frame_groups = []
|
| 449 |
+
s = 0
|
| 450 |
+
for group in temporal_ids[batch_idx]:
|
| 451 |
+
frame_groups.append(_images[s:s+len(group)])
|
| 452 |
+
s += len(group)
|
| 453 |
+
|
| 454 |
+
skip_start = 0
|
| 455 |
+
for frame_group, tp_id in zip(frame_groups, temporal_ids[batch_idx]):
|
| 456 |
+
image_patches_group = []
|
| 457 |
+
for frame in frame_group:
|
| 458 |
+
image_patches = self.get_sliced_images(frame, max_slice_nums)
|
| 459 |
+
image_patches = [to_numpy_array(image).astype(np.float32) / 255 for image in image_patches]
|
| 460 |
+
image_patches = [
|
| 461 |
+
self.normalize(image=image, mean=self.mean, std=self.std, input_data_format=input_data_format)
|
| 462 |
+
for image in image_patches
|
| 463 |
+
]
|
| 464 |
+
image_patches = [
|
| 465 |
+
to_channel_dimension_format(image, ChannelDimension.FIRST, input_channel_dim=input_data_format)
|
| 466 |
+
for image in image_patches
|
| 467 |
+
]
|
| 468 |
+
image_patches_group.append(image_patches)
|
| 469 |
+
|
| 470 |
+
group_cnt = len(image_patches_group[0])
|
| 471 |
+
for gidx in range(group_cnt):
|
| 472 |
+
group_images = [s[gidx] for s in image_patches_group]
|
| 473 |
+
tgt_sizes.extend([np.array((i.shape[1] // self.patch_size, i.shape[2] // self.patch_size)) for i in group_images])
|
| 474 |
+
|
| 475 |
+
group_images = [self.reshape_by_patch(i) for i in group_images]
|
| 476 |
+
new_images.extend(group_images)
|
| 477 |
+
tp_ids.append(tp_id)
|
| 478 |
+
skip_image_idx.extend(list(range(skip_start + 1, skip_start + len(frame_group))))
|
| 479 |
+
skip_start += len(frame_group)
|
| 480 |
+
|
| 481 |
+
if tgt_sizes:
|
| 482 |
+
tgt_sizes = np.vstack(tgt_sizes)
|
| 483 |
+
|
| 484 |
+
new_images_list.append(new_images)
|
| 485 |
+
image_sizes_list.append(image_sizes)
|
| 486 |
+
tgt_sizes_list.append(tgt_sizes)
|
| 487 |
+
temporal_ids_list.append(tp_ids)
|
| 488 |
+
skip_image_idx_list.append(skip_image_idx)
|
| 489 |
+
|
| 490 |
+
data = {
|
| 491 |
+
"pixel_values": new_images_list,
|
| 492 |
+
"image_sizes": image_sizes_list,
|
| 493 |
+
"tgt_sizes": tgt_sizes_list,
|
| 494 |
+
"temporal_ids": temporal_ids_list,
|
| 495 |
+
"skip_image_idx": skip_image_idx_list
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
|
| 499 |
+
return MiniCPMVBatchFeature(data=data, tensor_type=return_tensors)
|
| 500 |
+
|
| 501 |
+
AutoImageProcessor.register("MiniCPMVImageProcessor", MiniCPMVImageProcessor)
|
merges.txt
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
modeling_navit_siglip.py
ADDED
|
@@ -0,0 +1,937 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2024 Google AI and The HuggingFace Team. All rights reserved.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
""" PyTorch Siglip model. """
|
| 16 |
+
# Copied from HuggingFaceM4/siglip-so400m-14-980-flash-attn2-navit and add tgt_sizes
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
import os
|
| 20 |
+
import math
|
| 21 |
+
import warnings
|
| 22 |
+
from dataclasses import dataclass
|
| 23 |
+
from typing import Any, Optional, Tuple, Union
|
| 24 |
+
|
| 25 |
+
import numpy as np
|
| 26 |
+
import torch
|
| 27 |
+
import torch.nn.functional as F
|
| 28 |
+
import torch.utils.checkpoint
|
| 29 |
+
from torch import nn
|
| 30 |
+
from torch.nn.init import _calculate_fan_in_and_fan_out
|
| 31 |
+
|
| 32 |
+
from transformers.activations import ACT2FN
|
| 33 |
+
from transformers.modeling_attn_mask_utils import _prepare_4d_attention_mask
|
| 34 |
+
from transformers.modeling_outputs import BaseModelOutput, BaseModelOutputWithPooling
|
| 35 |
+
from transformers.modeling_utils import PreTrainedModel
|
| 36 |
+
from transformers.configuration_utils import PretrainedConfig
|
| 37 |
+
from transformers.utils import (
|
| 38 |
+
ModelOutput,
|
| 39 |
+
add_start_docstrings,
|
| 40 |
+
add_start_docstrings_to_model_forward,
|
| 41 |
+
is_flash_attn_2_available,
|
| 42 |
+
logging,
|
| 43 |
+
replace_return_docstrings,
|
| 44 |
+
)
|
| 45 |
+
from transformers.utils import logging
|
| 46 |
+
|
| 47 |
+
logger = logging.get_logger(__name__)
|
| 48 |
+
|
| 49 |
+
class SiglipVisionConfig(PretrainedConfig):
|
| 50 |
+
r"""
|
| 51 |
+
This is the configuration class to store the configuration of a [`SiglipVisionModel`]. It is used to instantiate a
|
| 52 |
+
Siglip vision encoder according to the specified arguments, defining the model architecture. Instantiating a
|
| 53 |
+
configuration with the defaults will yield a similar configuration to that of the vision encoder of the Siglip
|
| 54 |
+
[google/siglip-base-patch16-224](https://huggingface.co/google/siglip-base-patch16-224) architecture.
|
| 55 |
+
Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
|
| 56 |
+
documentation from [`PretrainedConfig`] for more information.
|
| 57 |
+
Args:
|
| 58 |
+
hidden_size (`int`, *optional*, defaults to 768):
|
| 59 |
+
Dimensionality of the encoder layers and the pooler layer.
|
| 60 |
+
intermediate_size (`int`, *optional*, defaults to 3072):
|
| 61 |
+
Dimensionality of the "intermediate" (i.e., feed-forward) layer in the Transformer encoder.
|
| 62 |
+
num_hidden_layers (`int`, *optional*, defaults to 12):
|
| 63 |
+
Number of hidden layers in the Transformer encoder.
|
| 64 |
+
num_attention_heads (`int`, *optional*, defaults to 12):
|
| 65 |
+
Number of attention heads for each attention layer in the Transformer encoder.
|
| 66 |
+
num_channels (`int`, *optional*, defaults to 3):
|
| 67 |
+
Number of channels in the input images.
|
| 68 |
+
image_size (`int`, *optional*, defaults to 224):
|
| 69 |
+
The size (resolution) of each image.
|
| 70 |
+
patch_size (`int`, *optional*, defaults to 16):
|
| 71 |
+
The size (resolution) of each patch.
|
| 72 |
+
hidden_act (`str` or `function`, *optional*, defaults to `"gelu_pytorch_tanh"`):
|
| 73 |
+
The non-linear activation function (function or string) in the encoder and pooler. If string, `"gelu"`,
|
| 74 |
+
`"relu"`, `"selu"` and `"gelu_new"` ``"quick_gelu"` are supported.
|
| 75 |
+
layer_norm_eps (`float`, *optional*, defaults to 1e-06):
|
| 76 |
+
The epsilon used by the layer normalization layers.
|
| 77 |
+
attention_dropout (`float`, *optional*, defaults to 0.0):
|
| 78 |
+
The dropout ratio for the attention probabilities.
|
| 79 |
+
Example:
|
| 80 |
+
```python
|
| 81 |
+
>>> from transformers import SiglipVisionConfig, SiglipVisionModel
|
| 82 |
+
>>> # Initializing a SiglipVisionConfig with google/siglip-base-patch16-224 style configuration
|
| 83 |
+
>>> configuration = SiglipVisionConfig()
|
| 84 |
+
>>> # Initializing a SiglipVisionModel (with random weights) from the google/siglip-base-patch16-224 style configuration
|
| 85 |
+
>>> model = SiglipVisionModel(configuration)
|
| 86 |
+
>>> # Accessing the model configuration
|
| 87 |
+
>>> configuration = model.config
|
| 88 |
+
```"""
|
| 89 |
+
|
| 90 |
+
model_type = "siglip_vision_model"
|
| 91 |
+
|
| 92 |
+
def __init__(
|
| 93 |
+
self,
|
| 94 |
+
hidden_size=768,
|
| 95 |
+
intermediate_size=3072,
|
| 96 |
+
num_hidden_layers=12,
|
| 97 |
+
num_attention_heads=12,
|
| 98 |
+
num_channels=3,
|
| 99 |
+
image_size=224,
|
| 100 |
+
patch_size=16,
|
| 101 |
+
hidden_act="gelu_pytorch_tanh",
|
| 102 |
+
layer_norm_eps=1e-6,
|
| 103 |
+
attention_dropout=0.0,
|
| 104 |
+
**kwargs,
|
| 105 |
+
):
|
| 106 |
+
super().__init__(**kwargs)
|
| 107 |
+
|
| 108 |
+
self.hidden_size = hidden_size
|
| 109 |
+
self.intermediate_size = intermediate_size
|
| 110 |
+
self.num_hidden_layers = num_hidden_layers
|
| 111 |
+
self.num_attention_heads = num_attention_heads
|
| 112 |
+
self.num_channels = num_channels
|
| 113 |
+
self.patch_size = patch_size
|
| 114 |
+
self.image_size = image_size
|
| 115 |
+
self.attention_dropout = attention_dropout
|
| 116 |
+
self.layer_norm_eps = layer_norm_eps
|
| 117 |
+
self.hidden_act = hidden_act
|
| 118 |
+
|
| 119 |
+
@classmethod
|
| 120 |
+
def from_pretrained(cls, pretrained_model_name_or_path: Union[str, os.PathLike], **kwargs) -> "PretrainedConfig":
|
| 121 |
+
cls._set_token_in_kwargs(kwargs)
|
| 122 |
+
|
| 123 |
+
config_dict, kwargs = cls.get_config_dict(pretrained_model_name_or_path, **kwargs)
|
| 124 |
+
|
| 125 |
+
# get the vision config dict if we are loading from SiglipConfig
|
| 126 |
+
if config_dict.get("model_type") == "siglip":
|
| 127 |
+
config_dict = config_dict["vision_config"]
|
| 128 |
+
|
| 129 |
+
if "model_type" in config_dict and hasattr(cls, "model_type") and config_dict["model_type"] != cls.model_type:
|
| 130 |
+
logger.warning(
|
| 131 |
+
f"You are using a model of type {config_dict['model_type']} to instantiate a model of type "
|
| 132 |
+
f"{cls.model_type}. This is not supported for all configurations of models and can yield errors."
|
| 133 |
+
)
|
| 134 |
+
|
| 135 |
+
return cls.from_dict(config_dict, **kwargs)
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
_CHECKPOINT_FOR_DOC = "google/siglip-base-patch16-224"
|
| 139 |
+
|
| 140 |
+
SIGLIP_PRETRAINED_MODEL_ARCHIVE_LIST = [
|
| 141 |
+
"google/siglip-base-patch16-224",
|
| 142 |
+
# See all SigLIP models at https://huggingface.co/models?filter=siglip
|
| 143 |
+
]
|
| 144 |
+
|
| 145 |
+
if is_flash_attn_2_available():
|
| 146 |
+
from flash_attn import flash_attn_func, flash_attn_varlen_func
|
| 147 |
+
from flash_attn.bert_padding import index_first_axis, pad_input, unpad_input # noqa
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
# Copied from transformers.models.llama.modeling_llama._get_unpad_data
|
| 151 |
+
def _get_unpad_data(attention_mask):
|
| 152 |
+
seqlens_in_batch = attention_mask.sum(dim=-1, dtype=torch.int32)
|
| 153 |
+
indices = torch.nonzero(attention_mask.flatten(), as_tuple=False).flatten()
|
| 154 |
+
max_seqlen_in_batch = seqlens_in_batch.max().item()
|
| 155 |
+
cu_seqlens = F.pad(torch.cumsum(seqlens_in_batch, dim=0, dtype=torch.torch.int32), (1, 0))
|
| 156 |
+
return (
|
| 157 |
+
indices,
|
| 158 |
+
cu_seqlens,
|
| 159 |
+
max_seqlen_in_batch,
|
| 160 |
+
)
|
| 161 |
+
|
| 162 |
+
|
| 163 |
+
def _trunc_normal_(tensor, mean, std, a, b):
|
| 164 |
+
# Cut & paste from PyTorch official master until it's in a few official releases - RW
|
| 165 |
+
# Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf
|
| 166 |
+
def norm_cdf(x):
|
| 167 |
+
# Computes standard normal cumulative distribution function
|
| 168 |
+
return (1.0 + math.erf(x / math.sqrt(2.0))) / 2.0
|
| 169 |
+
|
| 170 |
+
if (mean < a - 2 * std) or (mean > b + 2 * std):
|
| 171 |
+
warnings.warn(
|
| 172 |
+
"mean is more than 2 std from [a, b] in nn.init.trunc_normal_. "
|
| 173 |
+
"The distribution of values may be incorrect.",
|
| 174 |
+
stacklevel=2,
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
# Values are generated by using a truncated uniform distribution and
|
| 178 |
+
# then using the inverse CDF for the normal distribution.
|
| 179 |
+
# Get upper and lower cdf values
|
| 180 |
+
l = norm_cdf((a - mean) / std)
|
| 181 |
+
u = norm_cdf((b - mean) / std)
|
| 182 |
+
|
| 183 |
+
# Uniformly fill tensor with values from [l, u], then translate to
|
| 184 |
+
# [2l-1, 2u-1].
|
| 185 |
+
tensor.uniform_(2 * l - 1, 2 * u - 1)
|
| 186 |
+
|
| 187 |
+
# Use inverse cdf transform for normal distribution to get truncated
|
| 188 |
+
# standard normal
|
| 189 |
+
if tensor.dtype in [torch.float16, torch.bfloat16]:
|
| 190 |
+
# The `erfinv_` op is not (yet?) defined in float16+cpu, bfloat16+gpu
|
| 191 |
+
og_dtype = tensor.dtype
|
| 192 |
+
tensor = tensor.to(torch.float32)
|
| 193 |
+
tensor.erfinv_()
|
| 194 |
+
tensor = tensor.to(og_dtype)
|
| 195 |
+
else:
|
| 196 |
+
tensor.erfinv_()
|
| 197 |
+
|
| 198 |
+
# Transform to proper mean, std
|
| 199 |
+
tensor.mul_(std * math.sqrt(2.0))
|
| 200 |
+
tensor.add_(mean)
|
| 201 |
+
|
| 202 |
+
# Clamp to ensure it's in the proper range
|
| 203 |
+
if tensor.dtype == torch.float16:
|
| 204 |
+
# The `clamp_` op is not (yet?) defined in float16+cpu
|
| 205 |
+
tensor = tensor.to(torch.float32)
|
| 206 |
+
tensor.clamp_(min=a, max=b)
|
| 207 |
+
tensor = tensor.to(torch.float16)
|
| 208 |
+
else:
|
| 209 |
+
tensor.clamp_(min=a, max=b)
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
def trunc_normal_tf_(
|
| 213 |
+
tensor: torch.Tensor, mean: float = 0.0, std: float = 1.0, a: float = -2.0, b: float = 2.0
|
| 214 |
+
) -> torch.Tensor:
|
| 215 |
+
"""Fills the input Tensor with values drawn from a truncated
|
| 216 |
+
normal distribution. The values are effectively drawn from the
|
| 217 |
+
normal distribution :math:`\\mathcal{N}(\text{mean}, \text{std}^2)`
|
| 218 |
+
with values outside :math:`[a, b]` redrawn until they are within
|
| 219 |
+
the bounds. The method used for generating the random values works
|
| 220 |
+
best when :math:`a \\leq \text{mean} \\leq b`.
|
| 221 |
+
NOTE: this 'tf' variant behaves closer to Tensorflow / JAX impl where the
|
| 222 |
+
bounds [a, b] are applied when sampling the normal distribution with mean=0, std=1.0
|
| 223 |
+
and the result is subsquently scaled and shifted by the mean and std args.
|
| 224 |
+
Args:
|
| 225 |
+
tensor: an n-dimensional `torch.Tensor`
|
| 226 |
+
mean: the mean of the normal distribution
|
| 227 |
+
std: the standard deviation of the normal distribution
|
| 228 |
+
a: the minimum cutoff value
|
| 229 |
+
b: the maximum cutoff value
|
| 230 |
+
"""
|
| 231 |
+
with torch.no_grad():
|
| 232 |
+
_trunc_normal_(tensor, 0, 1.0, a, b)
|
| 233 |
+
tensor.mul_(std).add_(mean)
|
| 234 |
+
|
| 235 |
+
|
| 236 |
+
def variance_scaling_(tensor, scale=1.0, mode="fan_in", distribution="normal"):
|
| 237 |
+
fan_in, fan_out = _calculate_fan_in_and_fan_out(tensor)
|
| 238 |
+
if mode == "fan_in":
|
| 239 |
+
denom = fan_in
|
| 240 |
+
elif mode == "fan_out":
|
| 241 |
+
denom = fan_out
|
| 242 |
+
elif mode == "fan_avg":
|
| 243 |
+
denom = (fan_in + fan_out) / 2
|
| 244 |
+
|
| 245 |
+
variance = scale / denom
|
| 246 |
+
|
| 247 |
+
if distribution == "truncated_normal":
|
| 248 |
+
# constant is stddev of standard normal truncated to (-2, 2)
|
| 249 |
+
trunc_normal_tf_(tensor, std=math.sqrt(variance) / 0.87962566103423978)
|
| 250 |
+
elif distribution == "normal":
|
| 251 |
+
with torch.no_grad():
|
| 252 |
+
tensor.normal_(std=math.sqrt(variance))
|
| 253 |
+
elif distribution == "uniform":
|
| 254 |
+
bound = math.sqrt(3 * variance)
|
| 255 |
+
with torch.no_grad():
|
| 256 |
+
tensor.uniform_(-bound, bound)
|
| 257 |
+
else:
|
| 258 |
+
raise ValueError(f"invalid distribution {distribution}")
|
| 259 |
+
|
| 260 |
+
|
| 261 |
+
def lecun_normal_(tensor):
|
| 262 |
+
variance_scaling_(tensor, mode="fan_in", distribution="truncated_normal")
|
| 263 |
+
|
| 264 |
+
|
| 265 |
+
def default_flax_embed_init(tensor):
|
| 266 |
+
variance_scaling_(tensor, mode="fan_in", distribution="normal")
|
| 267 |
+
|
| 268 |
+
|
| 269 |
+
@dataclass
|
| 270 |
+
# Copied from transformers.models.clip.modeling_clip.CLIPVisionModelOutput with CLIP->Siglip
|
| 271 |
+
class SiglipVisionModelOutput(ModelOutput):
|
| 272 |
+
"""
|
| 273 |
+
Base class for vision model's outputs that also contains image embeddings of the pooling of the last hidden states.
|
| 274 |
+
Args:
|
| 275 |
+
image_embeds (`torch.FloatTensor` of shape `(batch_size, output_dim)` *optional* returned when model is initialized with `with_projection=True`):
|
| 276 |
+
The image embeddings obtained by applying the projection layer to the pooler_output.
|
| 277 |
+
last_hidden_state (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
|
| 278 |
+
Sequence of hidden-states at the output of the last layer of the model.
|
| 279 |
+
hidden_states (`tuple(torch.FloatTensor)`, *optional*, returned when `output_hidden_states=True` is passed or when `config.output_hidden_states=True`):
|
| 280 |
+
Tuple of `torch.FloatTensor` (one for the output of the embeddings, if the model has an embedding layer, +
|
| 281 |
+
one for the output of each layer) of shape `(batch_size, sequence_length, hidden_size)`.
|
| 282 |
+
Hidden-states of the model at the output of each layer plus the optional initial embedding outputs.
|
| 283 |
+
attentions (`tuple(torch.FloatTensor)`, *optional*, returned when `output_attentions=True` is passed or when `config.output_attentions=True`):
|
| 284 |
+
Tuple of `torch.FloatTensor` (one for each layer) of shape `(batch_size, num_heads, sequence_length,
|
| 285 |
+
sequence_length)`.
|
| 286 |
+
Attentions weights after the attention softmax, used to compute the weighted average in the self-attention
|
| 287 |
+
heads.
|
| 288 |
+
"""
|
| 289 |
+
|
| 290 |
+
image_embeds: Optional[torch.FloatTensor] = None
|
| 291 |
+
last_hidden_state: torch.FloatTensor = None
|
| 292 |
+
hidden_states: Optional[Tuple[torch.FloatTensor]] = None
|
| 293 |
+
attentions: Optional[Tuple[torch.FloatTensor]] = None
|
| 294 |
+
|
| 295 |
+
|
| 296 |
+
class SiglipVisionEmbeddings(nn.Module):
|
| 297 |
+
def __init__(self, config: SiglipVisionConfig):
|
| 298 |
+
super().__init__()
|
| 299 |
+
self.config = config
|
| 300 |
+
self.embed_dim = config.hidden_size
|
| 301 |
+
self.image_size = config.image_size
|
| 302 |
+
self.patch_size = config.patch_size
|
| 303 |
+
|
| 304 |
+
self.patch_embedding = nn.Conv2d(
|
| 305 |
+
in_channels=config.num_channels,
|
| 306 |
+
out_channels=self.embed_dim,
|
| 307 |
+
kernel_size=self.patch_size,
|
| 308 |
+
stride=self.patch_size,
|
| 309 |
+
padding="valid",
|
| 310 |
+
)
|
| 311 |
+
|
| 312 |
+
self.num_patches_per_side = self.image_size // self.patch_size
|
| 313 |
+
self.num_patches = self.num_patches_per_side**2
|
| 314 |
+
self.num_positions = self.num_patches
|
| 315 |
+
self.position_embedding = nn.Embedding(self.num_positions, self.embed_dim)
|
| 316 |
+
|
| 317 |
+
def forward(self, pixel_values: torch.FloatTensor, patch_attention_mask: torch.BoolTensor, tgt_sizes: Optional[torch.IntTensor]=None) -> torch.Tensor:
|
| 318 |
+
batch_size = pixel_values.size(0)
|
| 319 |
+
|
| 320 |
+
patch_embeds = self.patch_embedding(pixel_values)
|
| 321 |
+
embeddings = patch_embeds.flatten(2).transpose(1, 2)
|
| 322 |
+
|
| 323 |
+
max_im_h, max_im_w = pixel_values.size(2), pixel_values.size(3)
|
| 324 |
+
max_nb_patches_h, max_nb_patches_w = max_im_h // self.patch_size, max_im_w // self.patch_size
|
| 325 |
+
boundaries = torch.arange(1 / self.num_patches_per_side, 1.0, 1 / self.num_patches_per_side)
|
| 326 |
+
position_ids = torch.full(
|
| 327 |
+
size=(
|
| 328 |
+
batch_size,
|
| 329 |
+
max_nb_patches_h * max_nb_patches_w,
|
| 330 |
+
),
|
| 331 |
+
fill_value=0,
|
| 332 |
+
)
|
| 333 |
+
|
| 334 |
+
for batch_idx, p_attn_mask in enumerate(patch_attention_mask):
|
| 335 |
+
if tgt_sizes is not None:
|
| 336 |
+
nb_patches_h = tgt_sizes[batch_idx][0]
|
| 337 |
+
nb_patches_w = tgt_sizes[batch_idx][1]
|
| 338 |
+
else:
|
| 339 |
+
nb_patches_h = p_attn_mask[:, 0].sum()
|
| 340 |
+
nb_patches_w = p_attn_mask[0].sum()
|
| 341 |
+
|
| 342 |
+
fractional_coords_h = torch.arange(0, 1 - 1e-6, 1 / nb_patches_h)
|
| 343 |
+
fractional_coords_w = torch.arange(0, 1 - 1e-6, 1 / nb_patches_w)
|
| 344 |
+
|
| 345 |
+
bucket_coords_h = torch.bucketize(fractional_coords_h, boundaries, right=True)
|
| 346 |
+
bucket_coords_w = torch.bucketize(fractional_coords_w, boundaries, right=True)
|
| 347 |
+
|
| 348 |
+
pos_ids = (bucket_coords_h[:, None] * self.num_patches_per_side + bucket_coords_w).flatten()
|
| 349 |
+
position_ids[batch_idx][p_attn_mask.view(-1).cpu()] = pos_ids
|
| 350 |
+
|
| 351 |
+
position_ids = position_ids.to(self.position_embedding.weight.device)
|
| 352 |
+
|
| 353 |
+
embeddings = embeddings + self.position_embedding(position_ids)
|
| 354 |
+
return embeddings
|
| 355 |
+
|
| 356 |
+
|
| 357 |
+
class SiglipAttention(nn.Module):
|
| 358 |
+
"""Multi-headed attention from 'Attention Is All You Need' paper"""
|
| 359 |
+
|
| 360 |
+
# Copied from transformers.models.clip.modeling_clip.CLIPAttention.__init__
|
| 361 |
+
def __init__(self, config):
|
| 362 |
+
super().__init__()
|
| 363 |
+
self.config = config
|
| 364 |
+
self.embed_dim = config.hidden_size
|
| 365 |
+
self.num_heads = config.num_attention_heads
|
| 366 |
+
self.head_dim = self.embed_dim // self.num_heads
|
| 367 |
+
if self.head_dim * self.num_heads != self.embed_dim:
|
| 368 |
+
raise ValueError(
|
| 369 |
+
f"embed_dim must be divisible by num_heads (got `embed_dim`: {self.embed_dim} and `num_heads`:"
|
| 370 |
+
f" {self.num_heads})."
|
| 371 |
+
)
|
| 372 |
+
self.scale = self.head_dim**-0.5
|
| 373 |
+
self.dropout = config.attention_dropout
|
| 374 |
+
|
| 375 |
+
self.k_proj = nn.Linear(self.embed_dim, self.embed_dim)
|
| 376 |
+
self.v_proj = nn.Linear(self.embed_dim, self.embed_dim)
|
| 377 |
+
self.q_proj = nn.Linear(self.embed_dim, self.embed_dim)
|
| 378 |
+
self.out_proj = nn.Linear(self.embed_dim, self.embed_dim)
|
| 379 |
+
|
| 380 |
+
def forward(
|
| 381 |
+
self,
|
| 382 |
+
hidden_states: torch.Tensor,
|
| 383 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 384 |
+
output_attentions: Optional[bool] = False,
|
| 385 |
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
| 386 |
+
"""Input shape: Batch x Time x Channel"""
|
| 387 |
+
|
| 388 |
+
batch_size, q_len, _ = hidden_states.size()
|
| 389 |
+
|
| 390 |
+
query_states = self.q_proj(hidden_states)
|
| 391 |
+
key_states = self.k_proj(hidden_states)
|
| 392 |
+
value_states = self.v_proj(hidden_states)
|
| 393 |
+
|
| 394 |
+
query_states = query_states.view(batch_size, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
| 395 |
+
key_states = key_states.view(batch_size, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
| 396 |
+
value_states = value_states.view(batch_size, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
| 397 |
+
|
| 398 |
+
k_v_seq_len = key_states.shape[-2]
|
| 399 |
+
attn_weights = torch.matmul(query_states, key_states.transpose(2, 3)) * self.scale
|
| 400 |
+
|
| 401 |
+
if attn_weights.size() != (batch_size, self.num_heads, q_len, k_v_seq_len):
|
| 402 |
+
raise ValueError(
|
| 403 |
+
f"Attention weights should be of size {(batch_size, self.num_heads, q_len, k_v_seq_len)}, but is"
|
| 404 |
+
f" {attn_weights.size()}"
|
| 405 |
+
)
|
| 406 |
+
|
| 407 |
+
if attention_mask is not None:
|
| 408 |
+
if attention_mask.size() != (batch_size, 1, q_len, k_v_seq_len):
|
| 409 |
+
raise ValueError(
|
| 410 |
+
f"Attention mask should be of size {(batch_size, 1, q_len, k_v_seq_len)}, but is {attention_mask.size()}"
|
| 411 |
+
)
|
| 412 |
+
attn_weights = attn_weights + attention_mask
|
| 413 |
+
|
| 414 |
+
# upcast attention to fp32
|
| 415 |
+
attn_weights = nn.functional.softmax(attn_weights, dim=-1, dtype=torch.float32).to(query_states.dtype)
|
| 416 |
+
attn_weights = nn.functional.dropout(attn_weights, p=self.dropout, training=self.training)
|
| 417 |
+
attn_output = torch.matmul(attn_weights, value_states)
|
| 418 |
+
|
| 419 |
+
if attn_output.size() != (batch_size, self.num_heads, q_len, self.head_dim):
|
| 420 |
+
raise ValueError(
|
| 421 |
+
f"`attn_output` should be of size {(batch_size, self.num_heads, q_len, self.head_dim)}, but is"
|
| 422 |
+
f" {attn_output.size()}"
|
| 423 |
+
)
|
| 424 |
+
|
| 425 |
+
attn_output = attn_output.transpose(1, 2).contiguous()
|
| 426 |
+
attn_output = attn_output.reshape(batch_size, q_len, self.embed_dim)
|
| 427 |
+
|
| 428 |
+
attn_output = self.out_proj(attn_output)
|
| 429 |
+
|
| 430 |
+
return attn_output, attn_weights
|
| 431 |
+
|
| 432 |
+
|
| 433 |
+
class SiglipFlashAttention2(SiglipAttention):
|
| 434 |
+
"""
|
| 435 |
+
Llama flash attention module. This module inherits from `LlamaAttention` as the weights of the module stays
|
| 436 |
+
untouched. The only required change would be on the forward pass where it needs to correctly call the public API of
|
| 437 |
+
flash attention and deal with padding tokens in case the input contains any of them.
|
| 438 |
+
"""
|
| 439 |
+
|
| 440 |
+
def __init__(self, *args, **kwargs):
|
| 441 |
+
super().__init__(*args, **kwargs)
|
| 442 |
+
self.is_causal = False # Hack to make sure we don't use a causal mask
|
| 443 |
+
|
| 444 |
+
def forward(
|
| 445 |
+
self,
|
| 446 |
+
hidden_states: torch.Tensor,
|
| 447 |
+
attention_mask: Optional[torch.LongTensor] = None,
|
| 448 |
+
position_ids: Optional[torch.LongTensor] = None,
|
| 449 |
+
past_key_value: Optional[Tuple[torch.Tensor]] = None,
|
| 450 |
+
output_attentions: bool = False,
|
| 451 |
+
use_cache: bool = False,
|
| 452 |
+
**kwargs,
|
| 453 |
+
) -> Tuple[torch.Tensor, Optional[torch.Tensor], Optional[Tuple[torch.Tensor]]]:
|
| 454 |
+
output_attentions = False
|
| 455 |
+
|
| 456 |
+
bsz, q_len, _ = hidden_states.size()
|
| 457 |
+
|
| 458 |
+
query_states = self.q_proj(hidden_states)
|
| 459 |
+
key_states = self.k_proj(hidden_states)
|
| 460 |
+
value_states = self.v_proj(hidden_states)
|
| 461 |
+
|
| 462 |
+
# Flash attention requires the input to have the shape
|
| 463 |
+
# batch_size x seq_length x head_dim x hidden_dim
|
| 464 |
+
# therefore we just need to keep the original shape
|
| 465 |
+
query_states = query_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
| 466 |
+
key_states = key_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
| 467 |
+
value_states = value_states.view(bsz, q_len, self.num_heads, self.head_dim).transpose(1, 2)
|
| 468 |
+
|
| 469 |
+
kv_seq_len = key_states.shape[-2]
|
| 470 |
+
if past_key_value is not None:
|
| 471 |
+
kv_seq_len += past_key_value.get_usable_length(kv_seq_len, self.layer_idx)
|
| 472 |
+
# cos, sin = self.rotary_emb(value_states, seq_len=kv_seq_len)
|
| 473 |
+
# query_states, key_states = apply_rotary_pos_emb(query_states, key_states, cos, sin, position_ids)
|
| 474 |
+
|
| 475 |
+
# if past_key_value is not None:
|
| 476 |
+
# cache_kwargs = {"sin": sin, "cos": cos} # Specific to RoPE models
|
| 477 |
+
# key_states, value_states = past_key_value.update(key_states, value_states, self.layer_idx, cache_kwargs)
|
| 478 |
+
|
| 479 |
+
# TODO: These transpose are quite inefficient but Flash Attention requires the layout [batch_size, sequence_length, num_heads, head_dim]. We would need to refactor the KV cache
|
| 480 |
+
# to be able to avoid many of these transpose/reshape/view.
|
| 481 |
+
query_states = query_states.transpose(1, 2)
|
| 482 |
+
key_states = key_states.transpose(1, 2)
|
| 483 |
+
value_states = value_states.transpose(1, 2)
|
| 484 |
+
|
| 485 |
+
dropout_rate = self.dropout if self.training else 0.0
|
| 486 |
+
|
| 487 |
+
# In PEFT, usually we cast the layer norms in float32 for training stability reasons
|
| 488 |
+
# therefore the input hidden states gets silently casted in float32. Hence, we need
|
| 489 |
+
# cast them back in the correct dtype just to be sure everything works as expected.
|
| 490 |
+
# This might slowdown training & inference so it is recommended to not cast the LayerNorms
|
| 491 |
+
# in fp32. (LlamaRMSNorm handles it correctly)
|
| 492 |
+
|
| 493 |
+
input_dtype = query_states.dtype
|
| 494 |
+
if input_dtype == torch.float32:
|
| 495 |
+
if torch.is_autocast_enabled():
|
| 496 |
+
target_dtype = torch.get_autocast_gpu_dtype()
|
| 497 |
+
# Handle the case where the model is quantized
|
| 498 |
+
elif hasattr(self.config, "_pre_quantization_dtype"):
|
| 499 |
+
target_dtype = self.config._pre_quantization_dtype
|
| 500 |
+
else:
|
| 501 |
+
target_dtype = self.q_proj.weight.dtype
|
| 502 |
+
|
| 503 |
+
logger.warning_once(
|
| 504 |
+
"The input hidden states seems to be silently casted in float32, this might be related to the fact"
|
| 505 |
+
" you have upcasted embedding or layer norm layers in float32. We will cast back the input in"
|
| 506 |
+
f" {target_dtype}."
|
| 507 |
+
)
|
| 508 |
+
|
| 509 |
+
query_states = query_states.to(target_dtype)
|
| 510 |
+
key_states = key_states.to(target_dtype)
|
| 511 |
+
value_states = value_states.to(target_dtype)
|
| 512 |
+
|
| 513 |
+
attn_output = self._flash_attention_forward(
|
| 514 |
+
query_states, key_states, value_states, attention_mask, q_len, dropout=dropout_rate
|
| 515 |
+
)
|
| 516 |
+
|
| 517 |
+
attn_output = attn_output.reshape(bsz, q_len, self.embed_dim).contiguous()
|
| 518 |
+
attn_output = self.out_proj(attn_output)
|
| 519 |
+
|
| 520 |
+
if not output_attentions:
|
| 521 |
+
attn_weights = None
|
| 522 |
+
|
| 523 |
+
return attn_output, attn_weights
|
| 524 |
+
|
| 525 |
+
def _flash_attention_forward(
|
| 526 |
+
self, query_states, key_states, value_states, attention_mask, query_length, dropout=0.0, softmax_scale=None
|
| 527 |
+
):
|
| 528 |
+
"""
|
| 529 |
+
Calls the forward method of Flash Attention - if the input hidden states contain at least one padding token
|
| 530 |
+
first unpad the input, then computes the attention scores and pad the final attention scores.
|
| 531 |
+
Args:
|
| 532 |
+
query_states (`torch.Tensor`):
|
| 533 |
+
Input query states to be passed to Flash Attention API
|
| 534 |
+
key_states (`torch.Tensor`):
|
| 535 |
+
Input key states to be passed to Flash Attention API
|
| 536 |
+
value_states (`torch.Tensor`):
|
| 537 |
+
Input value states to be passed to Flash Attention API
|
| 538 |
+
attention_mask (`torch.Tensor`):
|
| 539 |
+
The padding mask - corresponds to a tensor of size `(batch_size, seq_len)` where 0 stands for the
|
| 540 |
+
position of padding tokens and 1 for the position of non-padding tokens.
|
| 541 |
+
dropout (`int`, *optional*):
|
| 542 |
+
Attention dropout
|
| 543 |
+
softmax_scale (`float`, *optional*):
|
| 544 |
+
The scaling of QK^T before applying softmax. Default to 1 / sqrt(head_dim)
|
| 545 |
+
"""
|
| 546 |
+
|
| 547 |
+
# TODO: Remove the `query_length != 1` check once Flash Attention for RoCm is bumped to 2.1. For details, please see the comment in LlamaFlashAttention2 __init__.
|
| 548 |
+
causal = self.is_causal and query_length != 1
|
| 549 |
+
|
| 550 |
+
# Contains at least one padding token in the sequence
|
| 551 |
+
if attention_mask is not None:
|
| 552 |
+
batch_size = query_states.shape[0]
|
| 553 |
+
query_states, key_states, value_states, indices_q, cu_seq_lens, max_seq_lens = self._upad_input(
|
| 554 |
+
query_states, key_states, value_states, attention_mask, query_length
|
| 555 |
+
)
|
| 556 |
+
|
| 557 |
+
cu_seqlens_q, cu_seqlens_k = cu_seq_lens
|
| 558 |
+
max_seqlen_in_batch_q, max_seqlen_in_batch_k = max_seq_lens
|
| 559 |
+
|
| 560 |
+
attn_output_unpad = flash_attn_varlen_func(
|
| 561 |
+
query_states,
|
| 562 |
+
key_states,
|
| 563 |
+
value_states,
|
| 564 |
+
cu_seqlens_q=cu_seqlens_q,
|
| 565 |
+
cu_seqlens_k=cu_seqlens_k,
|
| 566 |
+
max_seqlen_q=max_seqlen_in_batch_q,
|
| 567 |
+
max_seqlen_k=max_seqlen_in_batch_k,
|
| 568 |
+
dropout_p=dropout,
|
| 569 |
+
softmax_scale=softmax_scale,
|
| 570 |
+
causal=causal,
|
| 571 |
+
)
|
| 572 |
+
|
| 573 |
+
attn_output = pad_input(attn_output_unpad, indices_q, batch_size, query_length)
|
| 574 |
+
else:
|
| 575 |
+
attn_output = flash_attn_func(
|
| 576 |
+
query_states, key_states, value_states, dropout, softmax_scale=softmax_scale, causal=causal
|
| 577 |
+
)
|
| 578 |
+
|
| 579 |
+
return attn_output
|
| 580 |
+
|
| 581 |
+
def _upad_input(self, query_layer, key_layer, value_layer, attention_mask, query_length):
|
| 582 |
+
indices_k, cu_seqlens_k, max_seqlen_in_batch_k = _get_unpad_data(attention_mask)
|
| 583 |
+
batch_size, kv_seq_len, num_key_value_heads, head_dim = key_layer.shape
|
| 584 |
+
|
| 585 |
+
key_layer = index_first_axis(
|
| 586 |
+
key_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
|
| 587 |
+
)
|
| 588 |
+
value_layer = index_first_axis(
|
| 589 |
+
value_layer.reshape(batch_size * kv_seq_len, num_key_value_heads, head_dim), indices_k
|
| 590 |
+
)
|
| 591 |
+
if query_length == kv_seq_len:
|
| 592 |
+
query_layer = index_first_axis(
|
| 593 |
+
query_layer.reshape(batch_size * kv_seq_len, self.num_heads, head_dim), indices_k
|
| 594 |
+
)
|
| 595 |
+
cu_seqlens_q = cu_seqlens_k
|
| 596 |
+
max_seqlen_in_batch_q = max_seqlen_in_batch_k
|
| 597 |
+
indices_q = indices_k
|
| 598 |
+
elif query_length == 1:
|
| 599 |
+
max_seqlen_in_batch_q = 1
|
| 600 |
+
cu_seqlens_q = torch.arange(
|
| 601 |
+
batch_size + 1, dtype=torch.int32, device=query_layer.device
|
| 602 |
+
) # There is a memcpy here, that is very bad.
|
| 603 |
+
indices_q = cu_seqlens_q[:-1]
|
| 604 |
+
query_layer = query_layer.squeeze(1)
|
| 605 |
+
else:
|
| 606 |
+
# The -q_len: slice assumes left padding.
|
| 607 |
+
attention_mask = attention_mask[:, -query_length:]
|
| 608 |
+
query_layer, indices_q, cu_seqlens_q, max_seqlen_in_batch_q = unpad_input(query_layer, attention_mask)
|
| 609 |
+
|
| 610 |
+
return (
|
| 611 |
+
query_layer,
|
| 612 |
+
key_layer,
|
| 613 |
+
value_layer,
|
| 614 |
+
indices_q,
|
| 615 |
+
(cu_seqlens_q, cu_seqlens_k),
|
| 616 |
+
(max_seqlen_in_batch_q, max_seqlen_in_batch_k),
|
| 617 |
+
)
|
| 618 |
+
|
| 619 |
+
|
| 620 |
+
# Copied from transformers.models.clip.modeling_clip.CLIPMLP with CLIP->Siglip
|
| 621 |
+
class SiglipMLP(nn.Module):
|
| 622 |
+
def __init__(self, config):
|
| 623 |
+
super().__init__()
|
| 624 |
+
self.config = config
|
| 625 |
+
self.activation_fn = ACT2FN[config.hidden_act]
|
| 626 |
+
self.fc1 = nn.Linear(config.hidden_size, config.intermediate_size)
|
| 627 |
+
self.fc2 = nn.Linear(config.intermediate_size, config.hidden_size)
|
| 628 |
+
|
| 629 |
+
def forward(self, hidden_states: torch.Tensor) -> torch.Tensor:
|
| 630 |
+
hidden_states = self.fc1(hidden_states)
|
| 631 |
+
hidden_states = self.activation_fn(hidden_states)
|
| 632 |
+
hidden_states = self.fc2(hidden_states)
|
| 633 |
+
return hidden_states
|
| 634 |
+
|
| 635 |
+
|
| 636 |
+
# Copied from transformers.models.clip.modeling_clip.CLIPEncoderLayer with CLIP->Siglip
|
| 637 |
+
class SiglipEncoderLayer(nn.Module):
|
| 638 |
+
def __init__(self, config: SiglipVisionConfig):
|
| 639 |
+
super().__init__()
|
| 640 |
+
self.embed_dim = config.hidden_size
|
| 641 |
+
self._use_flash_attention_2 = config._attn_implementation == "flash_attention_2"
|
| 642 |
+
self.self_attn = (
|
| 643 |
+
SiglipAttention(config)
|
| 644 |
+
if not self._use_flash_attention_2
|
| 645 |
+
else SiglipFlashAttention2(config)
|
| 646 |
+
)
|
| 647 |
+
self.layer_norm1 = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_eps)
|
| 648 |
+
self.mlp = SiglipMLP(config)
|
| 649 |
+
self.layer_norm2 = nn.LayerNorm(self.embed_dim, eps=config.layer_norm_eps)
|
| 650 |
+
|
| 651 |
+
def forward(
|
| 652 |
+
self,
|
| 653 |
+
hidden_states: torch.Tensor,
|
| 654 |
+
attention_mask: torch.Tensor,
|
| 655 |
+
output_attentions: Optional[bool] = False,
|
| 656 |
+
) -> Tuple[torch.FloatTensor]:
|
| 657 |
+
"""
|
| 658 |
+
Args:
|
| 659 |
+
hidden_states (`torch.FloatTensor`):
|
| 660 |
+
Input to the layer of shape `(batch, seq_len, embed_dim)`.
|
| 661 |
+
attention_mask (`torch.FloatTensor`):
|
| 662 |
+
Attention mask of shape `(batch, 1, q_len, k_v_seq_len)` where padding elements are indicated by very large negative values.
|
| 663 |
+
output_attentions (`bool`, *optional*, defaults to `False`):
|
| 664 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
| 665 |
+
returned tensors for more detail.
|
| 666 |
+
"""
|
| 667 |
+
residual = hidden_states
|
| 668 |
+
|
| 669 |
+
hidden_states = self.layer_norm1(hidden_states)
|
| 670 |
+
hidden_states, attn_weights = self.self_attn(
|
| 671 |
+
hidden_states=hidden_states,
|
| 672 |
+
attention_mask=attention_mask,
|
| 673 |
+
output_attentions=output_attentions,
|
| 674 |
+
)
|
| 675 |
+
hidden_states = residual + hidden_states
|
| 676 |
+
|
| 677 |
+
residual = hidden_states
|
| 678 |
+
hidden_states = self.layer_norm2(hidden_states)
|
| 679 |
+
hidden_states = self.mlp(hidden_states)
|
| 680 |
+
hidden_states = residual + hidden_states
|
| 681 |
+
|
| 682 |
+
outputs = (hidden_states,)
|
| 683 |
+
|
| 684 |
+
if output_attentions:
|
| 685 |
+
outputs += (attn_weights,)
|
| 686 |
+
|
| 687 |
+
return outputs
|
| 688 |
+
|
| 689 |
+
|
| 690 |
+
class SiglipPreTrainedModel(PreTrainedModel):
|
| 691 |
+
"""
|
| 692 |
+
An abstract class to handle weights initialization and a simple interface for downloading and loading pretrained
|
| 693 |
+
models.
|
| 694 |
+
"""
|
| 695 |
+
|
| 696 |
+
config_class = SiglipVisionConfig
|
| 697 |
+
base_model_prefix = "siglip"
|
| 698 |
+
supports_gradient_checkpointing = True
|
| 699 |
+
|
| 700 |
+
def _init_weights(self, module):
|
| 701 |
+
"""Initialize the weights"""
|
| 702 |
+
|
| 703 |
+
if isinstance(module, SiglipVisionEmbeddings):
|
| 704 |
+
width = self.config.hidden_size
|
| 705 |
+
nn.init.normal_(module.position_embedding.weight, std=1 / np.sqrt(width))
|
| 706 |
+
elif isinstance(module, nn.Embedding):
|
| 707 |
+
default_flax_embed_init(module.weight)
|
| 708 |
+
elif isinstance(module, SiglipAttention):
|
| 709 |
+
nn.init.normal_(module.q_proj.weight)
|
| 710 |
+
nn.init.normal_(module.k_proj.weight)
|
| 711 |
+
nn.init.normal_(module.v_proj.weight)
|
| 712 |
+
nn.init.normal_(module.out_proj.weight)
|
| 713 |
+
nn.init.zeros_(module.q_proj.bias)
|
| 714 |
+
nn.init.zeros_(module.k_proj.bias)
|
| 715 |
+
nn.init.zeros_(module.v_proj.bias)
|
| 716 |
+
nn.init.zeros_(module.out_proj.bias)
|
| 717 |
+
elif isinstance(module, SiglipMLP):
|
| 718 |
+
nn.init.normal_(module.fc1.weight)
|
| 719 |
+
nn.init.normal_(module.fc2.weight)
|
| 720 |
+
nn.init.normal_(module.fc1.bias, std=1e-6)
|
| 721 |
+
nn.init.normal_(module.fc2.bias, std=1e-6)
|
| 722 |
+
elif isinstance(module, (nn.Linear, nn.Conv2d)):
|
| 723 |
+
lecun_normal_(module.weight)
|
| 724 |
+
if module.bias is not None:
|
| 725 |
+
nn.init.zeros_(module.bias)
|
| 726 |
+
elif isinstance(module, nn.LayerNorm):
|
| 727 |
+
module.bias.data.zero_()
|
| 728 |
+
module.weight.data.fill_(1.0)
|
| 729 |
+
|
| 730 |
+
|
| 731 |
+
SIGLIP_START_DOCSTRING = r"""
|
| 732 |
+
This model inherits from [`PreTrainedModel`]. Check the superclass documentation for the generic methods the
|
| 733 |
+
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
|
| 734 |
+
etc.)
|
| 735 |
+
This model is also a PyTorch [torch.nn.Module](https://pytorch.org/docs/stable/nn.html#torch.nn.Module) subclass.
|
| 736 |
+
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
|
| 737 |
+
and behavior.
|
| 738 |
+
Parameters:
|
| 739 |
+
config ([`SiglipVisionConfig`]): Model configuration class with all the parameters of the model.
|
| 740 |
+
Initializing with a config file does not load the weights associated with the model, only the
|
| 741 |
+
configuration. Check out the [`~PreTrainedModel.from_pretrained`] method to load the model weights.
|
| 742 |
+
"""
|
| 743 |
+
|
| 744 |
+
|
| 745 |
+
SIGLIP_VISION_INPUTS_DOCSTRING = r"""
|
| 746 |
+
Args:
|
| 747 |
+
pixel_values (`torch.FloatTensor` of shape `(batch_size, num_channels, height, width)`):
|
| 748 |
+
Pixel values. Padding will be ignored by default should you provide it. Pixel values can be obtained using
|
| 749 |
+
[`AutoImageProcessor`]. See [`CLIPImageProcessor.__call__`] for details.
|
| 750 |
+
output_attentions (`bool`, *optional*):
|
| 751 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under returned
|
| 752 |
+
tensors for more detail.
|
| 753 |
+
output_hidden_states (`bool`, *optional*):
|
| 754 |
+
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors for
|
| 755 |
+
more detail.
|
| 756 |
+
return_dict (`bool`, *optional*):
|
| 757 |
+
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
| 758 |
+
"""
|
| 759 |
+
|
| 760 |
+
|
| 761 |
+
# Copied from transformers.models.clip.modeling_clip.CLIPEncoder with CLIP->Siglip
|
| 762 |
+
class SiglipEncoder(nn.Module):
|
| 763 |
+
"""
|
| 764 |
+
Transformer encoder consisting of `config.num_hidden_layers` self attention layers. Each layer is a
|
| 765 |
+
[`SiglipEncoderLayer`].
|
| 766 |
+
Args:
|
| 767 |
+
config: SiglipConfig
|
| 768 |
+
"""
|
| 769 |
+
|
| 770 |
+
def __init__(self, config: SiglipVisionConfig):
|
| 771 |
+
super().__init__()
|
| 772 |
+
self.config = config
|
| 773 |
+
self.layers = nn.ModuleList([SiglipEncoderLayer(config) for _ in range(config.num_hidden_layers)])
|
| 774 |
+
self.gradient_checkpointing = False
|
| 775 |
+
|
| 776 |
+
# Ignore copy
|
| 777 |
+
def forward(
|
| 778 |
+
self,
|
| 779 |
+
inputs_embeds,
|
| 780 |
+
attention_mask: Optional[torch.Tensor] = None,
|
| 781 |
+
output_attentions: Optional[bool] = None,
|
| 782 |
+
output_hidden_states: Optional[bool] = None,
|
| 783 |
+
return_dict: Optional[bool] = None,
|
| 784 |
+
) -> Union[Tuple, BaseModelOutput]:
|
| 785 |
+
r"""
|
| 786 |
+
Args:
|
| 787 |
+
inputs_embeds (`torch.FloatTensor` of shape `(batch_size, sequence_length, hidden_size)`):
|
| 788 |
+
Optionally, instead of passing `input_ids` you can choose to directly pass an embedded representation.
|
| 789 |
+
This is useful if you want more control over how to convert `input_ids` indices into associated vectors
|
| 790 |
+
than the model's internal embedding lookup matrix.
|
| 791 |
+
attention_mask (`torch.Tensor` of shape `(batch_size, sequence_length)`, *optional*):
|
| 792 |
+
Mask to avoid performing attention on padding token indices. Mask values selected in `[0, 1]`:
|
| 793 |
+
- 1 for tokens that are **not masked**,
|
| 794 |
+
- 0 for tokens that are **masked**.
|
| 795 |
+
[What are attention masks?](../glossary#attention-mask)
|
| 796 |
+
output_attentions (`bool`, *optional*):
|
| 797 |
+
Whether or not to return the attentions tensors of all attention layers. See `attentions` under
|
| 798 |
+
returned tensors for more detail.
|
| 799 |
+
output_hidden_states (`bool`, *optional*):
|
| 800 |
+
Whether or not to return the hidden states of all layers. See `hidden_states` under returned tensors
|
| 801 |
+
for more detail.
|
| 802 |
+
return_dict (`bool`, *optional*):
|
| 803 |
+
Whether or not to return a [`~utils.ModelOutput`] instead of a plain tuple.
|
| 804 |
+
"""
|
| 805 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
| 806 |
+
output_hidden_states = (
|
| 807 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 808 |
+
)
|
| 809 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 810 |
+
|
| 811 |
+
encoder_states = () if output_hidden_states else None
|
| 812 |
+
all_attentions = () if output_attentions else None
|
| 813 |
+
|
| 814 |
+
hidden_states = inputs_embeds
|
| 815 |
+
for encoder_layer in self.layers:
|
| 816 |
+
if output_hidden_states:
|
| 817 |
+
encoder_states = encoder_states + (hidden_states,)
|
| 818 |
+
if self.gradient_checkpointing and self.training:
|
| 819 |
+
layer_outputs = self._gradient_checkpointing_func(
|
| 820 |
+
encoder_layer.__call__,
|
| 821 |
+
hidden_states,
|
| 822 |
+
attention_mask,
|
| 823 |
+
output_attentions,
|
| 824 |
+
)
|
| 825 |
+
else:
|
| 826 |
+
layer_outputs = encoder_layer(
|
| 827 |
+
hidden_states,
|
| 828 |
+
attention_mask,
|
| 829 |
+
output_attentions=output_attentions,
|
| 830 |
+
)
|
| 831 |
+
|
| 832 |
+
hidden_states = layer_outputs[0]
|
| 833 |
+
|
| 834 |
+
if output_attentions:
|
| 835 |
+
all_attentions = all_attentions + (layer_outputs[1],)
|
| 836 |
+
|
| 837 |
+
if output_hidden_states:
|
| 838 |
+
encoder_states = encoder_states + (hidden_states,)
|
| 839 |
+
|
| 840 |
+
if not return_dict:
|
| 841 |
+
return tuple(v for v in [hidden_states, encoder_states, all_attentions] if v is not None)
|
| 842 |
+
return BaseModelOutput(
|
| 843 |
+
last_hidden_state=hidden_states, hidden_states=encoder_states, attentions=all_attentions
|
| 844 |
+
)
|
| 845 |
+
|
| 846 |
+
@add_start_docstrings(
|
| 847 |
+
"""The vision model from SigLIP without any head or projection on top.""",
|
| 848 |
+
SIGLIP_START_DOCSTRING
|
| 849 |
+
)
|
| 850 |
+
class SiglipVisionTransformer(SiglipPreTrainedModel):
|
| 851 |
+
config_class = SiglipVisionConfig
|
| 852 |
+
main_input_name = "pixel_values"
|
| 853 |
+
_supports_flash_attn_2 = True
|
| 854 |
+
|
| 855 |
+
def __init__(self, config: SiglipVisionConfig):
|
| 856 |
+
super().__init__(config)
|
| 857 |
+
self.config = config
|
| 858 |
+
embed_dim = config.hidden_size
|
| 859 |
+
|
| 860 |
+
self.embeddings = SiglipVisionEmbeddings(config)
|
| 861 |
+
self.encoder = SiglipEncoder(config)
|
| 862 |
+
self.post_layernorm = nn.LayerNorm(embed_dim, eps=config.layer_norm_eps)
|
| 863 |
+
self._use_flash_attention_2 = config._attn_implementation == "flash_attention_2"
|
| 864 |
+
|
| 865 |
+
# Initialize weights and apply final processing
|
| 866 |
+
self.post_init()
|
| 867 |
+
|
| 868 |
+
def get_input_embeddings(self) -> nn.Module:
|
| 869 |
+
return self.embeddings.patch_embedding
|
| 870 |
+
|
| 871 |
+
@add_start_docstrings_to_model_forward(SIGLIP_VISION_INPUTS_DOCSTRING)
|
| 872 |
+
@replace_return_docstrings(output_type=BaseModelOutputWithPooling, config_class=SiglipVisionConfig)
|
| 873 |
+
def forward(
|
| 874 |
+
self,
|
| 875 |
+
pixel_values,
|
| 876 |
+
patch_attention_mask: Optional[torch.BoolTensor] = None,
|
| 877 |
+
tgt_sizes: Optional[torch.IntTensor] = None,
|
| 878 |
+
output_attentions: Optional[bool] = None,
|
| 879 |
+
output_hidden_states: Optional[bool] = None,
|
| 880 |
+
return_dict: Optional[bool] = None,
|
| 881 |
+
) -> Union[Tuple, BaseModelOutputWithPooling]:
|
| 882 |
+
r"""
|
| 883 |
+
Returns:
|
| 884 |
+
"""
|
| 885 |
+
output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions
|
| 886 |
+
output_hidden_states = (
|
| 887 |
+
output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states
|
| 888 |
+
)
|
| 889 |
+
return_dict = return_dict if return_dict is not None else self.config.use_return_dict
|
| 890 |
+
|
| 891 |
+
batch_size = pixel_values.size(0)
|
| 892 |
+
if patch_attention_mask is None:
|
| 893 |
+
patch_attention_mask = torch.ones(
|
| 894 |
+
size=(
|
| 895 |
+
batch_size,
|
| 896 |
+
pixel_values.size(2) // self.config.patch_size,
|
| 897 |
+
pixel_values.size(3) // self.config.patch_size,
|
| 898 |
+
),
|
| 899 |
+
dtype=torch.bool,
|
| 900 |
+
device=pixel_values.device,
|
| 901 |
+
)
|
| 902 |
+
|
| 903 |
+
hidden_states = self.embeddings(pixel_values=pixel_values, patch_attention_mask=patch_attention_mask, tgt_sizes=tgt_sizes)
|
| 904 |
+
|
| 905 |
+
patch_attention_mask = patch_attention_mask.view(batch_size, -1)
|
| 906 |
+
# The call to `_upad_input` in `_flash_attention_forward` is expensive
|
| 907 |
+
# So when the `patch_attention_mask` is full of 1s (i.e. attending to the whole sequence),
|
| 908 |
+
# avoiding passing the attention_mask, which is equivalent to attending to the full sequence
|
| 909 |
+
if not torch.any(~patch_attention_mask):
|
| 910 |
+
attention_mask=None
|
| 911 |
+
else:
|
| 912 |
+
attention_mask = (
|
| 913 |
+
_prepare_4d_attention_mask(patch_attention_mask, hidden_states.dtype)
|
| 914 |
+
if not self._use_flash_attention_2
|
| 915 |
+
else patch_attention_mask
|
| 916 |
+
)
|
| 917 |
+
|
| 918 |
+
encoder_outputs = self.encoder(
|
| 919 |
+
inputs_embeds=hidden_states,
|
| 920 |
+
attention_mask=attention_mask,
|
| 921 |
+
output_attentions=output_attentions,
|
| 922 |
+
output_hidden_states=output_hidden_states,
|
| 923 |
+
return_dict=return_dict,
|
| 924 |
+
)
|
| 925 |
+
|
| 926 |
+
last_hidden_state = encoder_outputs[0]
|
| 927 |
+
last_hidden_state = self.post_layernorm(last_hidden_state)
|
| 928 |
+
|
| 929 |
+
if not return_dict:
|
| 930 |
+
return (last_hidden_state, None) + encoder_outputs[1:]
|
| 931 |
+
|
| 932 |
+
return BaseModelOutputWithPooling(
|
| 933 |
+
last_hidden_state=last_hidden_state,
|
| 934 |
+
pooler_output=None,
|
| 935 |
+
hidden_states=encoder_outputs.hidden_states,
|
| 936 |
+
attentions=encoder_outputs.attentions,
|
| 937 |
+
)
|
openvino_detokenizer.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<net name="detokenizer" version="11">
|
| 3 |
+
<layers>
|
| 4 |
+
<layer id="0" name="Parameter_157151" type="Parameter" version="opset1">
|
| 5 |
+
<data shape="?,?" element_type="i64" />
|
| 6 |
+
<output>
|
| 7 |
+
<port id="0" precision="I64" names="Parameter_157151">
|
| 8 |
+
<dim>-1</dim>
|
| 9 |
+
<dim>-1</dim>
|
| 10 |
+
</port>
|
| 11 |
+
</output>
|
| 12 |
+
</layer>
|
| 13 |
+
<layer id="1" name="Convert_157350" type="Convert" version="opset1">
|
| 14 |
+
<data destination_type="i32" />
|
| 15 |
+
<input>
|
| 16 |
+
<port id="0" precision="I64">
|
| 17 |
+
<dim>-1</dim>
|
| 18 |
+
<dim>-1</dim>
|
| 19 |
+
</port>
|
| 20 |
+
</input>
|
| 21 |
+
<output>
|
| 22 |
+
<port id="1" precision="I32">
|
| 23 |
+
<dim>-1</dim>
|
| 24 |
+
<dim>-1</dim>
|
| 25 |
+
</port>
|
| 26 |
+
</output>
|
| 27 |
+
</layer>
|
| 28 |
+
<layer id="2" name="Constant_157153" type="Const" version="opset1">
|
| 29 |
+
<data element_type="i32" shape="151748" offset="0" size="606992" />
|
| 30 |
+
<output>
|
| 31 |
+
<port id="0" precision="I32">
|
| 32 |
+
<dim>151748</dim>
|
| 33 |
+
</port>
|
| 34 |
+
</output>
|
| 35 |
+
</layer>
|
| 36 |
+
<layer id="3" name="Constant_157155" type="Const" version="opset1">
|
| 37 |
+
<data element_type="i32" shape="151748" offset="606992" size="606992" />
|
| 38 |
+
<output>
|
| 39 |
+
<port id="0" precision="I32">
|
| 40 |
+
<dim>151748</dim>
|
| 41 |
+
</port>
|
| 42 |
+
</output>
|
| 43 |
+
</layer>
|
| 44 |
+
<layer id="4" name="Constant_157157" type="Const" version="opset1">
|
| 45 |
+
<data element_type="u8" shape="977358" offset="1213984" size="977358" />
|
| 46 |
+
<output>
|
| 47 |
+
<port id="0" precision="U8">
|
| 48 |
+
<dim>977358</dim>
|
| 49 |
+
</port>
|
| 50 |
+
</output>
|
| 51 |
+
</layer>
|
| 52 |
+
<layer id="5" name="Slice_157162" type="Const" version="opset1">
|
| 53 |
+
<data element_type="i32" shape="94" offset="2191342" size="376" />
|
| 54 |
+
<output>
|
| 55 |
+
<port id="0" precision="I32">
|
| 56 |
+
<dim>94</dim>
|
| 57 |
+
</port>
|
| 58 |
+
</output>
|
| 59 |
+
</layer>
|
| 60 |
+
<layer id="6" name="VocabDecoder_157164" type="VocabDecoder" version="extension">
|
| 61 |
+
<data skip_tokens="" />
|
| 62 |
+
<input>
|
| 63 |
+
<port id="0" precision="I32">
|
| 64 |
+
<dim>-1</dim>
|
| 65 |
+
<dim>-1</dim>
|
| 66 |
+
</port>
|
| 67 |
+
<port id="1" precision="I32">
|
| 68 |
+
<dim>151748</dim>
|
| 69 |
+
</port>
|
| 70 |
+
<port id="2" precision="I32">
|
| 71 |
+
<dim>151748</dim>
|
| 72 |
+
</port>
|
| 73 |
+
<port id="3" precision="U8">
|
| 74 |
+
<dim>977358</dim>
|
| 75 |
+
</port>
|
| 76 |
+
<port id="4" precision="I32">
|
| 77 |
+
<dim>94</dim>
|
| 78 |
+
</port>
|
| 79 |
+
</input>
|
| 80 |
+
<output>
|
| 81 |
+
<port id="5" precision="I32">
|
| 82 |
+
<dim>-1</dim>
|
| 83 |
+
</port>
|
| 84 |
+
<port id="6" precision="I32">
|
| 85 |
+
<dim>-1</dim>
|
| 86 |
+
</port>
|
| 87 |
+
<port id="7" precision="I32">
|
| 88 |
+
<dim>-1</dim>
|
| 89 |
+
</port>
|
| 90 |
+
<port id="8" precision="I32">
|
| 91 |
+
<dim>-1</dim>
|
| 92 |
+
</port>
|
| 93 |
+
<port id="9" precision="U8">
|
| 94 |
+
<dim>-1</dim>
|
| 95 |
+
</port>
|
| 96 |
+
</output>
|
| 97 |
+
</layer>
|
| 98 |
+
<layer id="7" name="FuzeRagged_157165" type="FuzeRagged" version="extension">
|
| 99 |
+
<input>
|
| 100 |
+
<port id="0" precision="I32">
|
| 101 |
+
<dim>-1</dim>
|
| 102 |
+
</port>
|
| 103 |
+
<port id="1" precision="I32">
|
| 104 |
+
<dim>-1</dim>
|
| 105 |
+
</port>
|
| 106 |
+
<port id="2" precision="I32">
|
| 107 |
+
<dim>-1</dim>
|
| 108 |
+
</port>
|
| 109 |
+
<port id="3" precision="I32">
|
| 110 |
+
<dim>-1</dim>
|
| 111 |
+
</port>
|
| 112 |
+
</input>
|
| 113 |
+
<output>
|
| 114 |
+
<port id="4" precision="I32">
|
| 115 |
+
<dim>-1</dim>
|
| 116 |
+
</port>
|
| 117 |
+
<port id="5" precision="I32">
|
| 118 |
+
<dim>-1</dim>
|
| 119 |
+
</port>
|
| 120 |
+
</output>
|
| 121 |
+
</layer>
|
| 122 |
+
<layer id="8" name="UTF8Validate_157166" type="UTF8Validate" version="extension">
|
| 123 |
+
<data replace_mode="true" />
|
| 124 |
+
<input>
|
| 125 |
+
<port id="0" precision="I32">
|
| 126 |
+
<dim>-1</dim>
|
| 127 |
+
</port>
|
| 128 |
+
<port id="1" precision="I32">
|
| 129 |
+
<dim>-1</dim>
|
| 130 |
+
</port>
|
| 131 |
+
<port id="2" precision="U8">
|
| 132 |
+
<dim>-1</dim>
|
| 133 |
+
</port>
|
| 134 |
+
</input>
|
| 135 |
+
<output>
|
| 136 |
+
<port id="3" precision="I32">
|
| 137 |
+
<dim>-1</dim>
|
| 138 |
+
</port>
|
| 139 |
+
<port id="4" precision="I32">
|
| 140 |
+
<dim>-1</dim>
|
| 141 |
+
</port>
|
| 142 |
+
<port id="5" precision="U8">
|
| 143 |
+
<dim>-1</dim>
|
| 144 |
+
</port>
|
| 145 |
+
</output>
|
| 146 |
+
</layer>
|
| 147 |
+
<layer id="9" name="StringTensorPack_157167" type="StringTensorPack" version="opset15">
|
| 148 |
+
<input>
|
| 149 |
+
<port id="0" precision="I32">
|
| 150 |
+
<dim>-1</dim>
|
| 151 |
+
</port>
|
| 152 |
+
<port id="1" precision="I32">
|
| 153 |
+
<dim>-1</dim>
|
| 154 |
+
</port>
|
| 155 |
+
<port id="2" precision="U8">
|
| 156 |
+
<dim>-1</dim>
|
| 157 |
+
</port>
|
| 158 |
+
</input>
|
| 159 |
+
<output>
|
| 160 |
+
<port id="3" precision="STRING" names="Result_157168,string_output">
|
| 161 |
+
<dim>-1</dim>
|
| 162 |
+
</port>
|
| 163 |
+
</output>
|
| 164 |
+
</layer>
|
| 165 |
+
<layer id="10" name="Result_157168" type="Result" version="opset1" output_names="Result_157168,string_output">
|
| 166 |
+
<input>
|
| 167 |
+
<port id="0" precision="STRING">
|
| 168 |
+
<dim>-1</dim>
|
| 169 |
+
</port>
|
| 170 |
+
</input>
|
| 171 |
+
</layer>
|
| 172 |
+
</layers>
|
| 173 |
+
<edges>
|
| 174 |
+
<edge from-layer="0" from-port="0" to-layer="1" to-port="0" />
|
| 175 |
+
<edge from-layer="1" from-port="1" to-layer="6" to-port="0" />
|
| 176 |
+
<edge from-layer="2" from-port="0" to-layer="6" to-port="1" />
|
| 177 |
+
<edge from-layer="3" from-port="0" to-layer="6" to-port="2" />
|
| 178 |
+
<edge from-layer="4" from-port="0" to-layer="6" to-port="3" />
|
| 179 |
+
<edge from-layer="5" from-port="0" to-layer="6" to-port="4" />
|
| 180 |
+
<edge from-layer="6" from-port="7" to-layer="7" to-port="2" />
|
| 181 |
+
<edge from-layer="6" from-port="9" to-layer="8" to-port="2" />
|
| 182 |
+
<edge from-layer="6" from-port="8" to-layer="7" to-port="3" />
|
| 183 |
+
<edge from-layer="6" from-port="6" to-layer="7" to-port="1" />
|
| 184 |
+
<edge from-layer="6" from-port="5" to-layer="7" to-port="0" />
|
| 185 |
+
<edge from-layer="7" from-port="4" to-layer="8" to-port="0" />
|
| 186 |
+
<edge from-layer="7" from-port="5" to-layer="8" to-port="1" />
|
| 187 |
+
<edge from-layer="8" from-port="3" to-layer="9" to-port="0" />
|
| 188 |
+
<edge from-layer="8" from-port="4" to-layer="9" to-port="1" />
|
| 189 |
+
<edge from-layer="8" from-port="5" to-layer="9" to-port="2" />
|
| 190 |
+
<edge from-layer="9" from-port="3" to-layer="10" to-port="0" />
|
| 191 |
+
</edges>
|
| 192 |
+
<rt_info>
|
| 193 |
+
<add_attention_mask value="True" />
|
| 194 |
+
<add_prefix_space />
|
| 195 |
+
<add_special_tokens value="True" />
|
| 196 |
+
<bos_token_id value="151644" />
|
| 197 |
+
<chat_template value="{%- if tools %} {{- '<|im_start|>system\n' }} {%- if messages[0].role == 'system' %} {{- messages[0].content + '\n\n' }} {%- endif %} {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }} {%- for tool in tools %} {{- "\n" }} {{- tool | tojson }} {%- endfor %} {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }} {%- else %} {%- if messages[0].role == 'system' %} {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }} {%- endif %} {%- endif %} {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %} {%- for message in messages[::-1] %} {%- set index = (messages|length - 1) - loop.index0 %} {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %} {%- set ns.multi_step_tool = false %} {%- set ns.last_query_index = index %} {%- endif %} {%- endfor %} {%- for message in messages %} {%- if (message.role == "user") or (message.role == "system" and not loop.first) %} {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }} {%- elif message.role == "assistant" %} {%- set content = message.content %} {%- set reasoning_content = '' %} {%- if message.reasoning_content is defined and message.reasoning_content is not none %} {%- set reasoning_content = message.reasoning_content %} {%- else %} {%- if '</think>' in message.content %} {%- set content = message.content.split('</think>')[-1].lstrip('\n') %} {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %} {%- endif %} {%- endif %} {%- if loop.index0 > ns.last_query_index %} {%- if loop.last or (not loop.last and reasoning_content) %} {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }} {%- else %} {{- '<|im_start|>' + message.role + '\n' + content }} {%- endif %} {%- else %} {{- '<|im_start|>' + message.role + '\n' + content }} {%- endif %} {%- if message.tool_calls %} {%- for tool_call in message.tool_calls %} {%- if (loop.first and content) or (not loop.first) %} {{- '\n' }} {%- endif %} {%- if tool_call.function %} {%- set tool_call = tool_call.function %} {%- endif %} {{- '<tool_call>\n{"name": "' }} {{- tool_call.name }} {{- '", "arguments": ' }} {%- if tool_call.arguments is string %} {{- tool_call.arguments }} {%- else %} {{- tool_call.arguments | tojson }} {%- endif %} {{- '}\n</tool_call>' }} {%- endfor %} {%- endif %} {{- '<|im_end|>\n' }} {%- elif message.role == "tool" %} {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %} {{- '<|im_start|>user' }} {%- endif %} {{- '\n<tool_response>\n' }} {{- message.content }} {{- '\n</tool_response>' }} {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} {{- '<|im_end|>\n' }} {%- endif %} {%- endif %} {%- endfor %} {%- if add_generation_prompt %} {{- '<|im_start|>assistant\n' }} {%- if enable_thinking is defined and enable_thinking is false %} {{- '<think>\n\n</think>\n\n' }} {%- endif %} {%- if enable_thinking is defined and enable_thinking is true %} {{- '<think>\n' }} {%- endif %} {%- endif %}" />
|
| 198 |
+
<clean_up_tokenization_spaces />
|
| 199 |
+
<detokenizer_input_type value="i64" />
|
| 200 |
+
<eos_token_id value="151645" />
|
| 201 |
+
<handle_special_tokens_with_re />
|
| 202 |
+
<max_length />
|
| 203 |
+
<number_of_inputs value="1" />
|
| 204 |
+
<openvino_tokenizers_version value="2026.0.0.0-632-47cea02a2d4" />
|
| 205 |
+
<openvino_version value="2026.0.0-20965-c6d6a13a886-releases/2026/0" />
|
| 206 |
+
<original_post_processor_template value="{"type": "ByteLevel", "add_prefix_space": false, "trim_offsets": false, "use_regex": false}" />
|
| 207 |
+
<original_tokenizer_class value="<class 'transformers_modules.MiniCPM-V-4_5.tokenization_minicpmv_fast.MiniCPMVTokenizerFast'>" />
|
| 208 |
+
<pad_token_id value="151643" />
|
| 209 |
+
<processed_post_processor_template value="{"single": {"ids": [-1], "type_ids": [0]}, "pair": {"ids": [-1, -2], "type_ids": [0, 0]}}" />
|
| 210 |
+
<sentencepiece_version value="0.2.1" />
|
| 211 |
+
<skip_special_tokens value="True" />
|
| 212 |
+
<streaming_detokenizer value="False" />
|
| 213 |
+
<tiktoken_version value="0.7.0" />
|
| 214 |
+
<tokenizer_output_type value="i64" />
|
| 215 |
+
<tokenizers_version value="0.21.4" />
|
| 216 |
+
<transformers_version value="4.53.3" />
|
| 217 |
+
<use_max_padding value="False" />
|
| 218 |
+
<use_sentencepiece_backend value="False" />
|
| 219 |
+
<utf8_replace_mode value="replace" />
|
| 220 |
+
<with_detokenizer value="True" />
|
| 221 |
+
</rt_info>
|
| 222 |
+
</net>
|
openvino_language_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:423ef7d5e500b4a82c8d2c442ff16c3f1a3305f0d3f824b6626a36078c68c2d8
|
| 3 |
+
size 4918015137
|
openvino_language_model.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
openvino_resampler_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7bcf7006af670e10bf666234874b86ac63d9b2ea5f74338cf77694131d6f63ae
|
| 3 |
+
size 63359228
|
openvino_resampler_model.xml
ADDED
|
@@ -0,0 +1,2179 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<net name="Model0" version="11">
|
| 3 |
+
<layers>
|
| 4 |
+
<layer id="0" name="image_feature" type="Parameter" version="opset1">
|
| 5 |
+
<data shape="?,?,?" element_type="f32" />
|
| 6 |
+
<output>
|
| 7 |
+
<port id="0" precision="FP32" names="image_feature">
|
| 8 |
+
<dim>-1</dim>
|
| 9 |
+
<dim>-1</dim>
|
| 10 |
+
<dim>-1</dim>
|
| 11 |
+
</port>
|
| 12 |
+
</output>
|
| 13 |
+
</layer>
|
| 14 |
+
<layer id="1" name="pos_embed" type="Parameter" version="opset1">
|
| 15 |
+
<data shape="?,?,?" element_type="f32" />
|
| 16 |
+
<output>
|
| 17 |
+
<port id="0" precision="FP32" names="pos_embed">
|
| 18 |
+
<dim>-1</dim>
|
| 19 |
+
<dim>-1</dim>
|
| 20 |
+
<dim>-1</dim>
|
| 21 |
+
</port>
|
| 22 |
+
</output>
|
| 23 |
+
</layer>
|
| 24 |
+
<layer id="2" name="key_padding_mask" type="Parameter" version="opset1">
|
| 25 |
+
<data shape="?,?" element_type="f32" />
|
| 26 |
+
<output>
|
| 27 |
+
<port id="0" precision="FP32" names="key_padding_mask">
|
| 28 |
+
<dim>-1</dim>
|
| 29 |
+
<dim>-1</dim>
|
| 30 |
+
</port>
|
| 31 |
+
</output>
|
| 32 |
+
</layer>
|
| 33 |
+
<layer id="3" name="Constant_9709" type="Const" version="opset1">
|
| 34 |
+
<data element_type="i64" shape="4" offset="0" size="32" />
|
| 35 |
+
<output>
|
| 36 |
+
<port id="0" precision="I64">
|
| 37 |
+
<dim>4</dim>
|
| 38 |
+
</port>
|
| 39 |
+
</output>
|
| 40 |
+
</layer>
|
| 41 |
+
<layer id="4" name="__module.attn/aten::view/Reshape_1" type="Reshape" version="opset1">
|
| 42 |
+
<data special_zero="true" />
|
| 43 |
+
<input>
|
| 44 |
+
<port id="0" precision="FP32">
|
| 45 |
+
<dim>-1</dim>
|
| 46 |
+
<dim>-1</dim>
|
| 47 |
+
</port>
|
| 48 |
+
<port id="1" precision="I64">
|
| 49 |
+
<dim>4</dim>
|
| 50 |
+
</port>
|
| 51 |
+
</input>
|
| 52 |
+
<output>
|
| 53 |
+
<port id="2" precision="FP32" names="114">
|
| 54 |
+
<dim>-1</dim>
|
| 55 |
+
<dim>1</dim>
|
| 56 |
+
<dim>1</dim>
|
| 57 |
+
<dim>-1</dim>
|
| 58 |
+
</port>
|
| 59 |
+
</output>
|
| 60 |
+
</layer>
|
| 61 |
+
<layer id="5" name="__module.attn/aten::expand/Abs" type="Const" version="opset1">
|
| 62 |
+
<data element_type="i64" shape="4" offset="32" size="32" />
|
| 63 |
+
<output>
|
| 64 |
+
<port id="0" precision="I64">
|
| 65 |
+
<dim>4</dim>
|
| 66 |
+
</port>
|
| 67 |
+
</output>
|
| 68 |
+
</layer>
|
| 69 |
+
<layer id="6" name="__module.attn/aten::expand/Broadcast" type="Broadcast" version="opset3">
|
| 70 |
+
<data mode="bidirectional" />
|
| 71 |
+
<input>
|
| 72 |
+
<port id="0" precision="FP32">
|
| 73 |
+
<dim>-1</dim>
|
| 74 |
+
<dim>1</dim>
|
| 75 |
+
<dim>1</dim>
|
| 76 |
+
<dim>-1</dim>
|
| 77 |
+
</port>
|
| 78 |
+
<port id="1" precision="I64">
|
| 79 |
+
<dim>4</dim>
|
| 80 |
+
</port>
|
| 81 |
+
</input>
|
| 82 |
+
<output>
|
| 83 |
+
<port id="2" precision="FP32" names="116">
|
| 84 |
+
<dim>-1</dim>
|
| 85 |
+
<dim>32</dim>
|
| 86 |
+
<dim>1</dim>
|
| 87 |
+
<dim>-1</dim>
|
| 88 |
+
</port>
|
| 89 |
+
</output>
|
| 90 |
+
</layer>
|
| 91 |
+
<layer id="7" name="ShapeOf_9677" type="ShapeOf" version="opset3">
|
| 92 |
+
<data output_type="i64" />
|
| 93 |
+
<input>
|
| 94 |
+
<port id="0" precision="FP32">
|
| 95 |
+
<dim>-1</dim>
|
| 96 |
+
<dim>-1</dim>
|
| 97 |
+
<dim>-1</dim>
|
| 98 |
+
</port>
|
| 99 |
+
</input>
|
| 100 |
+
<output>
|
| 101 |
+
<port id="1" precision="I64">
|
| 102 |
+
<dim>3</dim>
|
| 103 |
+
</port>
|
| 104 |
+
</output>
|
| 105 |
+
</layer>
|
| 106 |
+
<layer id="8" name="Constant_9678" type="Const" version="opset1">
|
| 107 |
+
<data element_type="i64" shape="1" offset="64" size="8" />
|
| 108 |
+
<output>
|
| 109 |
+
<port id="0" precision="I64">
|
| 110 |
+
<dim>1</dim>
|
| 111 |
+
</port>
|
| 112 |
+
</output>
|
| 113 |
+
</layer>
|
| 114 |
+
<layer id="9" name="Constant_9679" type="Const" version="opset1">
|
| 115 |
+
<data element_type="i64" shape="" offset="64" size="8" />
|
| 116 |
+
<output>
|
| 117 |
+
<port id="0" precision="I64" />
|
| 118 |
+
</output>
|
| 119 |
+
</layer>
|
| 120 |
+
<layer id="10" name="Gather_9680" type="Gather" version="opset8">
|
| 121 |
+
<data batch_dims="0" />
|
| 122 |
+
<input>
|
| 123 |
+
<port id="0" precision="I64">
|
| 124 |
+
<dim>3</dim>
|
| 125 |
+
</port>
|
| 126 |
+
<port id="1" precision="I64">
|
| 127 |
+
<dim>1</dim>
|
| 128 |
+
</port>
|
| 129 |
+
<port id="2" precision="I64" />
|
| 130 |
+
</input>
|
| 131 |
+
<output>
|
| 132 |
+
<port id="3" precision="I64" names="12,14,76">
|
| 133 |
+
<dim>1</dim>
|
| 134 |
+
</port>
|
| 135 |
+
</output>
|
| 136 |
+
</layer>
|
| 137 |
+
<layer id="11" name="Constant_7587" type="Const" version="opset1">
|
| 138 |
+
<data element_type="i64" shape="1" offset="72" size="8" />
|
| 139 |
+
<output>
|
| 140 |
+
<port id="0" precision="I64">
|
| 141 |
+
<dim>1</dim>
|
| 142 |
+
</port>
|
| 143 |
+
</output>
|
| 144 |
+
</layer>
|
| 145 |
+
<layer id="12" name="__module.attn/aten::mul/Multiply" type="Multiply" version="opset1">
|
| 146 |
+
<data auto_broadcast="numpy" />
|
| 147 |
+
<input>
|
| 148 |
+
<port id="0" precision="I64">
|
| 149 |
+
<dim>1</dim>
|
| 150 |
+
</port>
|
| 151 |
+
<port id="1" precision="I64">
|
| 152 |
+
<dim>1</dim>
|
| 153 |
+
</port>
|
| 154 |
+
</input>
|
| 155 |
+
<output>
|
| 156 |
+
<port id="2" precision="I64" names="101,102,107,108,117,118,95,96">
|
| 157 |
+
<dim>1</dim>
|
| 158 |
+
</port>
|
| 159 |
+
</output>
|
| 160 |
+
</layer>
|
| 161 |
+
<layer id="13" name="Constant_331" type="Const" version="opset1">
|
| 162 |
+
<data element_type="i64" shape="1" offset="80" size="8" />
|
| 163 |
+
<output>
|
| 164 |
+
<port id="0" precision="I64">
|
| 165 |
+
<dim>1</dim>
|
| 166 |
+
</port>
|
| 167 |
+
</output>
|
| 168 |
+
</layer>
|
| 169 |
+
<layer id="14" name="Constant_9688" type="Const" version="opset1">
|
| 170 |
+
<data element_type="i64" shape="1" offset="80" size="8" />
|
| 171 |
+
<output>
|
| 172 |
+
<port id="0" precision="I64">
|
| 173 |
+
<dim>1</dim>
|
| 174 |
+
</port>
|
| 175 |
+
</output>
|
| 176 |
+
</layer>
|
| 177 |
+
<layer id="15" name="Constant_9689" type="Const" version="opset1">
|
| 178 |
+
<data element_type="i64" shape="" offset="64" size="8" />
|
| 179 |
+
<output>
|
| 180 |
+
<port id="0" precision="I64" />
|
| 181 |
+
</output>
|
| 182 |
+
</layer>
|
| 183 |
+
<layer id="16" name="Gather_9690" type="Gather" version="opset8">
|
| 184 |
+
<data batch_dims="0" />
|
| 185 |
+
<input>
|
| 186 |
+
<port id="0" precision="I64">
|
| 187 |
+
<dim>3</dim>
|
| 188 |
+
</port>
|
| 189 |
+
<port id="1" precision="I64">
|
| 190 |
+
<dim>1</dim>
|
| 191 |
+
</port>
|
| 192 |
+
<port id="2" precision="I64" />
|
| 193 |
+
</input>
|
| 194 |
+
<output>
|
| 195 |
+
<port id="3" precision="I64" names="100,106,112">
|
| 196 |
+
<dim>1</dim>
|
| 197 |
+
</port>
|
| 198 |
+
</output>
|
| 199 |
+
</layer>
|
| 200 |
+
<layer id="17" name="__module.attn/prim::ListConstruct_2" type="Concat" version="opset1">
|
| 201 |
+
<data axis="0" />
|
| 202 |
+
<input>
|
| 203 |
+
<port id="0" precision="I64">
|
| 204 |
+
<dim>1</dim>
|
| 205 |
+
</port>
|
| 206 |
+
<port id="1" precision="I64">
|
| 207 |
+
<dim>1</dim>
|
| 208 |
+
</port>
|
| 209 |
+
<port id="2" precision="I64">
|
| 210 |
+
<dim>1</dim>
|
| 211 |
+
</port>
|
| 212 |
+
</input>
|
| 213 |
+
<output>
|
| 214 |
+
<port id="3" precision="I64">
|
| 215 |
+
<dim>3</dim>
|
| 216 |
+
</port>
|
| 217 |
+
</output>
|
| 218 |
+
</layer>
|
| 219 |
+
<layer id="18" name="__module.attn/aten::reshape/Reshape" type="Reshape" version="opset1">
|
| 220 |
+
<data special_zero="false" />
|
| 221 |
+
<input>
|
| 222 |
+
<port id="0" precision="FP32">
|
| 223 |
+
<dim>-1</dim>
|
| 224 |
+
<dim>32</dim>
|
| 225 |
+
<dim>1</dim>
|
| 226 |
+
<dim>-1</dim>
|
| 227 |
+
</port>
|
| 228 |
+
<port id="1" precision="I64">
|
| 229 |
+
<dim>3</dim>
|
| 230 |
+
</port>
|
| 231 |
+
</input>
|
| 232 |
+
<output>
|
| 233 |
+
<port id="2" precision="FP32" names="120,key_padding_mask_1">
|
| 234 |
+
<dim>-1</dim>
|
| 235 |
+
<dim>1</dim>
|
| 236 |
+
<dim>-1</dim>
|
| 237 |
+
</port>
|
| 238 |
+
</output>
|
| 239 |
+
</layer>
|
| 240 |
+
<layer id="19" name="aten::unsqueeze/Unsqueeze" type="Const" version="opset1">
|
| 241 |
+
<data element_type="f32" shape="64, 1, 4096" offset="88" size="1048576" />
|
| 242 |
+
<output>
|
| 243 |
+
<port id="0" precision="FP32" names="24">
|
| 244 |
+
<dim>64</dim>
|
| 245 |
+
<dim>1</dim>
|
| 246 |
+
<dim>4096</dim>
|
| 247 |
+
</port>
|
| 248 |
+
</output>
|
| 249 |
+
</layer>
|
| 250 |
+
<layer id="20" name="Constant_892" type="Const" version="opset1">
|
| 251 |
+
<data element_type="i64" shape="1" offset="80" size="8" />
|
| 252 |
+
<output>
|
| 253 |
+
<port id="0" precision="I64">
|
| 254 |
+
<dim>1</dim>
|
| 255 |
+
</port>
|
| 256 |
+
</output>
|
| 257 |
+
</layer>
|
| 258 |
+
<layer id="21" name="Constant_899" type="Const" version="opset1">
|
| 259 |
+
<data element_type="i64" shape="1" offset="80" size="8" />
|
| 260 |
+
<output>
|
| 261 |
+
<port id="0" precision="I64">
|
| 262 |
+
<dim>1</dim>
|
| 263 |
+
</port>
|
| 264 |
+
</output>
|
| 265 |
+
</layer>
|
| 266 |
+
<layer id="22" name="prim::ListConstruct/Concat" type="Concat" version="opset1">
|
| 267 |
+
<data axis="0" />
|
| 268 |
+
<input>
|
| 269 |
+
<port id="0" precision="I64">
|
| 270 |
+
<dim>1</dim>
|
| 271 |
+
</port>
|
| 272 |
+
<port id="1" precision="I64">
|
| 273 |
+
<dim>1</dim>
|
| 274 |
+
</port>
|
| 275 |
+
<port id="2" precision="I64">
|
| 276 |
+
<dim>1</dim>
|
| 277 |
+
</port>
|
| 278 |
+
</input>
|
| 279 |
+
<output>
|
| 280 |
+
<port id="3" precision="I64" names="27">
|
| 281 |
+
<dim>3</dim>
|
| 282 |
+
</port>
|
| 283 |
+
</output>
|
| 284 |
+
</layer>
|
| 285 |
+
<layer id="23" name="aten::repeat/Tile" type="Tile" version="opset1">
|
| 286 |
+
<input>
|
| 287 |
+
<port id="0" precision="FP32">
|
| 288 |
+
<dim>64</dim>
|
| 289 |
+
<dim>1</dim>
|
| 290 |
+
<dim>4096</dim>
|
| 291 |
+
</port>
|
| 292 |
+
<port id="1" precision="I64">
|
| 293 |
+
<dim>3</dim>
|
| 294 |
+
</port>
|
| 295 |
+
</input>
|
| 296 |
+
<output>
|
| 297 |
+
<port id="2" precision="FP32" names="28,query.1">
|
| 298 |
+
<dim>64</dim>
|
| 299 |
+
<dim>-1</dim>
|
| 300 |
+
<dim>4096</dim>
|
| 301 |
+
</port>
|
| 302 |
+
</output>
|
| 303 |
+
</layer>
|
| 304 |
+
<layer id="24" name="__module.attn/prim::ListUnpack/VariadicSplit.0" type="Const" version="opset1">
|
| 305 |
+
<data element_type="u4" shape="4096, 32, 128" offset="1048664" size="8388608" />
|
| 306 |
+
<output>
|
| 307 |
+
<port id="0" precision="U4">
|
| 308 |
+
<dim>4096</dim>
|
| 309 |
+
<dim>32</dim>
|
| 310 |
+
<dim>128</dim>
|
| 311 |
+
</port>
|
| 312 |
+
</output>
|
| 313 |
+
</layer>
|
| 314 |
+
<layer id="25" name="Convert_183550" type="Convert" version="opset1">
|
| 315 |
+
<data destination_type="f16" />
|
| 316 |
+
<input>
|
| 317 |
+
<port id="0" precision="U4">
|
| 318 |
+
<dim>4096</dim>
|
| 319 |
+
<dim>32</dim>
|
| 320 |
+
<dim>128</dim>
|
| 321 |
+
</port>
|
| 322 |
+
</input>
|
| 323 |
+
<output>
|
| 324 |
+
<port id="1" precision="FP16">
|
| 325 |
+
<dim>4096</dim>
|
| 326 |
+
<dim>32</dim>
|
| 327 |
+
<dim>128</dim>
|
| 328 |
+
</port>
|
| 329 |
+
</output>
|
| 330 |
+
</layer>
|
| 331 |
+
<layer id="26" name="__module.attn/prim::ListUnpack/VariadicSplit.0/zero_point" type="Const" version="opset1">
|
| 332 |
+
<data element_type="u4" shape="4096, 32, 1" offset="9437272" size="65536" />
|
| 333 |
+
<output>
|
| 334 |
+
<port id="0" precision="U4">
|
| 335 |
+
<dim>4096</dim>
|
| 336 |
+
<dim>32</dim>
|
| 337 |
+
<dim>1</dim>
|
| 338 |
+
</port>
|
| 339 |
+
</output>
|
| 340 |
+
</layer>
|
| 341 |
+
<layer id="27" name="Convert_183553" type="Convert" version="opset1">
|
| 342 |
+
<data destination_type="f16" />
|
| 343 |
+
<input>
|
| 344 |
+
<port id="0" precision="U4">
|
| 345 |
+
<dim>4096</dim>
|
| 346 |
+
<dim>32</dim>
|
| 347 |
+
<dim>1</dim>
|
| 348 |
+
</port>
|
| 349 |
+
</input>
|
| 350 |
+
<output>
|
| 351 |
+
<port id="1" precision="FP16">
|
| 352 |
+
<dim>4096</dim>
|
| 353 |
+
<dim>32</dim>
|
| 354 |
+
<dim>1</dim>
|
| 355 |
+
</port>
|
| 356 |
+
</output>
|
| 357 |
+
</layer>
|
| 358 |
+
<layer id="28" name="__module.attn/prim::ListUnpack/VariadicSplit.0/zero_point/subtract" type="Subtract" version="opset1">
|
| 359 |
+
<data auto_broadcast="numpy" />
|
| 360 |
+
<input>
|
| 361 |
+
<port id="0" precision="FP16">
|
| 362 |
+
<dim>4096</dim>
|
| 363 |
+
<dim>32</dim>
|
| 364 |
+
<dim>128</dim>
|
| 365 |
+
</port>
|
| 366 |
+
<port id="1" precision="FP16">
|
| 367 |
+
<dim>4096</dim>
|
| 368 |
+
<dim>32</dim>
|
| 369 |
+
<dim>1</dim>
|
| 370 |
+
</port>
|
| 371 |
+
</input>
|
| 372 |
+
<output>
|
| 373 |
+
<port id="2" precision="FP16">
|
| 374 |
+
<dim>4096</dim>
|
| 375 |
+
<dim>32</dim>
|
| 376 |
+
<dim>128</dim>
|
| 377 |
+
</port>
|
| 378 |
+
</output>
|
| 379 |
+
</layer>
|
| 380 |
+
<layer id="29" name="__module.attn/prim::ListUnpack/VariadicSplit.0/scale" type="Const" version="opset1">
|
| 381 |
+
<data element_type="f16" shape="4096, 32, 1" offset="9502808" size="262144" />
|
| 382 |
+
<output>
|
| 383 |
+
<port id="0" precision="FP16">
|
| 384 |
+
<dim>4096</dim>
|
| 385 |
+
<dim>32</dim>
|
| 386 |
+
<dim>1</dim>
|
| 387 |
+
</port>
|
| 388 |
+
</output>
|
| 389 |
+
</layer>
|
| 390 |
+
<layer id="30" name="__module.attn/prim::ListUnpack/VariadicSplit.0/fq_weights_1" type="Multiply" version="opset1">
|
| 391 |
+
<data auto_broadcast="numpy" />
|
| 392 |
+
<input>
|
| 393 |
+
<port id="0" precision="FP16">
|
| 394 |
+
<dim>4096</dim>
|
| 395 |
+
<dim>32</dim>
|
| 396 |
+
<dim>128</dim>
|
| 397 |
+
</port>
|
| 398 |
+
<port id="1" precision="FP16">
|
| 399 |
+
<dim>4096</dim>
|
| 400 |
+
<dim>32</dim>
|
| 401 |
+
<dim>1</dim>
|
| 402 |
+
</port>
|
| 403 |
+
</input>
|
| 404 |
+
<output>
|
| 405 |
+
<port id="2" precision="FP16">
|
| 406 |
+
<dim>4096</dim>
|
| 407 |
+
<dim>32</dim>
|
| 408 |
+
<dim>128</dim>
|
| 409 |
+
</port>
|
| 410 |
+
</output>
|
| 411 |
+
</layer>
|
| 412 |
+
<layer id="31" name="Constant_183558" type="Const" version="opset1">
|
| 413 |
+
<data element_type="i64" shape="2" offset="9764952" size="16" />
|
| 414 |
+
<output>
|
| 415 |
+
<port id="0" precision="I64">
|
| 416 |
+
<dim>2</dim>
|
| 417 |
+
</port>
|
| 418 |
+
</output>
|
| 419 |
+
</layer>
|
| 420 |
+
<layer id="32" name="Reshape_183559" type="Reshape" version="opset1">
|
| 421 |
+
<data special_zero="false" />
|
| 422 |
+
<input>
|
| 423 |
+
<port id="0" precision="FP16">
|
| 424 |
+
<dim>4096</dim>
|
| 425 |
+
<dim>32</dim>
|
| 426 |
+
<dim>128</dim>
|
| 427 |
+
</port>
|
| 428 |
+
<port id="1" precision="I64">
|
| 429 |
+
<dim>2</dim>
|
| 430 |
+
</port>
|
| 431 |
+
</input>
|
| 432 |
+
<output>
|
| 433 |
+
<port id="2" precision="FP16">
|
| 434 |
+
<dim>4096</dim>
|
| 435 |
+
<dim>4096</dim>
|
| 436 |
+
</port>
|
| 437 |
+
</output>
|
| 438 |
+
</layer>
|
| 439 |
+
<layer id="33" name="__module.attn/prim::ListUnpack/VariadicSplit.0/fq_weights_1/convert" type="Convert" version="opset1">
|
| 440 |
+
<data destination_type="f32" />
|
| 441 |
+
<input>
|
| 442 |
+
<port id="0" precision="FP16">
|
| 443 |
+
<dim>4096</dim>
|
| 444 |
+
<dim>4096</dim>
|
| 445 |
+
</port>
|
| 446 |
+
</input>
|
| 447 |
+
<output>
|
| 448 |
+
<port id="1" precision="FP32">
|
| 449 |
+
<dim>4096</dim>
|
| 450 |
+
<dim>4096</dim>
|
| 451 |
+
</port>
|
| 452 |
+
</output>
|
| 453 |
+
</layer>
|
| 454 |
+
<layer id="34" name="__module.attn/aten::linear/MatMul_1" type="MatMul" version="opset1">
|
| 455 |
+
<data transpose_a="false" transpose_b="true" />
|
| 456 |
+
<input>
|
| 457 |
+
<port id="0" precision="FP32">
|
| 458 |
+
<dim>64</dim>
|
| 459 |
+
<dim>-1</dim>
|
| 460 |
+
<dim>4096</dim>
|
| 461 |
+
</port>
|
| 462 |
+
<port id="1" precision="FP32">
|
| 463 |
+
<dim>4096</dim>
|
| 464 |
+
<dim>4096</dim>
|
| 465 |
+
</port>
|
| 466 |
+
</input>
|
| 467 |
+
<output>
|
| 468 |
+
<port id="2" precision="FP32">
|
| 469 |
+
<dim>64</dim>
|
| 470 |
+
<dim>-1</dim>
|
| 471 |
+
<dim>4096</dim>
|
| 472 |
+
</port>
|
| 473 |
+
</output>
|
| 474 |
+
</layer>
|
| 475 |
+
<layer id="35" name="Constant_9255" type="Const" version="opset1">
|
| 476 |
+
<data element_type="f32" shape="1, 1, 4096" offset="9764968" size="16384" />
|
| 477 |
+
<output>
|
| 478 |
+
<port id="0" precision="FP32">
|
| 479 |
+
<dim>1</dim>
|
| 480 |
+
<dim>1</dim>
|
| 481 |
+
<dim>4096</dim>
|
| 482 |
+
</port>
|
| 483 |
+
</output>
|
| 484 |
+
</layer>
|
| 485 |
+
<layer id="36" name="__module.attn/aten::linear/Add_1" type="Add" version="opset1">
|
| 486 |
+
<data auto_broadcast="numpy" />
|
| 487 |
+
<input>
|
| 488 |
+
<port id="0" precision="FP32">
|
| 489 |
+
<dim>64</dim>
|
| 490 |
+
<dim>-1</dim>
|
| 491 |
+
<dim>4096</dim>
|
| 492 |
+
</port>
|
| 493 |
+
<port id="1" precision="FP32">
|
| 494 |
+
<dim>1</dim>
|
| 495 |
+
<dim>1</dim>
|
| 496 |
+
<dim>4096</dim>
|
| 497 |
+
</port>
|
| 498 |
+
</input>
|
| 499 |
+
<output>
|
| 500 |
+
<port id="2" precision="FP32" names="92,q.3">
|
| 501 |
+
<dim>64</dim>
|
| 502 |
+
<dim>-1</dim>
|
| 503 |
+
<dim>4096</dim>
|
| 504 |
+
</port>
|
| 505 |
+
</output>
|
| 506 |
+
</layer>
|
| 507 |
+
<layer id="37" name="Constant_9710" type="Const" version="opset1">
|
| 508 |
+
<data element_type="i64" shape="3" offset="9781352" size="24" />
|
| 509 |
+
<output>
|
| 510 |
+
<port id="0" precision="I64">
|
| 511 |
+
<dim>3</dim>
|
| 512 |
+
</port>
|
| 513 |
+
</output>
|
| 514 |
+
</layer>
|
| 515 |
+
<layer id="38" name="__module.attn/aten::view/Reshape_2" type="Reshape" version="opset1">
|
| 516 |
+
<data special_zero="true" />
|
| 517 |
+
<input>
|
| 518 |
+
<port id="0" precision="FP32">
|
| 519 |
+
<dim>64</dim>
|
| 520 |
+
<dim>-1</dim>
|
| 521 |
+
<dim>4096</dim>
|
| 522 |
+
</port>
|
| 523 |
+
<port id="1" precision="I64">
|
| 524 |
+
<dim>3</dim>
|
| 525 |
+
</port>
|
| 526 |
+
</input>
|
| 527 |
+
<output>
|
| 528 |
+
<port id="2" precision="FP32" names="98">
|
| 529 |
+
<dim>64</dim>
|
| 530 |
+
<dim>-1</dim>
|
| 531 |
+
<dim>128</dim>
|
| 532 |
+
</port>
|
| 533 |
+
</output>
|
| 534 |
+
</layer>
|
| 535 |
+
<layer id="39" name="__module.attn/aten::transpose/Constant_1" type="Const" version="opset1">
|
| 536 |
+
<data element_type="i32" shape="3" offset="9781376" size="12" />
|
| 537 |
+
<output>
|
| 538 |
+
<port id="0" precision="I32">
|
| 539 |
+
<dim>3</dim>
|
| 540 |
+
</port>
|
| 541 |
+
</output>
|
| 542 |
+
</layer>
|
| 543 |
+
<layer id="40" name="__module.attn/aten::transpose/Transpose_1" type="Transpose" version="opset1">
|
| 544 |
+
<input>
|
| 545 |
+
<port id="0" precision="FP32">
|
| 546 |
+
<dim>64</dim>
|
| 547 |
+
<dim>-1</dim>
|
| 548 |
+
<dim>128</dim>
|
| 549 |
+
</port>
|
| 550 |
+
<port id="1" precision="I32">
|
| 551 |
+
<dim>3</dim>
|
| 552 |
+
</port>
|
| 553 |
+
</input>
|
| 554 |
+
<output>
|
| 555 |
+
<port id="2" precision="FP32" names="99,q">
|
| 556 |
+
<dim>-1</dim>
|
| 557 |
+
<dim>64</dim>
|
| 558 |
+
<dim>128</dim>
|
| 559 |
+
</port>
|
| 560 |
+
</output>
|
| 561 |
+
</layer>
|
| 562 |
+
<layer id="41" name="Constant_9256" type="Const" version="opset1">
|
| 563 |
+
<data element_type="f32" shape="1, 1, 1" offset="9781388" size="4" />
|
| 564 |
+
<output>
|
| 565 |
+
<port id="0" precision="FP32">
|
| 566 |
+
<dim>1</dim>
|
| 567 |
+
<dim>1</dim>
|
| 568 |
+
<dim>1</dim>
|
| 569 |
+
</port>
|
| 570 |
+
</output>
|
| 571 |
+
</layer>
|
| 572 |
+
<layer id="42" name="__module.attn/aten::mul/Multiply_3" type="Multiply" version="opset1">
|
| 573 |
+
<data auto_broadcast="numpy" />
|
| 574 |
+
<input>
|
| 575 |
+
<port id="0" precision="FP32">
|
| 576 |
+
<dim>-1</dim>
|
| 577 |
+
<dim>64</dim>
|
| 578 |
+
<dim>128</dim>
|
| 579 |
+
</port>
|
| 580 |
+
<port id="1" precision="FP32">
|
| 581 |
+
<dim>1</dim>
|
| 582 |
+
<dim>1</dim>
|
| 583 |
+
<dim>1</dim>
|
| 584 |
+
</port>
|
| 585 |
+
</input>
|
| 586 |
+
<output>
|
| 587 |
+
<port id="2" precision="FP32" names="121,q_scaled">
|
| 588 |
+
<dim>-1</dim>
|
| 589 |
+
<dim>64</dim>
|
| 590 |
+
<dim>128</dim>
|
| 591 |
+
</port>
|
| 592 |
+
</output>
|
| 593 |
+
</layer>
|
| 594 |
+
<layer id="43" name="self.kv_proj.weight" type="Const" version="opset1">
|
| 595 |
+
<data element_type="u4" shape="4096, 9, 128" offset="9781392" size="2359296" />
|
| 596 |
+
<output>
|
| 597 |
+
<port id="0" precision="U4">
|
| 598 |
+
<dim>4096</dim>
|
| 599 |
+
<dim>9</dim>
|
| 600 |
+
<dim>128</dim>
|
| 601 |
+
</port>
|
| 602 |
+
</output>
|
| 603 |
+
</layer>
|
| 604 |
+
<layer id="44" name="Convert_198759" type="Convert" version="opset1">
|
| 605 |
+
<data destination_type="f16" />
|
| 606 |
+
<input>
|
| 607 |
+
<port id="0" precision="U4">
|
| 608 |
+
<dim>4096</dim>
|
| 609 |
+
<dim>9</dim>
|
| 610 |
+
<dim>128</dim>
|
| 611 |
+
</port>
|
| 612 |
+
</input>
|
| 613 |
+
<output>
|
| 614 |
+
<port id="1" precision="FP16">
|
| 615 |
+
<dim>4096</dim>
|
| 616 |
+
<dim>9</dim>
|
| 617 |
+
<dim>128</dim>
|
| 618 |
+
</port>
|
| 619 |
+
</output>
|
| 620 |
+
</layer>
|
| 621 |
+
<layer id="45" name="self.kv_proj.weight/zero_point" type="Const" version="opset1">
|
| 622 |
+
<data element_type="u4" shape="4096, 9, 1" offset="12140688" size="18432" />
|
| 623 |
+
<output>
|
| 624 |
+
<port id="0" precision="U4">
|
| 625 |
+
<dim>4096</dim>
|
| 626 |
+
<dim>9</dim>
|
| 627 |
+
<dim>1</dim>
|
| 628 |
+
</port>
|
| 629 |
+
</output>
|
| 630 |
+
</layer>
|
| 631 |
+
<layer id="46" name="Convert_198762" type="Convert" version="opset1">
|
| 632 |
+
<data destination_type="f16" />
|
| 633 |
+
<input>
|
| 634 |
+
<port id="0" precision="U4">
|
| 635 |
+
<dim>4096</dim>
|
| 636 |
+
<dim>9</dim>
|
| 637 |
+
<dim>1</dim>
|
| 638 |
+
</port>
|
| 639 |
+
</input>
|
| 640 |
+
<output>
|
| 641 |
+
<port id="1" precision="FP16">
|
| 642 |
+
<dim>4096</dim>
|
| 643 |
+
<dim>9</dim>
|
| 644 |
+
<dim>1</dim>
|
| 645 |
+
</port>
|
| 646 |
+
</output>
|
| 647 |
+
</layer>
|
| 648 |
+
<layer id="47" name="self.kv_proj.weight/zero_point/subtract" type="Subtract" version="opset1">
|
| 649 |
+
<data auto_broadcast="numpy" />
|
| 650 |
+
<input>
|
| 651 |
+
<port id="0" precision="FP16">
|
| 652 |
+
<dim>4096</dim>
|
| 653 |
+
<dim>9</dim>
|
| 654 |
+
<dim>128</dim>
|
| 655 |
+
</port>
|
| 656 |
+
<port id="1" precision="FP16">
|
| 657 |
+
<dim>4096</dim>
|
| 658 |
+
<dim>9</dim>
|
| 659 |
+
<dim>1</dim>
|
| 660 |
+
</port>
|
| 661 |
+
</input>
|
| 662 |
+
<output>
|
| 663 |
+
<port id="2" precision="FP16">
|
| 664 |
+
<dim>4096</dim>
|
| 665 |
+
<dim>9</dim>
|
| 666 |
+
<dim>128</dim>
|
| 667 |
+
</port>
|
| 668 |
+
</output>
|
| 669 |
+
</layer>
|
| 670 |
+
<layer id="48" name="self.kv_proj.weight/scale" type="Const" version="opset1">
|
| 671 |
+
<data element_type="f16" shape="4096, 9, 1" offset="12159120" size="73728" />
|
| 672 |
+
<output>
|
| 673 |
+
<port id="0" precision="FP16">
|
| 674 |
+
<dim>4096</dim>
|
| 675 |
+
<dim>9</dim>
|
| 676 |
+
<dim>1</dim>
|
| 677 |
+
</port>
|
| 678 |
+
</output>
|
| 679 |
+
</layer>
|
| 680 |
+
<layer id="49" name="self.kv_proj.weight/fq_weights_1" type="Multiply" version="opset1">
|
| 681 |
+
<data auto_broadcast="numpy" />
|
| 682 |
+
<input>
|
| 683 |
+
<port id="0" precision="FP16">
|
| 684 |
+
<dim>4096</dim>
|
| 685 |
+
<dim>9</dim>
|
| 686 |
+
<dim>128</dim>
|
| 687 |
+
</port>
|
| 688 |
+
<port id="1" precision="FP16">
|
| 689 |
+
<dim>4096</dim>
|
| 690 |
+
<dim>9</dim>
|
| 691 |
+
<dim>1</dim>
|
| 692 |
+
</port>
|
| 693 |
+
</input>
|
| 694 |
+
<output>
|
| 695 |
+
<port id="2" precision="FP16">
|
| 696 |
+
<dim>4096</dim>
|
| 697 |
+
<dim>9</dim>
|
| 698 |
+
<dim>128</dim>
|
| 699 |
+
</port>
|
| 700 |
+
</output>
|
| 701 |
+
</layer>
|
| 702 |
+
<layer id="50" name="Constant_198767" type="Const" version="opset1">
|
| 703 |
+
<data element_type="i64" shape="2" offset="12232848" size="16" />
|
| 704 |
+
<output>
|
| 705 |
+
<port id="0" precision="I64">
|
| 706 |
+
<dim>2</dim>
|
| 707 |
+
</port>
|
| 708 |
+
</output>
|
| 709 |
+
</layer>
|
| 710 |
+
<layer id="51" name="Reshape_198768" type="Reshape" version="opset1">
|
| 711 |
+
<data special_zero="false" />
|
| 712 |
+
<input>
|
| 713 |
+
<port id="0" precision="FP16">
|
| 714 |
+
<dim>4096</dim>
|
| 715 |
+
<dim>9</dim>
|
| 716 |
+
<dim>128</dim>
|
| 717 |
+
</port>
|
| 718 |
+
<port id="1" precision="I64">
|
| 719 |
+
<dim>2</dim>
|
| 720 |
+
</port>
|
| 721 |
+
</input>
|
| 722 |
+
<output>
|
| 723 |
+
<port id="2" precision="FP16">
|
| 724 |
+
<dim>4096</dim>
|
| 725 |
+
<dim>1152</dim>
|
| 726 |
+
</port>
|
| 727 |
+
</output>
|
| 728 |
+
</layer>
|
| 729 |
+
<layer id="52" name="self.kv_proj.weight/fq_weights_1/convert" type="Convert" version="opset1">
|
| 730 |
+
<data destination_type="f32" />
|
| 731 |
+
<input>
|
| 732 |
+
<port id="0" precision="FP16">
|
| 733 |
+
<dim>4096</dim>
|
| 734 |
+
<dim>1152</dim>
|
| 735 |
+
</port>
|
| 736 |
+
</input>
|
| 737 |
+
<output>
|
| 738 |
+
<port id="1" precision="FP32">
|
| 739 |
+
<dim>4096</dim>
|
| 740 |
+
<dim>1152</dim>
|
| 741 |
+
</port>
|
| 742 |
+
</output>
|
| 743 |
+
</layer>
|
| 744 |
+
<layer id="53" name="__module.kv_proj/ov_ext::linear/MatMul" type="MatMul" version="opset1">
|
| 745 |
+
<data transpose_a="false" transpose_b="true" />
|
| 746 |
+
<input>
|
| 747 |
+
<port id="0" precision="FP32">
|
| 748 |
+
<dim>-1</dim>
|
| 749 |
+
<dim>-1</dim>
|
| 750 |
+
<dim>-1</dim>
|
| 751 |
+
</port>
|
| 752 |
+
<port id="1" precision="FP32">
|
| 753 |
+
<dim>4096</dim>
|
| 754 |
+
<dim>1152</dim>
|
| 755 |
+
</port>
|
| 756 |
+
</input>
|
| 757 |
+
<output>
|
| 758 |
+
<port id="2" precision="FP32" names="41,input.1">
|
| 759 |
+
<dim>-1</dim>
|
| 760 |
+
<dim>-1</dim>
|
| 761 |
+
<dim>4096</dim>
|
| 762 |
+
</port>
|
| 763 |
+
</output>
|
| 764 |
+
</layer>
|
| 765 |
+
<layer id="54" name="__module.ln_kv/aten::layer_norm/Multiply" type="Const" version="opset1">
|
| 766 |
+
<data element_type="i32" shape="1" offset="12232864" size="4" />
|
| 767 |
+
<output>
|
| 768 |
+
<port id="0" precision="I32">
|
| 769 |
+
<dim>1</dim>
|
| 770 |
+
</port>
|
| 771 |
+
</output>
|
| 772 |
+
</layer>
|
| 773 |
+
<layer id="55" name="__module.ln_kv/aten::layer_norm/MVN" type="MVN" version="opset6">
|
| 774 |
+
<data eps="9.9999999747524271e-07" normalize_variance="true" eps_mode="INSIDE_SQRT" />
|
| 775 |
+
<input>
|
| 776 |
+
<port id="0" precision="FP32">
|
| 777 |
+
<dim>-1</dim>
|
| 778 |
+
<dim>-1</dim>
|
| 779 |
+
<dim>4096</dim>
|
| 780 |
+
</port>
|
| 781 |
+
<port id="1" precision="I32">
|
| 782 |
+
<dim>1</dim>
|
| 783 |
+
</port>
|
| 784 |
+
</input>
|
| 785 |
+
<output>
|
| 786 |
+
<port id="2" precision="FP32">
|
| 787 |
+
<dim>-1</dim>
|
| 788 |
+
<dim>-1</dim>
|
| 789 |
+
<dim>4096</dim>
|
| 790 |
+
</port>
|
| 791 |
+
</output>
|
| 792 |
+
</layer>
|
| 793 |
+
<layer id="56" name="Constant_9252" type="Const" version="opset1">
|
| 794 |
+
<data element_type="f32" shape="1, 1, 4096" offset="12232868" size="16384" />
|
| 795 |
+
<output>
|
| 796 |
+
<port id="0" precision="FP32">
|
| 797 |
+
<dim>1</dim>
|
| 798 |
+
<dim>1</dim>
|
| 799 |
+
<dim>4096</dim>
|
| 800 |
+
</port>
|
| 801 |
+
</output>
|
| 802 |
+
</layer>
|
| 803 |
+
<layer id="57" name="__module.ln_kv/aten::layer_norm/Multiply_1" type="Multiply" version="opset1">
|
| 804 |
+
<data auto_broadcast="numpy" />
|
| 805 |
+
<input>
|
| 806 |
+
<port id="0" precision="FP32">
|
| 807 |
+
<dim>-1</dim>
|
| 808 |
+
<dim>-1</dim>
|
| 809 |
+
<dim>4096</dim>
|
| 810 |
+
</port>
|
| 811 |
+
<port id="1" precision="FP32">
|
| 812 |
+
<dim>1</dim>
|
| 813 |
+
<dim>1</dim>
|
| 814 |
+
<dim>4096</dim>
|
| 815 |
+
</port>
|
| 816 |
+
</input>
|
| 817 |
+
<output>
|
| 818 |
+
<port id="2" precision="FP32">
|
| 819 |
+
<dim>-1</dim>
|
| 820 |
+
<dim>-1</dim>
|
| 821 |
+
<dim>4096</dim>
|
| 822 |
+
</port>
|
| 823 |
+
</output>
|
| 824 |
+
</layer>
|
| 825 |
+
<layer id="58" name="Constant_9253" type="Const" version="opset1">
|
| 826 |
+
<data element_type="f32" shape="1, 1, 4096" offset="12249252" size="16384" />
|
| 827 |
+
<output>
|
| 828 |
+
<port id="0" precision="FP32">
|
| 829 |
+
<dim>1</dim>
|
| 830 |
+
<dim>1</dim>
|
| 831 |
+
<dim>4096</dim>
|
| 832 |
+
</port>
|
| 833 |
+
</output>
|
| 834 |
+
</layer>
|
| 835 |
+
<layer id="59" name="__module.ln_kv/aten::layer_norm/Add" type="Add" version="opset1">
|
| 836 |
+
<data auto_broadcast="numpy" />
|
| 837 |
+
<input>
|
| 838 |
+
<port id="0" precision="FP32">
|
| 839 |
+
<dim>-1</dim>
|
| 840 |
+
<dim>-1</dim>
|
| 841 |
+
<dim>4096</dim>
|
| 842 |
+
</port>
|
| 843 |
+
<port id="1" precision="FP32">
|
| 844 |
+
<dim>1</dim>
|
| 845 |
+
<dim>1</dim>
|
| 846 |
+
<dim>4096</dim>
|
| 847 |
+
</port>
|
| 848 |
+
</input>
|
| 849 |
+
<output>
|
| 850 |
+
<port id="2" precision="FP32" names="48">
|
| 851 |
+
<dim>-1</dim>
|
| 852 |
+
<dim>-1</dim>
|
| 853 |
+
<dim>4096</dim>
|
| 854 |
+
</port>
|
| 855 |
+
</output>
|
| 856 |
+
</layer>
|
| 857 |
+
<layer id="60" name="Constant_53" type="Const" version="opset1">
|
| 858 |
+
<data element_type="i64" shape="3" offset="12265636" size="24" />
|
| 859 |
+
<output>
|
| 860 |
+
<port id="0" precision="I64" names="20">
|
| 861 |
+
<dim>3</dim>
|
| 862 |
+
</port>
|
| 863 |
+
</output>
|
| 864 |
+
</layer>
|
| 865 |
+
<layer id="61" name="aten::permute/Transpose" type="Transpose" version="opset1">
|
| 866 |
+
<input>
|
| 867 |
+
<port id="0" precision="FP32">
|
| 868 |
+
<dim>-1</dim>
|
| 869 |
+
<dim>-1</dim>
|
| 870 |
+
<dim>4096</dim>
|
| 871 |
+
</port>
|
| 872 |
+
<port id="1" precision="I64">
|
| 873 |
+
<dim>3</dim>
|
| 874 |
+
</port>
|
| 875 |
+
</input>
|
| 876 |
+
<output>
|
| 877 |
+
<port id="2" precision="FP32" names="21,image_feature_1">
|
| 878 |
+
<dim>-1</dim>
|
| 879 |
+
<dim>-1</dim>
|
| 880 |
+
<dim>4096</dim>
|
| 881 |
+
</port>
|
| 882 |
+
</output>
|
| 883 |
+
</layer>
|
| 884 |
+
<layer id="62" name="aten::add/Add" type="Add" version="opset1">
|
| 885 |
+
<data auto_broadcast="numpy" />
|
| 886 |
+
<input>
|
| 887 |
+
<port id="0" precision="FP32">
|
| 888 |
+
<dim>-1</dim>
|
| 889 |
+
<dim>-1</dim>
|
| 890 |
+
<dim>4096</dim>
|
| 891 |
+
</port>
|
| 892 |
+
<port id="1" precision="FP32">
|
| 893 |
+
<dim>-1</dim>
|
| 894 |
+
<dim>-1</dim>
|
| 895 |
+
<dim>-1</dim>
|
| 896 |
+
</port>
|
| 897 |
+
</input>
|
| 898 |
+
<output>
|
| 899 |
+
<port id="2" precision="FP32" names="30,key">
|
| 900 |
+
<dim>-1</dim>
|
| 901 |
+
<dim>-1</dim>
|
| 902 |
+
<dim>4096</dim>
|
| 903 |
+
</port>
|
| 904 |
+
</output>
|
| 905 |
+
</layer>
|
| 906 |
+
<layer id="63" name="__module.attn/prim::ListUnpack/VariadicSplit.1" type="Const" version="opset1">
|
| 907 |
+
<data element_type="u4" shape="4096, 32, 128" offset="12265660" size="8388608" />
|
| 908 |
+
<output>
|
| 909 |
+
<port id="0" precision="U4">
|
| 910 |
+
<dim>4096</dim>
|
| 911 |
+
<dim>32</dim>
|
| 912 |
+
<dim>128</dim>
|
| 913 |
+
</port>
|
| 914 |
+
</output>
|
| 915 |
+
</layer>
|
| 916 |
+
<layer id="64" name="Convert_178479" type="Convert" version="opset1">
|
| 917 |
+
<data destination_type="f16" />
|
| 918 |
+
<input>
|
| 919 |
+
<port id="0" precision="U4">
|
| 920 |
+
<dim>4096</dim>
|
| 921 |
+
<dim>32</dim>
|
| 922 |
+
<dim>128</dim>
|
| 923 |
+
</port>
|
| 924 |
+
</input>
|
| 925 |
+
<output>
|
| 926 |
+
<port id="1" precision="FP16">
|
| 927 |
+
<dim>4096</dim>
|
| 928 |
+
<dim>32</dim>
|
| 929 |
+
<dim>128</dim>
|
| 930 |
+
</port>
|
| 931 |
+
</output>
|
| 932 |
+
</layer>
|
| 933 |
+
<layer id="65" name="__module.attn/prim::ListUnpack/VariadicSplit.1/zero_point" type="Const" version="opset1">
|
| 934 |
+
<data element_type="u4" shape="4096, 32, 1" offset="20654268" size="65536" />
|
| 935 |
+
<output>
|
| 936 |
+
<port id="0" precision="U4">
|
| 937 |
+
<dim>4096</dim>
|
| 938 |
+
<dim>32</dim>
|
| 939 |
+
<dim>1</dim>
|
| 940 |
+
</port>
|
| 941 |
+
</output>
|
| 942 |
+
</layer>
|
| 943 |
+
<layer id="66" name="Convert_178482" type="Convert" version="opset1">
|
| 944 |
+
<data destination_type="f16" />
|
| 945 |
+
<input>
|
| 946 |
+
<port id="0" precision="U4">
|
| 947 |
+
<dim>4096</dim>
|
| 948 |
+
<dim>32</dim>
|
| 949 |
+
<dim>1</dim>
|
| 950 |
+
</port>
|
| 951 |
+
</input>
|
| 952 |
+
<output>
|
| 953 |
+
<port id="1" precision="FP16">
|
| 954 |
+
<dim>4096</dim>
|
| 955 |
+
<dim>32</dim>
|
| 956 |
+
<dim>1</dim>
|
| 957 |
+
</port>
|
| 958 |
+
</output>
|
| 959 |
+
</layer>
|
| 960 |
+
<layer id="67" name="__module.attn/prim::ListUnpack/VariadicSplit.1/zero_point/subtract" type="Subtract" version="opset1">
|
| 961 |
+
<data auto_broadcast="numpy" />
|
| 962 |
+
<input>
|
| 963 |
+
<port id="0" precision="FP16">
|
| 964 |
+
<dim>4096</dim>
|
| 965 |
+
<dim>32</dim>
|
| 966 |
+
<dim>128</dim>
|
| 967 |
+
</port>
|
| 968 |
+
<port id="1" precision="FP16">
|
| 969 |
+
<dim>4096</dim>
|
| 970 |
+
<dim>32</dim>
|
| 971 |
+
<dim>1</dim>
|
| 972 |
+
</port>
|
| 973 |
+
</input>
|
| 974 |
+
<output>
|
| 975 |
+
<port id="2" precision="FP16">
|
| 976 |
+
<dim>4096</dim>
|
| 977 |
+
<dim>32</dim>
|
| 978 |
+
<dim>128</dim>
|
| 979 |
+
</port>
|
| 980 |
+
</output>
|
| 981 |
+
</layer>
|
| 982 |
+
<layer id="68" name="__module.attn/prim::ListUnpack/VariadicSplit.1/scale" type="Const" version="opset1">
|
| 983 |
+
<data element_type="f16" shape="4096, 32, 1" offset="20719804" size="262144" />
|
| 984 |
+
<output>
|
| 985 |
+
<port id="0" precision="FP16">
|
| 986 |
+
<dim>4096</dim>
|
| 987 |
+
<dim>32</dim>
|
| 988 |
+
<dim>1</dim>
|
| 989 |
+
</port>
|
| 990 |
+
</output>
|
| 991 |
+
</layer>
|
| 992 |
+
<layer id="69" name="__module.attn/prim::ListUnpack/VariadicSplit.1/fq_weights_1" type="Multiply" version="opset1">
|
| 993 |
+
<data auto_broadcast="numpy" />
|
| 994 |
+
<input>
|
| 995 |
+
<port id="0" precision="FP16">
|
| 996 |
+
<dim>4096</dim>
|
| 997 |
+
<dim>32</dim>
|
| 998 |
+
<dim>128</dim>
|
| 999 |
+
</port>
|
| 1000 |
+
<port id="1" precision="FP16">
|
| 1001 |
+
<dim>4096</dim>
|
| 1002 |
+
<dim>32</dim>
|
| 1003 |
+
<dim>1</dim>
|
| 1004 |
+
</port>
|
| 1005 |
+
</input>
|
| 1006 |
+
<output>
|
| 1007 |
+
<port id="2" precision="FP16">
|
| 1008 |
+
<dim>4096</dim>
|
| 1009 |
+
<dim>32</dim>
|
| 1010 |
+
<dim>128</dim>
|
| 1011 |
+
</port>
|
| 1012 |
+
</output>
|
| 1013 |
+
</layer>
|
| 1014 |
+
<layer id="70" name="Constant_178487" type="Const" version="opset1">
|
| 1015 |
+
<data element_type="i64" shape="2" offset="9764952" size="16" />
|
| 1016 |
+
<output>
|
| 1017 |
+
<port id="0" precision="I64">
|
| 1018 |
+
<dim>2</dim>
|
| 1019 |
+
</port>
|
| 1020 |
+
</output>
|
| 1021 |
+
</layer>
|
| 1022 |
+
<layer id="71" name="Reshape_178488" type="Reshape" version="opset1">
|
| 1023 |
+
<data special_zero="false" />
|
| 1024 |
+
<input>
|
| 1025 |
+
<port id="0" precision="FP16">
|
| 1026 |
+
<dim>4096</dim>
|
| 1027 |
+
<dim>32</dim>
|
| 1028 |
+
<dim>128</dim>
|
| 1029 |
+
</port>
|
| 1030 |
+
<port id="1" precision="I64">
|
| 1031 |
+
<dim>2</dim>
|
| 1032 |
+
</port>
|
| 1033 |
+
</input>
|
| 1034 |
+
<output>
|
| 1035 |
+
<port id="2" precision="FP16">
|
| 1036 |
+
<dim>4096</dim>
|
| 1037 |
+
<dim>4096</dim>
|
| 1038 |
+
</port>
|
| 1039 |
+
</output>
|
| 1040 |
+
</layer>
|
| 1041 |
+
<layer id="72" name="__module.attn/prim::ListUnpack/VariadicSplit.1/fq_weights_1/convert" type="Convert" version="opset1">
|
| 1042 |
+
<data destination_type="f32" />
|
| 1043 |
+
<input>
|
| 1044 |
+
<port id="0" precision="FP16">
|
| 1045 |
+
<dim>4096</dim>
|
| 1046 |
+
<dim>4096</dim>
|
| 1047 |
+
</port>
|
| 1048 |
+
</input>
|
| 1049 |
+
<output>
|
| 1050 |
+
<port id="1" precision="FP32">
|
| 1051 |
+
<dim>4096</dim>
|
| 1052 |
+
<dim>4096</dim>
|
| 1053 |
+
</port>
|
| 1054 |
+
</output>
|
| 1055 |
+
</layer>
|
| 1056 |
+
<layer id="73" name="__module.attn/aten::linear/MatMul" type="MatMul" version="opset1">
|
| 1057 |
+
<data transpose_a="false" transpose_b="true" />
|
| 1058 |
+
<input>
|
| 1059 |
+
<port id="0" precision="FP32">
|
| 1060 |
+
<dim>-1</dim>
|
| 1061 |
+
<dim>-1</dim>
|
| 1062 |
+
<dim>4096</dim>
|
| 1063 |
+
</port>
|
| 1064 |
+
<port id="1" precision="FP32">
|
| 1065 |
+
<dim>4096</dim>
|
| 1066 |
+
<dim>4096</dim>
|
| 1067 |
+
</port>
|
| 1068 |
+
</input>
|
| 1069 |
+
<output>
|
| 1070 |
+
<port id="2" precision="FP32">
|
| 1071 |
+
<dim>-1</dim>
|
| 1072 |
+
<dim>-1</dim>
|
| 1073 |
+
<dim>4096</dim>
|
| 1074 |
+
</port>
|
| 1075 |
+
</output>
|
| 1076 |
+
</layer>
|
| 1077 |
+
<layer id="74" name="Constant_9254" type="Const" version="opset1">
|
| 1078 |
+
<data element_type="f32" shape="1, 1, 4096" offset="20981948" size="16384" />
|
| 1079 |
+
<output>
|
| 1080 |
+
<port id="0" precision="FP32">
|
| 1081 |
+
<dim>1</dim>
|
| 1082 |
+
<dim>1</dim>
|
| 1083 |
+
<dim>4096</dim>
|
| 1084 |
+
</port>
|
| 1085 |
+
</output>
|
| 1086 |
+
</layer>
|
| 1087 |
+
<layer id="75" name="__module.attn/aten::linear/Add" type="Add" version="opset1">
|
| 1088 |
+
<data auto_broadcast="numpy" />
|
| 1089 |
+
<input>
|
| 1090 |
+
<port id="0" precision="FP32">
|
| 1091 |
+
<dim>-1</dim>
|
| 1092 |
+
<dim>-1</dim>
|
| 1093 |
+
<dim>4096</dim>
|
| 1094 |
+
</port>
|
| 1095 |
+
<port id="1" precision="FP32">
|
| 1096 |
+
<dim>1</dim>
|
| 1097 |
+
<dim>1</dim>
|
| 1098 |
+
<dim>4096</dim>
|
| 1099 |
+
</port>
|
| 1100 |
+
</input>
|
| 1101 |
+
<output>
|
| 1102 |
+
<port id="2" precision="FP32" names="93,k.1">
|
| 1103 |
+
<dim>-1</dim>
|
| 1104 |
+
<dim>-1</dim>
|
| 1105 |
+
<dim>4096</dim>
|
| 1106 |
+
</port>
|
| 1107 |
+
</output>
|
| 1108 |
+
</layer>
|
| 1109 |
+
<layer id="76" name="Constant_9711" type="Const" version="opset1">
|
| 1110 |
+
<data element_type="i64" shape="3" offset="20998332" size="24" />
|
| 1111 |
+
<output>
|
| 1112 |
+
<port id="0" precision="I64">
|
| 1113 |
+
<dim>3</dim>
|
| 1114 |
+
</port>
|
| 1115 |
+
</output>
|
| 1116 |
+
</layer>
|
| 1117 |
+
<layer id="77" name="__module.attn/aten::view/Reshape" type="Reshape" version="opset1">
|
| 1118 |
+
<data special_zero="true" />
|
| 1119 |
+
<input>
|
| 1120 |
+
<port id="0" precision="FP32">
|
| 1121 |
+
<dim>-1</dim>
|
| 1122 |
+
<dim>-1</dim>
|
| 1123 |
+
<dim>4096</dim>
|
| 1124 |
+
</port>
|
| 1125 |
+
<port id="1" precision="I64">
|
| 1126 |
+
<dim>3</dim>
|
| 1127 |
+
</port>
|
| 1128 |
+
</input>
|
| 1129 |
+
<output>
|
| 1130 |
+
<port id="2" precision="FP32" names="104">
|
| 1131 |
+
<dim>-1</dim>
|
| 1132 |
+
<dim>-1</dim>
|
| 1133 |
+
<dim>128</dim>
|
| 1134 |
+
</port>
|
| 1135 |
+
</output>
|
| 1136 |
+
</layer>
|
| 1137 |
+
<layer id="78" name="__module.attn/aten::transpose/Constant" type="Const" version="opset1">
|
| 1138 |
+
<data element_type="i32" shape="3" offset="9781376" size="12" />
|
| 1139 |
+
<output>
|
| 1140 |
+
<port id="0" precision="I32">
|
| 1141 |
+
<dim>3</dim>
|
| 1142 |
+
</port>
|
| 1143 |
+
</output>
|
| 1144 |
+
</layer>
|
| 1145 |
+
<layer id="79" name="__module.attn/aten::transpose/Transpose" type="Transpose" version="opset1">
|
| 1146 |
+
<input>
|
| 1147 |
+
<port id="0" precision="FP32">
|
| 1148 |
+
<dim>-1</dim>
|
| 1149 |
+
<dim>-1</dim>
|
| 1150 |
+
<dim>128</dim>
|
| 1151 |
+
</port>
|
| 1152 |
+
<port id="1" precision="I32">
|
| 1153 |
+
<dim>3</dim>
|
| 1154 |
+
</port>
|
| 1155 |
+
</input>
|
| 1156 |
+
<output>
|
| 1157 |
+
<port id="2" precision="FP32" names="105,k">
|
| 1158 |
+
<dim>-1</dim>
|
| 1159 |
+
<dim>-1</dim>
|
| 1160 |
+
<dim>128</dim>
|
| 1161 |
+
</port>
|
| 1162 |
+
</output>
|
| 1163 |
+
</layer>
|
| 1164 |
+
<layer id="80" name="__module.attn/aten::baddbmm/MatMul" type="MatMul" version="opset1">
|
| 1165 |
+
<data transpose_a="false" transpose_b="true" />
|
| 1166 |
+
<input>
|
| 1167 |
+
<port id="0" precision="FP32">
|
| 1168 |
+
<dim>-1</dim>
|
| 1169 |
+
<dim>64</dim>
|
| 1170 |
+
<dim>128</dim>
|
| 1171 |
+
</port>
|
| 1172 |
+
<port id="1" precision="FP32">
|
| 1173 |
+
<dim>-1</dim>
|
| 1174 |
+
<dim>-1</dim>
|
| 1175 |
+
<dim>128</dim>
|
| 1176 |
+
</port>
|
| 1177 |
+
</input>
|
| 1178 |
+
<output>
|
| 1179 |
+
<port id="2" precision="FP32">
|
| 1180 |
+
<dim>-1</dim>
|
| 1181 |
+
<dim>64</dim>
|
| 1182 |
+
<dim>-1</dim>
|
| 1183 |
+
</port>
|
| 1184 |
+
</output>
|
| 1185 |
+
</layer>
|
| 1186 |
+
<layer id="81" name="__module.attn/aten::baddbmm/Add" type="Add" version="opset1">
|
| 1187 |
+
<data auto_broadcast="numpy" />
|
| 1188 |
+
<input>
|
| 1189 |
+
<port id="0" precision="FP32">
|
| 1190 |
+
<dim>-1</dim>
|
| 1191 |
+
<dim>1</dim>
|
| 1192 |
+
<dim>-1</dim>
|
| 1193 |
+
</port>
|
| 1194 |
+
<port id="1" precision="FP32">
|
| 1195 |
+
<dim>-1</dim>
|
| 1196 |
+
<dim>64</dim>
|
| 1197 |
+
<dim>-1</dim>
|
| 1198 |
+
</port>
|
| 1199 |
+
</input>
|
| 1200 |
+
<output>
|
| 1201 |
+
<port id="2" precision="FP32" names="123,input.5">
|
| 1202 |
+
<dim>-1</dim>
|
| 1203 |
+
<dim>64</dim>
|
| 1204 |
+
<dim>-1</dim>
|
| 1205 |
+
</port>
|
| 1206 |
+
</output>
|
| 1207 |
+
</layer>
|
| 1208 |
+
<layer id="82" name="__module.attn/aten::softmax/Softmax" type="SoftMax" version="opset8">
|
| 1209 |
+
<data axis="-1" />
|
| 1210 |
+
<input>
|
| 1211 |
+
<port id="0" precision="FP32">
|
| 1212 |
+
<dim>-1</dim>
|
| 1213 |
+
<dim>64</dim>
|
| 1214 |
+
<dim>-1</dim>
|
| 1215 |
+
</port>
|
| 1216 |
+
</input>
|
| 1217 |
+
<output>
|
| 1218 |
+
<port id="1" precision="FP32" names="124,attn_output_weights.1">
|
| 1219 |
+
<dim>-1</dim>
|
| 1220 |
+
<dim>64</dim>
|
| 1221 |
+
<dim>-1</dim>
|
| 1222 |
+
</port>
|
| 1223 |
+
</output>
|
| 1224 |
+
</layer>
|
| 1225 |
+
<layer id="83" name="__module.attn/prim::ListUnpack/VariadicSplit.2" type="Const" version="opset1">
|
| 1226 |
+
<data element_type="u8" shape="4096, 4096" offset="20998356" size="16777216" />
|
| 1227 |
+
<output>
|
| 1228 |
+
<port id="0" precision="U8">
|
| 1229 |
+
<dim>4096</dim>
|
| 1230 |
+
<dim>4096</dim>
|
| 1231 |
+
</port>
|
| 1232 |
+
</output>
|
| 1233 |
+
</layer>
|
| 1234 |
+
<layer id="84" name="Convert_173410" type="Convert" version="opset1">
|
| 1235 |
+
<data destination_type="f16" />
|
| 1236 |
+
<input>
|
| 1237 |
+
<port id="0" precision="U8">
|
| 1238 |
+
<dim>4096</dim>
|
| 1239 |
+
<dim>4096</dim>
|
| 1240 |
+
</port>
|
| 1241 |
+
</input>
|
| 1242 |
+
<output>
|
| 1243 |
+
<port id="1" precision="FP16">
|
| 1244 |
+
<dim>4096</dim>
|
| 1245 |
+
<dim>4096</dim>
|
| 1246 |
+
</port>
|
| 1247 |
+
</output>
|
| 1248 |
+
</layer>
|
| 1249 |
+
<layer id="85" name="__module.attn/prim::ListUnpack/VariadicSplit.2/zero_point" type="Const" version="opset1">
|
| 1250 |
+
<data element_type="u8" shape="4096, 1" offset="37775572" size="4096" />
|
| 1251 |
+
<output>
|
| 1252 |
+
<port id="0" precision="U8">
|
| 1253 |
+
<dim>4096</dim>
|
| 1254 |
+
<dim>1</dim>
|
| 1255 |
+
</port>
|
| 1256 |
+
</output>
|
| 1257 |
+
</layer>
|
| 1258 |
+
<layer id="86" name="Convert_173413" type="Convert" version="opset1">
|
| 1259 |
+
<data destination_type="f16" />
|
| 1260 |
+
<input>
|
| 1261 |
+
<port id="0" precision="U8">
|
| 1262 |
+
<dim>4096</dim>
|
| 1263 |
+
<dim>1</dim>
|
| 1264 |
+
</port>
|
| 1265 |
+
</input>
|
| 1266 |
+
<output>
|
| 1267 |
+
<port id="1" precision="FP16">
|
| 1268 |
+
<dim>4096</dim>
|
| 1269 |
+
<dim>1</dim>
|
| 1270 |
+
</port>
|
| 1271 |
+
</output>
|
| 1272 |
+
</layer>
|
| 1273 |
+
<layer id="87" name="__module.attn/prim::ListUnpack/VariadicSplit.2/zero_point/subtract" type="Subtract" version="opset1">
|
| 1274 |
+
<data auto_broadcast="numpy" />
|
| 1275 |
+
<input>
|
| 1276 |
+
<port id="0" precision="FP16">
|
| 1277 |
+
<dim>4096</dim>
|
| 1278 |
+
<dim>4096</dim>
|
| 1279 |
+
</port>
|
| 1280 |
+
<port id="1" precision="FP16">
|
| 1281 |
+
<dim>4096</dim>
|
| 1282 |
+
<dim>1</dim>
|
| 1283 |
+
</port>
|
| 1284 |
+
</input>
|
| 1285 |
+
<output>
|
| 1286 |
+
<port id="2" precision="FP16">
|
| 1287 |
+
<dim>4096</dim>
|
| 1288 |
+
<dim>4096</dim>
|
| 1289 |
+
</port>
|
| 1290 |
+
</output>
|
| 1291 |
+
</layer>
|
| 1292 |
+
<layer id="88" name="__module.attn/prim::ListUnpack/VariadicSplit.2/scale" type="Const" version="opset1">
|
| 1293 |
+
<data element_type="f16" shape="4096, 1" offset="37779668" size="8192" />
|
| 1294 |
+
<output>
|
| 1295 |
+
<port id="0" precision="FP16">
|
| 1296 |
+
<dim>4096</dim>
|
| 1297 |
+
<dim>1</dim>
|
| 1298 |
+
</port>
|
| 1299 |
+
</output>
|
| 1300 |
+
</layer>
|
| 1301 |
+
<layer id="89" name="__module.attn/prim::ListUnpack/VariadicSplit.2/fq_weights_1" type="Multiply" version="opset1">
|
| 1302 |
+
<data auto_broadcast="numpy" />
|
| 1303 |
+
<input>
|
| 1304 |
+
<port id="0" precision="FP16">
|
| 1305 |
+
<dim>4096</dim>
|
| 1306 |
+
<dim>4096</dim>
|
| 1307 |
+
</port>
|
| 1308 |
+
<port id="1" precision="FP16">
|
| 1309 |
+
<dim>4096</dim>
|
| 1310 |
+
<dim>1</dim>
|
| 1311 |
+
</port>
|
| 1312 |
+
</input>
|
| 1313 |
+
<output>
|
| 1314 |
+
<port id="2" precision="FP16">
|
| 1315 |
+
<dim>4096</dim>
|
| 1316 |
+
<dim>4096</dim>
|
| 1317 |
+
</port>
|
| 1318 |
+
</output>
|
| 1319 |
+
</layer>
|
| 1320 |
+
<layer id="90" name="__module.attn/prim::ListUnpack/VariadicSplit.2/fq_weights_1/convert" type="Convert" version="opset1">
|
| 1321 |
+
<data destination_type="f32" />
|
| 1322 |
+
<input>
|
| 1323 |
+
<port id="0" precision="FP16">
|
| 1324 |
+
<dim>4096</dim>
|
| 1325 |
+
<dim>4096</dim>
|
| 1326 |
+
</port>
|
| 1327 |
+
</input>
|
| 1328 |
+
<output>
|
| 1329 |
+
<port id="1" precision="FP32">
|
| 1330 |
+
<dim>4096</dim>
|
| 1331 |
+
<dim>4096</dim>
|
| 1332 |
+
</port>
|
| 1333 |
+
</output>
|
| 1334 |
+
</layer>
|
| 1335 |
+
<layer id="91" name="__module.attn/aten::linear/MatMul_2" type="MatMul" version="opset1">
|
| 1336 |
+
<data transpose_a="false" transpose_b="true" />
|
| 1337 |
+
<input>
|
| 1338 |
+
<port id="0" precision="FP32">
|
| 1339 |
+
<dim>-1</dim>
|
| 1340 |
+
<dim>-1</dim>
|
| 1341 |
+
<dim>4096</dim>
|
| 1342 |
+
</port>
|
| 1343 |
+
<port id="1" precision="FP32">
|
| 1344 |
+
<dim>4096</dim>
|
| 1345 |
+
<dim>4096</dim>
|
| 1346 |
+
</port>
|
| 1347 |
+
</input>
|
| 1348 |
+
<output>
|
| 1349 |
+
<port id="2" precision="FP32">
|
| 1350 |
+
<dim>-1</dim>
|
| 1351 |
+
<dim>-1</dim>
|
| 1352 |
+
<dim>4096</dim>
|
| 1353 |
+
</port>
|
| 1354 |
+
</output>
|
| 1355 |
+
</layer>
|
| 1356 |
+
<layer id="92" name="Constant_9257" type="Const" version="opset1">
|
| 1357 |
+
<data element_type="f32" shape="1, 1, 4096" offset="37787860" size="16384" />
|
| 1358 |
+
<output>
|
| 1359 |
+
<port id="0" precision="FP32">
|
| 1360 |
+
<dim>1</dim>
|
| 1361 |
+
<dim>1</dim>
|
| 1362 |
+
<dim>4096</dim>
|
| 1363 |
+
</port>
|
| 1364 |
+
</output>
|
| 1365 |
+
</layer>
|
| 1366 |
+
<layer id="93" name="__module.attn/aten::linear/Add_2" type="Add" version="opset1">
|
| 1367 |
+
<data auto_broadcast="numpy" />
|
| 1368 |
+
<input>
|
| 1369 |
+
<port id="0" precision="FP32">
|
| 1370 |
+
<dim>-1</dim>
|
| 1371 |
+
<dim>-1</dim>
|
| 1372 |
+
<dim>4096</dim>
|
| 1373 |
+
</port>
|
| 1374 |
+
<port id="1" precision="FP32">
|
| 1375 |
+
<dim>1</dim>
|
| 1376 |
+
<dim>1</dim>
|
| 1377 |
+
<dim>4096</dim>
|
| 1378 |
+
</port>
|
| 1379 |
+
</input>
|
| 1380 |
+
<output>
|
| 1381 |
+
<port id="2" precision="FP32" names="94,v.1">
|
| 1382 |
+
<dim>-1</dim>
|
| 1383 |
+
<dim>-1</dim>
|
| 1384 |
+
<dim>4096</dim>
|
| 1385 |
+
</port>
|
| 1386 |
+
</output>
|
| 1387 |
+
</layer>
|
| 1388 |
+
<layer id="94" name="Constant_9712" type="Const" version="opset1">
|
| 1389 |
+
<data element_type="i64" shape="3" offset="20998332" size="24" />
|
| 1390 |
+
<output>
|
| 1391 |
+
<port id="0" precision="I64">
|
| 1392 |
+
<dim>3</dim>
|
| 1393 |
+
</port>
|
| 1394 |
+
</output>
|
| 1395 |
+
</layer>
|
| 1396 |
+
<layer id="95" name="__module.attn/aten::view/Reshape_3" type="Reshape" version="opset1">
|
| 1397 |
+
<data special_zero="true" />
|
| 1398 |
+
<input>
|
| 1399 |
+
<port id="0" precision="FP32">
|
| 1400 |
+
<dim>-1</dim>
|
| 1401 |
+
<dim>-1</dim>
|
| 1402 |
+
<dim>4096</dim>
|
| 1403 |
+
</port>
|
| 1404 |
+
<port id="1" precision="I64">
|
| 1405 |
+
<dim>3</dim>
|
| 1406 |
+
</port>
|
| 1407 |
+
</input>
|
| 1408 |
+
<output>
|
| 1409 |
+
<port id="2" precision="FP32" names="110">
|
| 1410 |
+
<dim>-1</dim>
|
| 1411 |
+
<dim>-1</dim>
|
| 1412 |
+
<dim>128</dim>
|
| 1413 |
+
</port>
|
| 1414 |
+
</output>
|
| 1415 |
+
</layer>
|
| 1416 |
+
<layer id="96" name="__module.attn/aten::transpose/Constant_3" type="Const" version="opset1">
|
| 1417 |
+
<data element_type="i32" shape="3" offset="9781376" size="12" />
|
| 1418 |
+
<output>
|
| 1419 |
+
<port id="0" precision="I32">
|
| 1420 |
+
<dim>3</dim>
|
| 1421 |
+
</port>
|
| 1422 |
+
</output>
|
| 1423 |
+
</layer>
|
| 1424 |
+
<layer id="97" name="__module.attn/aten::transpose/Transpose_3" type="Transpose" version="opset1">
|
| 1425 |
+
<input>
|
| 1426 |
+
<port id="0" precision="FP32">
|
| 1427 |
+
<dim>-1</dim>
|
| 1428 |
+
<dim>-1</dim>
|
| 1429 |
+
<dim>128</dim>
|
| 1430 |
+
</port>
|
| 1431 |
+
<port id="1" precision="I32">
|
| 1432 |
+
<dim>3</dim>
|
| 1433 |
+
</port>
|
| 1434 |
+
</input>
|
| 1435 |
+
<output>
|
| 1436 |
+
<port id="2" precision="FP32" names="111,v">
|
| 1437 |
+
<dim>-1</dim>
|
| 1438 |
+
<dim>-1</dim>
|
| 1439 |
+
<dim>128</dim>
|
| 1440 |
+
</port>
|
| 1441 |
+
</output>
|
| 1442 |
+
</layer>
|
| 1443 |
+
<layer id="98" name="__module.attn/aten::bmm/MatMul" type="MatMul" version="opset1">
|
| 1444 |
+
<data transpose_a="false" transpose_b="false" />
|
| 1445 |
+
<input>
|
| 1446 |
+
<port id="0" precision="FP32">
|
| 1447 |
+
<dim>-1</dim>
|
| 1448 |
+
<dim>64</dim>
|
| 1449 |
+
<dim>-1</dim>
|
| 1450 |
+
</port>
|
| 1451 |
+
<port id="1" precision="FP32">
|
| 1452 |
+
<dim>-1</dim>
|
| 1453 |
+
<dim>-1</dim>
|
| 1454 |
+
<dim>128</dim>
|
| 1455 |
+
</port>
|
| 1456 |
+
</input>
|
| 1457 |
+
<output>
|
| 1458 |
+
<port id="2" precision="FP32" names="125,attn_output.1">
|
| 1459 |
+
<dim>-1</dim>
|
| 1460 |
+
<dim>64</dim>
|
| 1461 |
+
<dim>128</dim>
|
| 1462 |
+
</port>
|
| 1463 |
+
</output>
|
| 1464 |
+
</layer>
|
| 1465 |
+
<layer id="99" name="__module.attn/aten::transpose/Constant_4" type="Const" version="opset1">
|
| 1466 |
+
<data element_type="i32" shape="3" offset="9781376" size="12" />
|
| 1467 |
+
<output>
|
| 1468 |
+
<port id="0" precision="I32">
|
| 1469 |
+
<dim>3</dim>
|
| 1470 |
+
</port>
|
| 1471 |
+
</output>
|
| 1472 |
+
</layer>
|
| 1473 |
+
<layer id="100" name="__module.attn/aten::transpose/Transpose_4" type="Transpose" version="opset1">
|
| 1474 |
+
<input>
|
| 1475 |
+
<port id="0" precision="FP32">
|
| 1476 |
+
<dim>-1</dim>
|
| 1477 |
+
<dim>64</dim>
|
| 1478 |
+
<dim>128</dim>
|
| 1479 |
+
</port>
|
| 1480 |
+
<port id="1" precision="I32">
|
| 1481 |
+
<dim>3</dim>
|
| 1482 |
+
</port>
|
| 1483 |
+
</input>
|
| 1484 |
+
<output>
|
| 1485 |
+
<port id="2" precision="FP32" names="126">
|
| 1486 |
+
<dim>64</dim>
|
| 1487 |
+
<dim>-1</dim>
|
| 1488 |
+
<dim>128</dim>
|
| 1489 |
+
</port>
|
| 1490 |
+
</output>
|
| 1491 |
+
</layer>
|
| 1492 |
+
<layer id="101" name="Concat_4384" type="Const" version="opset1">
|
| 1493 |
+
<data element_type="i64" shape="2" offset="37804244" size="16" />
|
| 1494 |
+
<output>
|
| 1495 |
+
<port id="0" precision="I64">
|
| 1496 |
+
<dim>2</dim>
|
| 1497 |
+
</port>
|
| 1498 |
+
</output>
|
| 1499 |
+
</layer>
|
| 1500 |
+
<layer id="102" name="__module.attn/aten::view/Reshape_4" type="Reshape" version="opset1">
|
| 1501 |
+
<data special_zero="false" />
|
| 1502 |
+
<input>
|
| 1503 |
+
<port id="0" precision="FP32">
|
| 1504 |
+
<dim>64</dim>
|
| 1505 |
+
<dim>-1</dim>
|
| 1506 |
+
<dim>128</dim>
|
| 1507 |
+
</port>
|
| 1508 |
+
<port id="1" precision="I64">
|
| 1509 |
+
<dim>2</dim>
|
| 1510 |
+
</port>
|
| 1511 |
+
</input>
|
| 1512 |
+
<output>
|
| 1513 |
+
<port id="2" precision="FP32" names="131,attn_output.3">
|
| 1514 |
+
<dim>-1</dim>
|
| 1515 |
+
<dim>4096</dim>
|
| 1516 |
+
</port>
|
| 1517 |
+
</output>
|
| 1518 |
+
</layer>
|
| 1519 |
+
<layer id="103" name="self.attn.out_proj.weight" type="Const" version="opset1">
|
| 1520 |
+
<data element_type="u4" shape="4096, 32, 128" offset="37804260" size="8388608" />
|
| 1521 |
+
<output>
|
| 1522 |
+
<port id="0" precision="U4">
|
| 1523 |
+
<dim>4096</dim>
|
| 1524 |
+
<dim>32</dim>
|
| 1525 |
+
<dim>128</dim>
|
| 1526 |
+
</port>
|
| 1527 |
+
</output>
|
| 1528 |
+
</layer>
|
| 1529 |
+
<layer id="104" name="Convert_188621" type="Convert" version="opset1">
|
| 1530 |
+
<data destination_type="f16" />
|
| 1531 |
+
<input>
|
| 1532 |
+
<port id="0" precision="U4">
|
| 1533 |
+
<dim>4096</dim>
|
| 1534 |
+
<dim>32</dim>
|
| 1535 |
+
<dim>128</dim>
|
| 1536 |
+
</port>
|
| 1537 |
+
</input>
|
| 1538 |
+
<output>
|
| 1539 |
+
<port id="1" precision="FP16">
|
| 1540 |
+
<dim>4096</dim>
|
| 1541 |
+
<dim>32</dim>
|
| 1542 |
+
<dim>128</dim>
|
| 1543 |
+
</port>
|
| 1544 |
+
</output>
|
| 1545 |
+
</layer>
|
| 1546 |
+
<layer id="105" name="self.attn.out_proj.weight/zero_point" type="Const" version="opset1">
|
| 1547 |
+
<data element_type="u4" shape="4096, 32, 1" offset="46192868" size="65536" />
|
| 1548 |
+
<output>
|
| 1549 |
+
<port id="0" precision="U4">
|
| 1550 |
+
<dim>4096</dim>
|
| 1551 |
+
<dim>32</dim>
|
| 1552 |
+
<dim>1</dim>
|
| 1553 |
+
</port>
|
| 1554 |
+
</output>
|
| 1555 |
+
</layer>
|
| 1556 |
+
<layer id="106" name="Convert_188624" type="Convert" version="opset1">
|
| 1557 |
+
<data destination_type="f16" />
|
| 1558 |
+
<input>
|
| 1559 |
+
<port id="0" precision="U4">
|
| 1560 |
+
<dim>4096</dim>
|
| 1561 |
+
<dim>32</dim>
|
| 1562 |
+
<dim>1</dim>
|
| 1563 |
+
</port>
|
| 1564 |
+
</input>
|
| 1565 |
+
<output>
|
| 1566 |
+
<port id="1" precision="FP16">
|
| 1567 |
+
<dim>4096</dim>
|
| 1568 |
+
<dim>32</dim>
|
| 1569 |
+
<dim>1</dim>
|
| 1570 |
+
</port>
|
| 1571 |
+
</output>
|
| 1572 |
+
</layer>
|
| 1573 |
+
<layer id="107" name="self.attn.out_proj.weight/zero_point/subtract" type="Subtract" version="opset1">
|
| 1574 |
+
<data auto_broadcast="numpy" />
|
| 1575 |
+
<input>
|
| 1576 |
+
<port id="0" precision="FP16">
|
| 1577 |
+
<dim>4096</dim>
|
| 1578 |
+
<dim>32</dim>
|
| 1579 |
+
<dim>128</dim>
|
| 1580 |
+
</port>
|
| 1581 |
+
<port id="1" precision="FP16">
|
| 1582 |
+
<dim>4096</dim>
|
| 1583 |
+
<dim>32</dim>
|
| 1584 |
+
<dim>1</dim>
|
| 1585 |
+
</port>
|
| 1586 |
+
</input>
|
| 1587 |
+
<output>
|
| 1588 |
+
<port id="2" precision="FP16">
|
| 1589 |
+
<dim>4096</dim>
|
| 1590 |
+
<dim>32</dim>
|
| 1591 |
+
<dim>128</dim>
|
| 1592 |
+
</port>
|
| 1593 |
+
</output>
|
| 1594 |
+
</layer>
|
| 1595 |
+
<layer id="108" name="self.attn.out_proj.weight/scale" type="Const" version="opset1">
|
| 1596 |
+
<data element_type="f16" shape="4096, 32, 1" offset="46258404" size="262144" />
|
| 1597 |
+
<output>
|
| 1598 |
+
<port id="0" precision="FP16">
|
| 1599 |
+
<dim>4096</dim>
|
| 1600 |
+
<dim>32</dim>
|
| 1601 |
+
<dim>1</dim>
|
| 1602 |
+
</port>
|
| 1603 |
+
</output>
|
| 1604 |
+
</layer>
|
| 1605 |
+
<layer id="109" name="self.attn.out_proj.weight/fq_weights_1" type="Multiply" version="opset1">
|
| 1606 |
+
<data auto_broadcast="numpy" />
|
| 1607 |
+
<input>
|
| 1608 |
+
<port id="0" precision="FP16">
|
| 1609 |
+
<dim>4096</dim>
|
| 1610 |
+
<dim>32</dim>
|
| 1611 |
+
<dim>128</dim>
|
| 1612 |
+
</port>
|
| 1613 |
+
<port id="1" precision="FP16">
|
| 1614 |
+
<dim>4096</dim>
|
| 1615 |
+
<dim>32</dim>
|
| 1616 |
+
<dim>1</dim>
|
| 1617 |
+
</port>
|
| 1618 |
+
</input>
|
| 1619 |
+
<output>
|
| 1620 |
+
<port id="2" precision="FP16">
|
| 1621 |
+
<dim>4096</dim>
|
| 1622 |
+
<dim>32</dim>
|
| 1623 |
+
<dim>128</dim>
|
| 1624 |
+
</port>
|
| 1625 |
+
</output>
|
| 1626 |
+
</layer>
|
| 1627 |
+
<layer id="110" name="Constant_188629" type="Const" version="opset1">
|
| 1628 |
+
<data element_type="i64" shape="2" offset="9764952" size="16" />
|
| 1629 |
+
<output>
|
| 1630 |
+
<port id="0" precision="I64">
|
| 1631 |
+
<dim>2</dim>
|
| 1632 |
+
</port>
|
| 1633 |
+
</output>
|
| 1634 |
+
</layer>
|
| 1635 |
+
<layer id="111" name="Reshape_188630" type="Reshape" version="opset1">
|
| 1636 |
+
<data special_zero="false" />
|
| 1637 |
+
<input>
|
| 1638 |
+
<port id="0" precision="FP16">
|
| 1639 |
+
<dim>4096</dim>
|
| 1640 |
+
<dim>32</dim>
|
| 1641 |
+
<dim>128</dim>
|
| 1642 |
+
</port>
|
| 1643 |
+
<port id="1" precision="I64">
|
| 1644 |
+
<dim>2</dim>
|
| 1645 |
+
</port>
|
| 1646 |
+
</input>
|
| 1647 |
+
<output>
|
| 1648 |
+
<port id="2" precision="FP16">
|
| 1649 |
+
<dim>4096</dim>
|
| 1650 |
+
<dim>4096</dim>
|
| 1651 |
+
</port>
|
| 1652 |
+
</output>
|
| 1653 |
+
</layer>
|
| 1654 |
+
<layer id="112" name="self.attn.out_proj.weight/fq_weights_1/convert" type="Convert" version="opset1">
|
| 1655 |
+
<data destination_type="f32" />
|
| 1656 |
+
<input>
|
| 1657 |
+
<port id="0" precision="FP16">
|
| 1658 |
+
<dim>4096</dim>
|
| 1659 |
+
<dim>4096</dim>
|
| 1660 |
+
</port>
|
| 1661 |
+
</input>
|
| 1662 |
+
<output>
|
| 1663 |
+
<port id="1" precision="FP32">
|
| 1664 |
+
<dim>4096</dim>
|
| 1665 |
+
<dim>4096</dim>
|
| 1666 |
+
</port>
|
| 1667 |
+
</output>
|
| 1668 |
+
</layer>
|
| 1669 |
+
<layer id="113" name="__module.attn/aten::linear/MatMul_3" type="MatMul" version="opset1">
|
| 1670 |
+
<data transpose_a="false" transpose_b="true" />
|
| 1671 |
+
<input>
|
| 1672 |
+
<port id="0" precision="FP32">
|
| 1673 |
+
<dim>-1</dim>
|
| 1674 |
+
<dim>4096</dim>
|
| 1675 |
+
</port>
|
| 1676 |
+
<port id="1" precision="FP32">
|
| 1677 |
+
<dim>4096</dim>
|
| 1678 |
+
<dim>4096</dim>
|
| 1679 |
+
</port>
|
| 1680 |
+
</input>
|
| 1681 |
+
<output>
|
| 1682 |
+
<port id="2" precision="FP32">
|
| 1683 |
+
<dim>-1</dim>
|
| 1684 |
+
<dim>4096</dim>
|
| 1685 |
+
</port>
|
| 1686 |
+
</output>
|
| 1687 |
+
</layer>
|
| 1688 |
+
<layer id="114" name="Constant_9258" type="Const" version="opset1">
|
| 1689 |
+
<data element_type="f32" shape="1, 4096" offset="46520548" size="16384" />
|
| 1690 |
+
<output>
|
| 1691 |
+
<port id="0" precision="FP32">
|
| 1692 |
+
<dim>1</dim>
|
| 1693 |
+
<dim>4096</dim>
|
| 1694 |
+
</port>
|
| 1695 |
+
</output>
|
| 1696 |
+
</layer>
|
| 1697 |
+
<layer id="115" name="__module.attn/aten::linear/Add_3" type="Add" version="opset1">
|
| 1698 |
+
<data auto_broadcast="numpy" />
|
| 1699 |
+
<input>
|
| 1700 |
+
<port id="0" precision="FP32">
|
| 1701 |
+
<dim>-1</dim>
|
| 1702 |
+
<dim>4096</dim>
|
| 1703 |
+
</port>
|
| 1704 |
+
<port id="1" precision="FP32">
|
| 1705 |
+
<dim>1</dim>
|
| 1706 |
+
<dim>4096</dim>
|
| 1707 |
+
</port>
|
| 1708 |
+
</input>
|
| 1709 |
+
<output>
|
| 1710 |
+
<port id="2" precision="FP32" names="132,attn_output">
|
| 1711 |
+
<dim>-1</dim>
|
| 1712 |
+
<dim>4096</dim>
|
| 1713 |
+
</port>
|
| 1714 |
+
</output>
|
| 1715 |
+
</layer>
|
| 1716 |
+
<layer id="116" name="Constant_9713" type="Const" version="opset1">
|
| 1717 |
+
<data element_type="i64" shape="3" offset="46536932" size="24" />
|
| 1718 |
+
<output>
|
| 1719 |
+
<port id="0" precision="I64">
|
| 1720 |
+
<dim>3</dim>
|
| 1721 |
+
</port>
|
| 1722 |
+
</output>
|
| 1723 |
+
</layer>
|
| 1724 |
+
<layer id="117" name="__module.attn/aten::view/Reshape_5" type="Reshape" version="opset1">
|
| 1725 |
+
<data special_zero="true" />
|
| 1726 |
+
<input>
|
| 1727 |
+
<port id="0" precision="FP32">
|
| 1728 |
+
<dim>-1</dim>
|
| 1729 |
+
<dim>4096</dim>
|
| 1730 |
+
</port>
|
| 1731 |
+
<port id="1" precision="I64">
|
| 1732 |
+
<dim>3</dim>
|
| 1733 |
+
</port>
|
| 1734 |
+
</input>
|
| 1735 |
+
<output>
|
| 1736 |
+
<port id="2" precision="FP32" names="135,out">
|
| 1737 |
+
<dim>64</dim>
|
| 1738 |
+
<dim>-1</dim>
|
| 1739 |
+
<dim>4096</dim>
|
| 1740 |
+
</port>
|
| 1741 |
+
</output>
|
| 1742 |
+
</layer>
|
| 1743 |
+
<layer id="118" name="Constant_487" type="Const" version="opset1">
|
| 1744 |
+
<data element_type="i64" shape="3" offset="12265636" size="24" />
|
| 1745 |
+
<output>
|
| 1746 |
+
<port id="0" precision="I64" names="35">
|
| 1747 |
+
<dim>3</dim>
|
| 1748 |
+
</port>
|
| 1749 |
+
</output>
|
| 1750 |
+
</layer>
|
| 1751 |
+
<layer id="119" name="aten::permute/Transpose_1" type="Transpose" version="opset1">
|
| 1752 |
+
<input>
|
| 1753 |
+
<port id="0" precision="FP32">
|
| 1754 |
+
<dim>64</dim>
|
| 1755 |
+
<dim>-1</dim>
|
| 1756 |
+
<dim>4096</dim>
|
| 1757 |
+
</port>
|
| 1758 |
+
<port id="1" precision="I64">
|
| 1759 |
+
<dim>3</dim>
|
| 1760 |
+
</port>
|
| 1761 |
+
</input>
|
| 1762 |
+
<output>
|
| 1763 |
+
<port id="2" precision="FP32" names="36,input">
|
| 1764 |
+
<dim>-1</dim>
|
| 1765 |
+
<dim>64</dim>
|
| 1766 |
+
<dim>4096</dim>
|
| 1767 |
+
</port>
|
| 1768 |
+
</output>
|
| 1769 |
+
</layer>
|
| 1770 |
+
<layer id="120" name="__module.ln_post/aten::layer_norm/Multiply" type="Const" version="opset1">
|
| 1771 |
+
<data element_type="i32" shape="1" offset="12232864" size="4" />
|
| 1772 |
+
<output>
|
| 1773 |
+
<port id="0" precision="I32">
|
| 1774 |
+
<dim>1</dim>
|
| 1775 |
+
</port>
|
| 1776 |
+
</output>
|
| 1777 |
+
</layer>
|
| 1778 |
+
<layer id="121" name="__module.ln_post/aten::layer_norm/MVN" type="MVN" version="opset6">
|
| 1779 |
+
<data eps="9.9999999747524271e-07" normalize_variance="true" eps_mode="INSIDE_SQRT" />
|
| 1780 |
+
<input>
|
| 1781 |
+
<port id="0" precision="FP32">
|
| 1782 |
+
<dim>-1</dim>
|
| 1783 |
+
<dim>64</dim>
|
| 1784 |
+
<dim>4096</dim>
|
| 1785 |
+
</port>
|
| 1786 |
+
<port id="1" precision="I32">
|
| 1787 |
+
<dim>1</dim>
|
| 1788 |
+
</port>
|
| 1789 |
+
</input>
|
| 1790 |
+
<output>
|
| 1791 |
+
<port id="2" precision="FP32">
|
| 1792 |
+
<dim>-1</dim>
|
| 1793 |
+
<dim>64</dim>
|
| 1794 |
+
<dim>4096</dim>
|
| 1795 |
+
</port>
|
| 1796 |
+
</output>
|
| 1797 |
+
</layer>
|
| 1798 |
+
<layer id="122" name="Constant_9259" type="Const" version="opset1">
|
| 1799 |
+
<data element_type="f32" shape="1, 1, 4096" offset="46536956" size="16384" />
|
| 1800 |
+
<output>
|
| 1801 |
+
<port id="0" precision="FP32">
|
| 1802 |
+
<dim>1</dim>
|
| 1803 |
+
<dim>1</dim>
|
| 1804 |
+
<dim>4096</dim>
|
| 1805 |
+
</port>
|
| 1806 |
+
</output>
|
| 1807 |
+
</layer>
|
| 1808 |
+
<layer id="123" name="__module.ln_post/aten::layer_norm/Multiply_1" type="Multiply" version="opset1">
|
| 1809 |
+
<data auto_broadcast="numpy" />
|
| 1810 |
+
<input>
|
| 1811 |
+
<port id="0" precision="FP32">
|
| 1812 |
+
<dim>-1</dim>
|
| 1813 |
+
<dim>64</dim>
|
| 1814 |
+
<dim>4096</dim>
|
| 1815 |
+
</port>
|
| 1816 |
+
<port id="1" precision="FP32">
|
| 1817 |
+
<dim>1</dim>
|
| 1818 |
+
<dim>1</dim>
|
| 1819 |
+
<dim>4096</dim>
|
| 1820 |
+
</port>
|
| 1821 |
+
</input>
|
| 1822 |
+
<output>
|
| 1823 |
+
<port id="2" precision="FP32">
|
| 1824 |
+
<dim>-1</dim>
|
| 1825 |
+
<dim>64</dim>
|
| 1826 |
+
<dim>4096</dim>
|
| 1827 |
+
</port>
|
| 1828 |
+
</output>
|
| 1829 |
+
</layer>
|
| 1830 |
+
<layer id="124" name="Constant_9260" type="Const" version="opset1">
|
| 1831 |
+
<data element_type="f32" shape="1, 1, 4096" offset="46553340" size="16384" />
|
| 1832 |
+
<output>
|
| 1833 |
+
<port id="0" precision="FP32">
|
| 1834 |
+
<dim>1</dim>
|
| 1835 |
+
<dim>1</dim>
|
| 1836 |
+
<dim>4096</dim>
|
| 1837 |
+
</port>
|
| 1838 |
+
</output>
|
| 1839 |
+
</layer>
|
| 1840 |
+
<layer id="125" name="__module.ln_post/aten::layer_norm/Add" type="Add" version="opset1">
|
| 1841 |
+
<data auto_broadcast="numpy" />
|
| 1842 |
+
<input>
|
| 1843 |
+
<port id="0" precision="FP32">
|
| 1844 |
+
<dim>-1</dim>
|
| 1845 |
+
<dim>64</dim>
|
| 1846 |
+
<dim>4096</dim>
|
| 1847 |
+
</port>
|
| 1848 |
+
<port id="1" precision="FP32">
|
| 1849 |
+
<dim>1</dim>
|
| 1850 |
+
<dim>1</dim>
|
| 1851 |
+
<dim>4096</dim>
|
| 1852 |
+
</port>
|
| 1853 |
+
</input>
|
| 1854 |
+
<output>
|
| 1855 |
+
<port id="2" precision="FP32" names="142,x">
|
| 1856 |
+
<dim>-1</dim>
|
| 1857 |
+
<dim>64</dim>
|
| 1858 |
+
<dim>4096</dim>
|
| 1859 |
+
</port>
|
| 1860 |
+
</output>
|
| 1861 |
+
</layer>
|
| 1862 |
+
<layer id="126" name="Transpose_8070" type="Const" version="opset1">
|
| 1863 |
+
<data element_type="u8" shape="4096, 4096" offset="46569724" size="16777216" />
|
| 1864 |
+
<output>
|
| 1865 |
+
<port id="0" precision="U8">
|
| 1866 |
+
<dim>4096</dim>
|
| 1867 |
+
<dim>4096</dim>
|
| 1868 |
+
</port>
|
| 1869 |
+
</output>
|
| 1870 |
+
</layer>
|
| 1871 |
+
<layer id="127" name="Convert_193690" type="Convert" version="opset1">
|
| 1872 |
+
<data destination_type="f16" />
|
| 1873 |
+
<input>
|
| 1874 |
+
<port id="0" precision="U8">
|
| 1875 |
+
<dim>4096</dim>
|
| 1876 |
+
<dim>4096</dim>
|
| 1877 |
+
</port>
|
| 1878 |
+
</input>
|
| 1879 |
+
<output>
|
| 1880 |
+
<port id="1" precision="FP16">
|
| 1881 |
+
<dim>4096</dim>
|
| 1882 |
+
<dim>4096</dim>
|
| 1883 |
+
</port>
|
| 1884 |
+
</output>
|
| 1885 |
+
</layer>
|
| 1886 |
+
<layer id="128" name="Transpose_8070/zero_point" type="Const" version="opset1">
|
| 1887 |
+
<data element_type="u8" shape="4096, 1" offset="63346940" size="4096" />
|
| 1888 |
+
<output>
|
| 1889 |
+
<port id="0" precision="U8">
|
| 1890 |
+
<dim>4096</dim>
|
| 1891 |
+
<dim>1</dim>
|
| 1892 |
+
</port>
|
| 1893 |
+
</output>
|
| 1894 |
+
</layer>
|
| 1895 |
+
<layer id="129" name="Convert_193693" type="Convert" version="opset1">
|
| 1896 |
+
<data destination_type="f16" />
|
| 1897 |
+
<input>
|
| 1898 |
+
<port id="0" precision="U8">
|
| 1899 |
+
<dim>4096</dim>
|
| 1900 |
+
<dim>1</dim>
|
| 1901 |
+
</port>
|
| 1902 |
+
</input>
|
| 1903 |
+
<output>
|
| 1904 |
+
<port id="1" precision="FP16">
|
| 1905 |
+
<dim>4096</dim>
|
| 1906 |
+
<dim>1</dim>
|
| 1907 |
+
</port>
|
| 1908 |
+
</output>
|
| 1909 |
+
</layer>
|
| 1910 |
+
<layer id="130" name="Transpose_8070/zero_point/subtract" type="Subtract" version="opset1">
|
| 1911 |
+
<data auto_broadcast="numpy" />
|
| 1912 |
+
<input>
|
| 1913 |
+
<port id="0" precision="FP16">
|
| 1914 |
+
<dim>4096</dim>
|
| 1915 |
+
<dim>4096</dim>
|
| 1916 |
+
</port>
|
| 1917 |
+
<port id="1" precision="FP16">
|
| 1918 |
+
<dim>4096</dim>
|
| 1919 |
+
<dim>1</dim>
|
| 1920 |
+
</port>
|
| 1921 |
+
</input>
|
| 1922 |
+
<output>
|
| 1923 |
+
<port id="2" precision="FP16">
|
| 1924 |
+
<dim>4096</dim>
|
| 1925 |
+
<dim>4096</dim>
|
| 1926 |
+
</port>
|
| 1927 |
+
</output>
|
| 1928 |
+
</layer>
|
| 1929 |
+
<layer id="131" name="Transpose_8070/scale" type="Const" version="opset1">
|
| 1930 |
+
<data element_type="f16" shape="4096, 1" offset="63351036" size="8192" />
|
| 1931 |
+
<output>
|
| 1932 |
+
<port id="0" precision="FP16">
|
| 1933 |
+
<dim>4096</dim>
|
| 1934 |
+
<dim>1</dim>
|
| 1935 |
+
</port>
|
| 1936 |
+
</output>
|
| 1937 |
+
</layer>
|
| 1938 |
+
<layer id="132" name="Transpose_8070/fq_weights_1" type="Multiply" version="opset1">
|
| 1939 |
+
<data auto_broadcast="numpy" />
|
| 1940 |
+
<input>
|
| 1941 |
+
<port id="0" precision="FP16">
|
| 1942 |
+
<dim>4096</dim>
|
| 1943 |
+
<dim>4096</dim>
|
| 1944 |
+
</port>
|
| 1945 |
+
<port id="1" precision="FP16">
|
| 1946 |
+
<dim>4096</dim>
|
| 1947 |
+
<dim>1</dim>
|
| 1948 |
+
</port>
|
| 1949 |
+
</input>
|
| 1950 |
+
<output>
|
| 1951 |
+
<port id="2" precision="FP16">
|
| 1952 |
+
<dim>4096</dim>
|
| 1953 |
+
<dim>4096</dim>
|
| 1954 |
+
</port>
|
| 1955 |
+
</output>
|
| 1956 |
+
</layer>
|
| 1957 |
+
<layer id="133" name="Transpose_8070/fq_weights_1/convert" type="Convert" version="opset1">
|
| 1958 |
+
<data destination_type="f32" />
|
| 1959 |
+
<input>
|
| 1960 |
+
<port id="0" precision="FP16">
|
| 1961 |
+
<dim>4096</dim>
|
| 1962 |
+
<dim>4096</dim>
|
| 1963 |
+
</port>
|
| 1964 |
+
</input>
|
| 1965 |
+
<output>
|
| 1966 |
+
<port id="1" precision="FP32">
|
| 1967 |
+
<dim>4096</dim>
|
| 1968 |
+
<dim>4096</dim>
|
| 1969 |
+
</port>
|
| 1970 |
+
</output>
|
| 1971 |
+
</layer>
|
| 1972 |
+
<layer id="134" name="aten::matmul/MatMul" type="MatMul" version="opset1">
|
| 1973 |
+
<data transpose_a="false" transpose_b="true" />
|
| 1974 |
+
<input>
|
| 1975 |
+
<port id="0" precision="FP32">
|
| 1976 |
+
<dim>-1</dim>
|
| 1977 |
+
<dim>64</dim>
|
| 1978 |
+
<dim>4096</dim>
|
| 1979 |
+
</port>
|
| 1980 |
+
<port id="1" precision="FP32">
|
| 1981 |
+
<dim>4096</dim>
|
| 1982 |
+
<dim>4096</dim>
|
| 1983 |
+
</port>
|
| 1984 |
+
</input>
|
| 1985 |
+
<output>
|
| 1986 |
+
<port id="2" precision="FP32" names="last_hidden_state">
|
| 1987 |
+
<dim>-1</dim>
|
| 1988 |
+
<dim>64</dim>
|
| 1989 |
+
<dim>4096</dim>
|
| 1990 |
+
</port>
|
| 1991 |
+
</output>
|
| 1992 |
+
</layer>
|
| 1993 |
+
<layer id="135" name="Result_546" type="Result" version="opset1" output_names="last_hidden_state">
|
| 1994 |
+
<input>
|
| 1995 |
+
<port id="0" precision="FP32">
|
| 1996 |
+
<dim>-1</dim>
|
| 1997 |
+
<dim>64</dim>
|
| 1998 |
+
<dim>4096</dim>
|
| 1999 |
+
</port>
|
| 2000 |
+
</input>
|
| 2001 |
+
</layer>
|
| 2002 |
+
</layers>
|
| 2003 |
+
<edges>
|
| 2004 |
+
<edge from-layer="0" from-port="0" to-layer="53" to-port="0" />
|
| 2005 |
+
<edge from-layer="0" from-port="0" to-layer="7" to-port="0" />
|
| 2006 |
+
<edge from-layer="1" from-port="0" to-layer="62" to-port="1" />
|
| 2007 |
+
<edge from-layer="2" from-port="0" to-layer="4" to-port="0" />
|
| 2008 |
+
<edge from-layer="3" from-port="0" to-layer="4" to-port="1" />
|
| 2009 |
+
<edge from-layer="4" from-port="2" to-layer="6" to-port="0" />
|
| 2010 |
+
<edge from-layer="5" from-port="0" to-layer="6" to-port="1" />
|
| 2011 |
+
<edge from-layer="6" from-port="2" to-layer="18" to-port="0" />
|
| 2012 |
+
<edge from-layer="7" from-port="1" to-layer="10" to-port="0" />
|
| 2013 |
+
<edge from-layer="7" from-port="1" to-layer="16" to-port="0" />
|
| 2014 |
+
<edge from-layer="8" from-port="0" to-layer="10" to-port="1" />
|
| 2015 |
+
<edge from-layer="9" from-port="0" to-layer="10" to-port="2" />
|
| 2016 |
+
<edge from-layer="10" from-port="3" to-layer="12" to-port="0" />
|
| 2017 |
+
<edge from-layer="10" from-port="3" to-layer="22" to-port="1" />
|
| 2018 |
+
<edge from-layer="11" from-port="0" to-layer="12" to-port="1" />
|
| 2019 |
+
<edge from-layer="12" from-port="2" to-layer="17" to-port="0" />
|
| 2020 |
+
<edge from-layer="13" from-port="0" to-layer="17" to-port="1" />
|
| 2021 |
+
<edge from-layer="14" from-port="0" to-layer="16" to-port="1" />
|
| 2022 |
+
<edge from-layer="15" from-port="0" to-layer="16" to-port="2" />
|
| 2023 |
+
<edge from-layer="16" from-port="3" to-layer="17" to-port="2" />
|
| 2024 |
+
<edge from-layer="17" from-port="3" to-layer="18" to-port="1" />
|
| 2025 |
+
<edge from-layer="18" from-port="2" to-layer="81" to-port="0" />
|
| 2026 |
+
<edge from-layer="19" from-port="0" to-layer="23" to-port="0" />
|
| 2027 |
+
<edge from-layer="20" from-port="0" to-layer="22" to-port="0" />
|
| 2028 |
+
<edge from-layer="21" from-port="0" to-layer="22" to-port="2" />
|
| 2029 |
+
<edge from-layer="22" from-port="3" to-layer="23" to-port="1" />
|
| 2030 |
+
<edge from-layer="23" from-port="2" to-layer="34" to-port="0" />
|
| 2031 |
+
<edge from-layer="24" from-port="0" to-layer="25" to-port="0" />
|
| 2032 |
+
<edge from-layer="25" from-port="1" to-layer="28" to-port="0" />
|
| 2033 |
+
<edge from-layer="26" from-port="0" to-layer="27" to-port="0" />
|
| 2034 |
+
<edge from-layer="27" from-port="1" to-layer="28" to-port="1" />
|
| 2035 |
+
<edge from-layer="28" from-port="2" to-layer="30" to-port="0" />
|
| 2036 |
+
<edge from-layer="29" from-port="0" to-layer="30" to-port="1" />
|
| 2037 |
+
<edge from-layer="30" from-port="2" to-layer="32" to-port="0" />
|
| 2038 |
+
<edge from-layer="31" from-port="0" to-layer="32" to-port="1" />
|
| 2039 |
+
<edge from-layer="32" from-port="2" to-layer="33" to-port="0" />
|
| 2040 |
+
<edge from-layer="33" from-port="1" to-layer="34" to-port="1" />
|
| 2041 |
+
<edge from-layer="34" from-port="2" to-layer="36" to-port="0" />
|
| 2042 |
+
<edge from-layer="35" from-port="0" to-layer="36" to-port="1" />
|
| 2043 |
+
<edge from-layer="36" from-port="2" to-layer="38" to-port="0" />
|
| 2044 |
+
<edge from-layer="37" from-port="0" to-layer="38" to-port="1" />
|
| 2045 |
+
<edge from-layer="38" from-port="2" to-layer="40" to-port="0" />
|
| 2046 |
+
<edge from-layer="39" from-port="0" to-layer="40" to-port="1" />
|
| 2047 |
+
<edge from-layer="40" from-port="2" to-layer="42" to-port="0" />
|
| 2048 |
+
<edge from-layer="41" from-port="0" to-layer="42" to-port="1" />
|
| 2049 |
+
<edge from-layer="42" from-port="2" to-layer="80" to-port="0" />
|
| 2050 |
+
<edge from-layer="43" from-port="0" to-layer="44" to-port="0" />
|
| 2051 |
+
<edge from-layer="44" from-port="1" to-layer="47" to-port="0" />
|
| 2052 |
+
<edge from-layer="45" from-port="0" to-layer="46" to-port="0" />
|
| 2053 |
+
<edge from-layer="46" from-port="1" to-layer="47" to-port="1" />
|
| 2054 |
+
<edge from-layer="47" from-port="2" to-layer="49" to-port="0" />
|
| 2055 |
+
<edge from-layer="48" from-port="0" to-layer="49" to-port="1" />
|
| 2056 |
+
<edge from-layer="49" from-port="2" to-layer="51" to-port="0" />
|
| 2057 |
+
<edge from-layer="50" from-port="0" to-layer="51" to-port="1" />
|
| 2058 |
+
<edge from-layer="51" from-port="2" to-layer="52" to-port="0" />
|
| 2059 |
+
<edge from-layer="52" from-port="1" to-layer="53" to-port="1" />
|
| 2060 |
+
<edge from-layer="53" from-port="2" to-layer="55" to-port="0" />
|
| 2061 |
+
<edge from-layer="54" from-port="0" to-layer="55" to-port="1" />
|
| 2062 |
+
<edge from-layer="55" from-port="2" to-layer="57" to-port="0" />
|
| 2063 |
+
<edge from-layer="56" from-port="0" to-layer="57" to-port="1" />
|
| 2064 |
+
<edge from-layer="57" from-port="2" to-layer="59" to-port="0" />
|
| 2065 |
+
<edge from-layer="58" from-port="0" to-layer="59" to-port="1" />
|
| 2066 |
+
<edge from-layer="59" from-port="2" to-layer="61" to-port="0" />
|
| 2067 |
+
<edge from-layer="60" from-port="0" to-layer="61" to-port="1" />
|
| 2068 |
+
<edge from-layer="61" from-port="2" to-layer="62" to-port="0" />
|
| 2069 |
+
<edge from-layer="61" from-port="2" to-layer="91" to-port="0" />
|
| 2070 |
+
<edge from-layer="62" from-port="2" to-layer="73" to-port="0" />
|
| 2071 |
+
<edge from-layer="63" from-port="0" to-layer="64" to-port="0" />
|
| 2072 |
+
<edge from-layer="64" from-port="1" to-layer="67" to-port="0" />
|
| 2073 |
+
<edge from-layer="65" from-port="0" to-layer="66" to-port="0" />
|
| 2074 |
+
<edge from-layer="66" from-port="1" to-layer="67" to-port="1" />
|
| 2075 |
+
<edge from-layer="67" from-port="2" to-layer="69" to-port="0" />
|
| 2076 |
+
<edge from-layer="68" from-port="0" to-layer="69" to-port="1" />
|
| 2077 |
+
<edge from-layer="69" from-port="2" to-layer="71" to-port="0" />
|
| 2078 |
+
<edge from-layer="70" from-port="0" to-layer="71" to-port="1" />
|
| 2079 |
+
<edge from-layer="71" from-port="2" to-layer="72" to-port="0" />
|
| 2080 |
+
<edge from-layer="72" from-port="1" to-layer="73" to-port="1" />
|
| 2081 |
+
<edge from-layer="73" from-port="2" to-layer="75" to-port="0" />
|
| 2082 |
+
<edge from-layer="74" from-port="0" to-layer="75" to-port="1" />
|
| 2083 |
+
<edge from-layer="75" from-port="2" to-layer="77" to-port="0" />
|
| 2084 |
+
<edge from-layer="76" from-port="0" to-layer="77" to-port="1" />
|
| 2085 |
+
<edge from-layer="77" from-port="2" to-layer="79" to-port="0" />
|
| 2086 |
+
<edge from-layer="78" from-port="0" to-layer="79" to-port="1" />
|
| 2087 |
+
<edge from-layer="79" from-port="2" to-layer="80" to-port="1" />
|
| 2088 |
+
<edge from-layer="80" from-port="2" to-layer="81" to-port="1" />
|
| 2089 |
+
<edge from-layer="81" from-port="2" to-layer="82" to-port="0" />
|
| 2090 |
+
<edge from-layer="82" from-port="1" to-layer="98" to-port="0" />
|
| 2091 |
+
<edge from-layer="83" from-port="0" to-layer="84" to-port="0" />
|
| 2092 |
+
<edge from-layer="84" from-port="1" to-layer="87" to-port="0" />
|
| 2093 |
+
<edge from-layer="85" from-port="0" to-layer="86" to-port="0" />
|
| 2094 |
+
<edge from-layer="86" from-port="1" to-layer="87" to-port="1" />
|
| 2095 |
+
<edge from-layer="87" from-port="2" to-layer="89" to-port="0" />
|
| 2096 |
+
<edge from-layer="88" from-port="0" to-layer="89" to-port="1" />
|
| 2097 |
+
<edge from-layer="89" from-port="2" to-layer="90" to-port="0" />
|
| 2098 |
+
<edge from-layer="90" from-port="1" to-layer="91" to-port="1" />
|
| 2099 |
+
<edge from-layer="91" from-port="2" to-layer="93" to-port="0" />
|
| 2100 |
+
<edge from-layer="92" from-port="0" to-layer="93" to-port="1" />
|
| 2101 |
+
<edge from-layer="93" from-port="2" to-layer="95" to-port="0" />
|
| 2102 |
+
<edge from-layer="94" from-port="0" to-layer="95" to-port="1" />
|
| 2103 |
+
<edge from-layer="95" from-port="2" to-layer="97" to-port="0" />
|
| 2104 |
+
<edge from-layer="96" from-port="0" to-layer="97" to-port="1" />
|
| 2105 |
+
<edge from-layer="97" from-port="2" to-layer="98" to-port="1" />
|
| 2106 |
+
<edge from-layer="98" from-port="2" to-layer="100" to-port="0" />
|
| 2107 |
+
<edge from-layer="99" from-port="0" to-layer="100" to-port="1" />
|
| 2108 |
+
<edge from-layer="100" from-port="2" to-layer="102" to-port="0" />
|
| 2109 |
+
<edge from-layer="101" from-port="0" to-layer="102" to-port="1" />
|
| 2110 |
+
<edge from-layer="102" from-port="2" to-layer="113" to-port="0" />
|
| 2111 |
+
<edge from-layer="103" from-port="0" to-layer="104" to-port="0" />
|
| 2112 |
+
<edge from-layer="104" from-port="1" to-layer="107" to-port="0" />
|
| 2113 |
+
<edge from-layer="105" from-port="0" to-layer="106" to-port="0" />
|
| 2114 |
+
<edge from-layer="106" from-port="1" to-layer="107" to-port="1" />
|
| 2115 |
+
<edge from-layer="107" from-port="2" to-layer="109" to-port="0" />
|
| 2116 |
+
<edge from-layer="108" from-port="0" to-layer="109" to-port="1" />
|
| 2117 |
+
<edge from-layer="109" from-port="2" to-layer="111" to-port="0" />
|
| 2118 |
+
<edge from-layer="110" from-port="0" to-layer="111" to-port="1" />
|
| 2119 |
+
<edge from-layer="111" from-port="2" to-layer="112" to-port="0" />
|
| 2120 |
+
<edge from-layer="112" from-port="1" to-layer="113" to-port="1" />
|
| 2121 |
+
<edge from-layer="113" from-port="2" to-layer="115" to-port="0" />
|
| 2122 |
+
<edge from-layer="114" from-port="0" to-layer="115" to-port="1" />
|
| 2123 |
+
<edge from-layer="115" from-port="2" to-layer="117" to-port="0" />
|
| 2124 |
+
<edge from-layer="116" from-port="0" to-layer="117" to-port="1" />
|
| 2125 |
+
<edge from-layer="117" from-port="2" to-layer="119" to-port="0" />
|
| 2126 |
+
<edge from-layer="118" from-port="0" to-layer="119" to-port="1" />
|
| 2127 |
+
<edge from-layer="119" from-port="2" to-layer="121" to-port="0" />
|
| 2128 |
+
<edge from-layer="120" from-port="0" to-layer="121" to-port="1" />
|
| 2129 |
+
<edge from-layer="121" from-port="2" to-layer="123" to-port="0" />
|
| 2130 |
+
<edge from-layer="122" from-port="0" to-layer="123" to-port="1" />
|
| 2131 |
+
<edge from-layer="123" from-port="2" to-layer="125" to-port="0" />
|
| 2132 |
+
<edge from-layer="124" from-port="0" to-layer="125" to-port="1" />
|
| 2133 |
+
<edge from-layer="125" from-port="2" to-layer="134" to-port="0" />
|
| 2134 |
+
<edge from-layer="126" from-port="0" to-layer="127" to-port="0" />
|
| 2135 |
+
<edge from-layer="127" from-port="1" to-layer="130" to-port="0" />
|
| 2136 |
+
<edge from-layer="128" from-port="0" to-layer="129" to-port="0" />
|
| 2137 |
+
<edge from-layer="129" from-port="1" to-layer="130" to-port="1" />
|
| 2138 |
+
<edge from-layer="130" from-port="2" to-layer="132" to-port="0" />
|
| 2139 |
+
<edge from-layer="131" from-port="0" to-layer="132" to-port="1" />
|
| 2140 |
+
<edge from-layer="132" from-port="2" to-layer="133" to-port="0" />
|
| 2141 |
+
<edge from-layer="133" from-port="1" to-layer="134" to-port="1" />
|
| 2142 |
+
<edge from-layer="134" from-port="2" to-layer="135" to-port="0" />
|
| 2143 |
+
</edges>
|
| 2144 |
+
<rt_info>
|
| 2145 |
+
<Runtime_version value="2026.0.0-20965-c6d6a13a886-releases/2026/0" />
|
| 2146 |
+
<conversion_parameters>
|
| 2147 |
+
<framework value="pytorch" />
|
| 2148 |
+
<is_python_object value="True" />
|
| 2149 |
+
</conversion_parameters>
|
| 2150 |
+
<nncf>
|
| 2151 |
+
<friendly_names_were_updated value="True" />
|
| 2152 |
+
<version value="3.1.0" />
|
| 2153 |
+
<weight_compression>
|
| 2154 |
+
<advanced_parameters value="{'statistics_path': None, 'lora_adapter_rank': 256, 'group_size_fallback_mode': 'error', 'min_adjusted_group_size': 32, 'awq_params': {'subset_size': 32, 'percent_to_apply': 0.002, 'alpha_min': 0.0, 'alpha_max': 1.0, 'steps': 100, 'prefer_data_aware_scaling': True}, 'scale_estimation_params': {'subset_size': 64, 'initial_steps': 5, 'scale_steps': 5, 'weight_penalty': -1.0}, 'gptq_params': {'damp_percent': 0.1, 'block_size': 128, 'subset_size': 128}, 'lora_correction_params': {'adapter_rank': 8, 'num_iterations': 3, 'apply_regularization': True, 'subset_size': 128, 'use_int8_adapters': True}, 'backend_params': {}, 'codebook': None, 'adaptive_codebook_params': {'value_type': 'f8e4m3', 'across_blocks': False, 'num_elements': 16}}" />
|
| 2155 |
+
<all_layers value="False" />
|
| 2156 |
+
<awq value="False" />
|
| 2157 |
+
<backup_mode value="int8_asym" />
|
| 2158 |
+
<compression_format value="dequantize" />
|
| 2159 |
+
<gptq value="False" />
|
| 2160 |
+
<group_size value="128" />
|
| 2161 |
+
<ignored_scope>
|
| 2162 |
+
<patterns value="['.*encoder\\.layers\\..*\\.mlp\\.fc2.*']" />
|
| 2163 |
+
</ignored_scope>
|
| 2164 |
+
<lora_correction value="False" />
|
| 2165 |
+
<mode value="int4_asym" />
|
| 2166 |
+
<ratio value="0.8" />
|
| 2167 |
+
<scale_estimation value="False" />
|
| 2168 |
+
<sensitivity_metric value="weight_quantization_error" />
|
| 2169 |
+
</weight_compression>
|
| 2170 |
+
</nncf>
|
| 2171 |
+
<optimum>
|
| 2172 |
+
<nncf_version value="3.1.0.dev0+8d97fed5" />
|
| 2173 |
+
<optimum_intel_version value="1.26.0.dev0+81f69be" />
|
| 2174 |
+
<optimum_version value="2.0.0.dev0" />
|
| 2175 |
+
<pytorch_version value="2.8.0+cpu" />
|
| 2176 |
+
<transformers_version value="4.53.3" />
|
| 2177 |
+
</optimum>
|
| 2178 |
+
</rt_info>
|
| 2179 |
+
</net>
|
openvino_text_embeddings_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7dd053ed05893dde9fd11eb10b1f4d8c01bc570e227ec505cc5b79374f014d86
|
| 3 |
+
size 622015056
|
openvino_text_embeddings_model.xml
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<net name="Model9" version="11">
|
| 3 |
+
<layers>
|
| 4 |
+
<layer id="0" name="input" type="Parameter" version="opset1">
|
| 5 |
+
<data shape="?,?" element_type="i64" />
|
| 6 |
+
<output>
|
| 7 |
+
<port id="0" precision="I64" names="input">
|
| 8 |
+
<dim>-1</dim>
|
| 9 |
+
<dim>-1</dim>
|
| 10 |
+
</port>
|
| 11 |
+
</output>
|
| 12 |
+
</layer>
|
| 13 |
+
<layer id="1" name="self.weight" type="Const" version="opset1">
|
| 14 |
+
<data element_type="u8" shape="151748, 4096" offset="0" size="621559808" />
|
| 15 |
+
<output>
|
| 16 |
+
<port id="0" precision="U8">
|
| 17 |
+
<dim>151748</dim>
|
| 18 |
+
<dim>4096</dim>
|
| 19 |
+
</port>
|
| 20 |
+
</output>
|
| 21 |
+
</layer>
|
| 22 |
+
<layer id="2" name="Convert_2239966" type="Convert" version="opset1">
|
| 23 |
+
<data destination_type="f16" />
|
| 24 |
+
<input>
|
| 25 |
+
<port id="0" precision="U8">
|
| 26 |
+
<dim>151748</dim>
|
| 27 |
+
<dim>4096</dim>
|
| 28 |
+
</port>
|
| 29 |
+
</input>
|
| 30 |
+
<output>
|
| 31 |
+
<port id="1" precision="FP16">
|
| 32 |
+
<dim>151748</dim>
|
| 33 |
+
<dim>4096</dim>
|
| 34 |
+
</port>
|
| 35 |
+
</output>
|
| 36 |
+
</layer>
|
| 37 |
+
<layer id="3" name="self.weight/zero_point" type="Const" version="opset1">
|
| 38 |
+
<data element_type="u8" shape="151748, 1" offset="621559808" size="151748" />
|
| 39 |
+
<output>
|
| 40 |
+
<port id="0" precision="U8">
|
| 41 |
+
<dim>151748</dim>
|
| 42 |
+
<dim>1</dim>
|
| 43 |
+
</port>
|
| 44 |
+
</output>
|
| 45 |
+
</layer>
|
| 46 |
+
<layer id="4" name="Convert_2239969" type="Convert" version="opset1">
|
| 47 |
+
<data destination_type="f16" />
|
| 48 |
+
<input>
|
| 49 |
+
<port id="0" precision="U8">
|
| 50 |
+
<dim>151748</dim>
|
| 51 |
+
<dim>1</dim>
|
| 52 |
+
</port>
|
| 53 |
+
</input>
|
| 54 |
+
<output>
|
| 55 |
+
<port id="1" precision="FP16">
|
| 56 |
+
<dim>151748</dim>
|
| 57 |
+
<dim>1</dim>
|
| 58 |
+
</port>
|
| 59 |
+
</output>
|
| 60 |
+
</layer>
|
| 61 |
+
<layer id="5" name="self.weight/zero_point/subtract" type="Subtract" version="opset1">
|
| 62 |
+
<data auto_broadcast="numpy" />
|
| 63 |
+
<input>
|
| 64 |
+
<port id="0" precision="FP16">
|
| 65 |
+
<dim>151748</dim>
|
| 66 |
+
<dim>4096</dim>
|
| 67 |
+
</port>
|
| 68 |
+
<port id="1" precision="FP16">
|
| 69 |
+
<dim>151748</dim>
|
| 70 |
+
<dim>1</dim>
|
| 71 |
+
</port>
|
| 72 |
+
</input>
|
| 73 |
+
<output>
|
| 74 |
+
<port id="2" precision="FP16">
|
| 75 |
+
<dim>151748</dim>
|
| 76 |
+
<dim>4096</dim>
|
| 77 |
+
</port>
|
| 78 |
+
</output>
|
| 79 |
+
</layer>
|
| 80 |
+
<layer id="6" name="self.weight/scale" type="Const" version="opset1">
|
| 81 |
+
<data element_type="f16" shape="151748, 1" offset="621711556" size="303496" />
|
| 82 |
+
<output>
|
| 83 |
+
<port id="0" precision="FP16">
|
| 84 |
+
<dim>151748</dim>
|
| 85 |
+
<dim>1</dim>
|
| 86 |
+
</port>
|
| 87 |
+
</output>
|
| 88 |
+
</layer>
|
| 89 |
+
<layer id="7" name="self.weight/fq_weights_0" type="Multiply" version="opset1">
|
| 90 |
+
<data auto_broadcast="numpy" />
|
| 91 |
+
<input>
|
| 92 |
+
<port id="0" precision="FP16">
|
| 93 |
+
<dim>151748</dim>
|
| 94 |
+
<dim>4096</dim>
|
| 95 |
+
</port>
|
| 96 |
+
<port id="1" precision="FP16">
|
| 97 |
+
<dim>151748</dim>
|
| 98 |
+
<dim>1</dim>
|
| 99 |
+
</port>
|
| 100 |
+
</input>
|
| 101 |
+
<output>
|
| 102 |
+
<port id="2" precision="FP16">
|
| 103 |
+
<dim>151748</dim>
|
| 104 |
+
<dim>4096</dim>
|
| 105 |
+
</port>
|
| 106 |
+
</output>
|
| 107 |
+
</layer>
|
| 108 |
+
<layer id="8" name="ov_ext::embedding/Convert" type="Convert" version="opset1">
|
| 109 |
+
<data destination_type="f32" />
|
| 110 |
+
<rt_info>
|
| 111 |
+
<attribute name="decompression" version="0" />
|
| 112 |
+
</rt_info>
|
| 113 |
+
<input>
|
| 114 |
+
<port id="0" precision="FP16">
|
| 115 |
+
<dim>151748</dim>
|
| 116 |
+
<dim>4096</dim>
|
| 117 |
+
</port>
|
| 118 |
+
</input>
|
| 119 |
+
<output>
|
| 120 |
+
<port id="1" precision="FP32">
|
| 121 |
+
<dim>151748</dim>
|
| 122 |
+
<dim>4096</dim>
|
| 123 |
+
</port>
|
| 124 |
+
</output>
|
| 125 |
+
</layer>
|
| 126 |
+
<layer id="9" name="ov_ext::embedding/Convert_1" type="Convert" version="opset1">
|
| 127 |
+
<data destination_type="i32" />
|
| 128 |
+
<input>
|
| 129 |
+
<port id="0" precision="I64">
|
| 130 |
+
<dim>-1</dim>
|
| 131 |
+
<dim>-1</dim>
|
| 132 |
+
</port>
|
| 133 |
+
</input>
|
| 134 |
+
<output>
|
| 135 |
+
<port id="1" precision="I32">
|
| 136 |
+
<dim>-1</dim>
|
| 137 |
+
<dim>-1</dim>
|
| 138 |
+
</port>
|
| 139 |
+
</output>
|
| 140 |
+
</layer>
|
| 141 |
+
<layer id="10" name="ov_ext::embedding/Constant" type="Const" version="opset1">
|
| 142 |
+
<data element_type="i32" shape="" offset="622015052" size="4" />
|
| 143 |
+
<output>
|
| 144 |
+
<port id="0" precision="I32" />
|
| 145 |
+
</output>
|
| 146 |
+
</layer>
|
| 147 |
+
<layer id="11" name="ov_ext::embedding/Gather" type="Gather" version="opset8">
|
| 148 |
+
<data batch_dims="0" />
|
| 149 |
+
<input>
|
| 150 |
+
<port id="0" precision="FP32">
|
| 151 |
+
<dim>151748</dim>
|
| 152 |
+
<dim>4096</dim>
|
| 153 |
+
</port>
|
| 154 |
+
<port id="1" precision="I32">
|
| 155 |
+
<dim>-1</dim>
|
| 156 |
+
<dim>-1</dim>
|
| 157 |
+
</port>
|
| 158 |
+
<port id="2" precision="I32" />
|
| 159 |
+
</input>
|
| 160 |
+
<output>
|
| 161 |
+
<port id="3" precision="FP32" names="inputs_embeds">
|
| 162 |
+
<dim>-1</dim>
|
| 163 |
+
<dim>-1</dim>
|
| 164 |
+
<dim>4096</dim>
|
| 165 |
+
</port>
|
| 166 |
+
</output>
|
| 167 |
+
</layer>
|
| 168 |
+
<layer id="12" name="Result_154583" type="Result" version="opset1" output_names="inputs_embeds">
|
| 169 |
+
<input>
|
| 170 |
+
<port id="0" precision="FP32">
|
| 171 |
+
<dim>-1</dim>
|
| 172 |
+
<dim>-1</dim>
|
| 173 |
+
<dim>4096</dim>
|
| 174 |
+
</port>
|
| 175 |
+
</input>
|
| 176 |
+
</layer>
|
| 177 |
+
</layers>
|
| 178 |
+
<edges>
|
| 179 |
+
<edge from-layer="0" from-port="0" to-layer="9" to-port="0" />
|
| 180 |
+
<edge from-layer="1" from-port="0" to-layer="2" to-port="0" />
|
| 181 |
+
<edge from-layer="2" from-port="1" to-layer="5" to-port="0" />
|
| 182 |
+
<edge from-layer="3" from-port="0" to-layer="4" to-port="0" />
|
| 183 |
+
<edge from-layer="4" from-port="1" to-layer="5" to-port="1" />
|
| 184 |
+
<edge from-layer="5" from-port="2" to-layer="7" to-port="0" />
|
| 185 |
+
<edge from-layer="6" from-port="0" to-layer="7" to-port="1" />
|
| 186 |
+
<edge from-layer="7" from-port="2" to-layer="8" to-port="0" />
|
| 187 |
+
<edge from-layer="8" from-port="1" to-layer="11" to-port="0" />
|
| 188 |
+
<edge from-layer="9" from-port="1" to-layer="11" to-port="1" />
|
| 189 |
+
<edge from-layer="10" from-port="0" to-layer="11" to-port="2" />
|
| 190 |
+
<edge from-layer="11" from-port="3" to-layer="12" to-port="0" />
|
| 191 |
+
</edges>
|
| 192 |
+
<rt_info>
|
| 193 |
+
<Runtime_version value="2026.0.0-20965-c6d6a13a886-releases/2026/0" />
|
| 194 |
+
<conversion_parameters>
|
| 195 |
+
<framework value="pytorch" />
|
| 196 |
+
<is_python_object value="True" />
|
| 197 |
+
</conversion_parameters>
|
| 198 |
+
<nncf>
|
| 199 |
+
<friendly_names_were_updated value="True" />
|
| 200 |
+
<version value="3.1.0" />
|
| 201 |
+
<weight_compression>
|
| 202 |
+
<advanced_parameters value="{'statistics_path': None, 'lora_adapter_rank': 256, 'group_size_fallback_mode': 'error', 'min_adjusted_group_size': 32, 'awq_params': {'subset_size': 32, 'percent_to_apply': 0.002, 'alpha_min': 0.0, 'alpha_max': 1.0, 'steps': 100, 'prefer_data_aware_scaling': True}, 'scale_estimation_params': {'subset_size': 64, 'initial_steps': 5, 'scale_steps': 5, 'weight_penalty': -1.0}, 'gptq_params': {'damp_percent': 0.1, 'block_size': 128, 'subset_size': 128}, 'lora_correction_params': {'adapter_rank': 8, 'num_iterations': 3, 'apply_regularization': True, 'subset_size': 128, 'use_int8_adapters': True}, 'backend_params': {}, 'codebook': None, 'adaptive_codebook_params': {'value_type': 'f8e4m3', 'across_blocks': False, 'num_elements': 16}}" />
|
| 203 |
+
<all_layers value="False" />
|
| 204 |
+
<awq value="False" />
|
| 205 |
+
<backup_mode value="int8_asym" />
|
| 206 |
+
<compression_format value="dequantize" />
|
| 207 |
+
<gptq value="False" />
|
| 208 |
+
<group_size value="128" />
|
| 209 |
+
<ignored_scope>
|
| 210 |
+
<patterns value="['.*encoder\\.layers\\..*\\.mlp\\.fc2.*']" />
|
| 211 |
+
</ignored_scope>
|
| 212 |
+
<lora_correction value="False" />
|
| 213 |
+
<mode value="int4_asym" />
|
| 214 |
+
<ratio value="0.8" />
|
| 215 |
+
<scale_estimation value="False" />
|
| 216 |
+
<sensitivity_metric value="weight_quantization_error" />
|
| 217 |
+
</weight_compression>
|
| 218 |
+
</nncf>
|
| 219 |
+
<optimum>
|
| 220 |
+
<nncf_version value="3.1.0.dev0+8d97fed5" />
|
| 221 |
+
<optimum_intel_version value="1.26.0.dev0+81f69be" />
|
| 222 |
+
<optimum_version value="2.0.0.dev0" />
|
| 223 |
+
<pytorch_version value="2.8.0+cpu" />
|
| 224 |
+
<transformers_version value="4.53.3" />
|
| 225 |
+
</optimum>
|
| 226 |
+
</rt_info>
|
| 227 |
+
</net>
|
openvino_tokenizer.bin
ADDED
|
@@ -0,0 +1,3 @@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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
<net name="tokenizer" version="11">
|
| 3 |
+
<layers>
|
| 4 |
+
<layer id="0" name="Parameter_157023" type="Parameter" version="opset1">
|
| 5 |
+
<data shape="?" element_type="string" />
|
| 6 |
+
<output>
|
| 7 |
+
<port id="0" precision="STRING" names="Parameter_157023">
|
| 8 |
+
<dim>-1</dim>
|
| 9 |
+
</port>
|
| 10 |
+
</output>
|
| 11 |
+
</layer>
|
| 12 |
+
<layer id="1" name="Constant_157029" type="Const" version="opset1">
|
| 13 |
+
<data element_type="i64" shape="" offset="0" size="8" />
|
| 14 |
+
<output>
|
| 15 |
+
<port id="0" precision="I64" />
|
| 16 |
+
</output>
|
| 17 |
+
</layer>
|
| 18 |
+
<layer id="2" name="StringTensorUnpack_157024" type="StringTensorUnpack" version="opset15">
|
| 19 |
+
<input>
|
| 20 |
+
<port id="0" precision="STRING">
|
| 21 |
+
<dim>-1</dim>
|
| 22 |
+
</port>
|
| 23 |
+
</input>
|
| 24 |
+
<output>
|
| 25 |
+
<port id="1" precision="I32">
|
| 26 |
+
<dim>-1</dim>
|
| 27 |
+
</port>
|
| 28 |
+
<port id="2" precision="I32">
|
| 29 |
+
<dim>-1</dim>
|
| 30 |
+
</port>
|
| 31 |
+
<port id="3" precision="U8">
|
| 32 |
+
<dim>-1</dim>
|
| 33 |
+
</port>
|
| 34 |
+
</output>
|
| 35 |
+
</layer>
|
| 36 |
+
<layer id="3" name="ShapeOf_157025" type="ShapeOf" version="opset3">
|
| 37 |
+
<data output_type="i64" />
|
| 38 |
+
<input>
|
| 39 |
+
<port id="0" precision="I32">
|
| 40 |
+
<dim>-1</dim>
|
| 41 |
+
</port>
|
| 42 |
+
</input>
|
| 43 |
+
<output>
|
| 44 |
+
<port id="1" precision="I64">
|
| 45 |
+
<dim>1</dim>
|
| 46 |
+
</port>
|
| 47 |
+
</output>
|
| 48 |
+
</layer>
|
| 49 |
+
<layer id="4" name="Constant_157026" type="Const" version="opset1">
|
| 50 |
+
<data element_type="i64" shape="" offset="0" size="8" />
|
| 51 |
+
<output>
|
| 52 |
+
<port id="0" precision="I64" />
|
| 53 |
+
</output>
|
| 54 |
+
</layer>
|
| 55 |
+
<layer id="5" name="Constant_157027" type="Const" version="opset1">
|
| 56 |
+
<data element_type="i64" shape="" offset="0" size="8" />
|
| 57 |
+
<output>
|
| 58 |
+
<port id="0" precision="I64" />
|
| 59 |
+
</output>
|
| 60 |
+
</layer>
|
| 61 |
+
<layer id="6" name="Gather_157028" type="Gather" version="opset8">
|
| 62 |
+
<data batch_dims="0" />
|
| 63 |
+
<input>
|
| 64 |
+
<port id="0" precision="I64">
|
| 65 |
+
<dim>1</dim>
|
| 66 |
+
</port>
|
| 67 |
+
<port id="1" precision="I64" />
|
| 68 |
+
<port id="2" precision="I64" />
|
| 69 |
+
</input>
|
| 70 |
+
<output>
|
| 71 |
+
<port id="3" precision="I64" />
|
| 72 |
+
</output>
|
| 73 |
+
</layer>
|
| 74 |
+
<layer id="7" name="Constant_157030" type="Const" version="opset1">
|
| 75 |
+
<data element_type="i64" shape="" offset="8" size="8" />
|
| 76 |
+
<output>
|
| 77 |
+
<port id="0" precision="I64" />
|
| 78 |
+
</output>
|
| 79 |
+
</layer>
|
| 80 |
+
<layer id="8" name="Range_157031" type="Range" version="opset4">
|
| 81 |
+
<data output_type="i32" />
|
| 82 |
+
<input>
|
| 83 |
+
<port id="0" precision="I64" />
|
| 84 |
+
<port id="1" precision="I64" />
|
| 85 |
+
<port id="2" precision="I64" />
|
| 86 |
+
</input>
|
| 87 |
+
<output>
|
| 88 |
+
<port id="3" precision="I32">
|
| 89 |
+
<dim>-1</dim>
|
| 90 |
+
</port>
|
| 91 |
+
</output>
|
| 92 |
+
</layer>
|
| 93 |
+
<layer id="9" name="Constant_157032" type="Const" version="opset1">
|
| 94 |
+
<data element_type="i64" shape="" offset="8" size="8" />
|
| 95 |
+
<output>
|
| 96 |
+
<port id="0" precision="I64" />
|
| 97 |
+
</output>
|
| 98 |
+
</layer>
|
| 99 |
+
<layer id="10" name="Constant_157033" type="Const" version="opset1">
|
| 100 |
+
<data element_type="i64" shape="" offset="8" size="8" />
|
| 101 |
+
<output>
|
| 102 |
+
<port id="0" precision="I64" />
|
| 103 |
+
</output>
|
| 104 |
+
</layer>
|
| 105 |
+
<layer id="11" name="Add_157034" type="Add" version="opset1">
|
| 106 |
+
<data auto_broadcast="numpy" />
|
| 107 |
+
<input>
|
| 108 |
+
<port id="0" precision="I64" />
|
| 109 |
+
<port id="1" precision="I64" />
|
| 110 |
+
</input>
|
| 111 |
+
<output>
|
| 112 |
+
<port id="2" precision="I64" />
|
| 113 |
+
</output>
|
| 114 |
+
</layer>
|
| 115 |
+
<layer id="12" name="Constant_157035" type="Const" version="opset1">
|
| 116 |
+
<data element_type="i64" shape="" offset="8" size="8" />
|
| 117 |
+
<output>
|
| 118 |
+
<port id="0" precision="I64" />
|
| 119 |
+
</output>
|
| 120 |
+
</layer>
|
| 121 |
+
<layer id="13" name="Range_157036" type="Range" version="opset4">
|
| 122 |
+
<data output_type="i32" />
|
| 123 |
+
<input>
|
| 124 |
+
<port id="0" precision="I64" />
|
| 125 |
+
<port id="1" precision="I64" />
|
| 126 |
+
<port id="2" precision="I64" />
|
| 127 |
+
</input>
|
| 128 |
+
<output>
|
| 129 |
+
<port id="3" precision="I32">
|
| 130 |
+
<dim>-1</dim>
|
| 131 |
+
</port>
|
| 132 |
+
</output>
|
| 133 |
+
</layer>
|
| 134 |
+
<layer id="14" name="Constant_157100" type="Const" version="opset1">
|
| 135 |
+
<data element_type="u8" shape="1890" offset="16" size="1890" />
|
| 136 |
+
<output>
|
| 137 |
+
<port id="0" precision="U8">
|
| 138 |
+
<dim>1890</dim>
|
| 139 |
+
</port>
|
| 140 |
+
</output>
|
| 141 |
+
</layer>
|
| 142 |
+
<layer id="15" name="SpecialTokensSplit_157101" type="SpecialTokensSplit" version="extension">
|
| 143 |
+
<input>
|
| 144 |
+
<port id="0" precision="I32">
|
| 145 |
+
<dim>-1</dim>
|
| 146 |
+
</port>
|
| 147 |
+
<port id="1" precision="I32">
|
| 148 |
+
<dim>-1</dim>
|
| 149 |
+
</port>
|
| 150 |
+
<port id="2" precision="I32">
|
| 151 |
+
<dim>-1</dim>
|
| 152 |
+
</port>
|
| 153 |
+
<port id="3" precision="I32">
|
| 154 |
+
<dim>-1</dim>
|
| 155 |
+
</port>
|
| 156 |
+
<port id="4" precision="U8">
|
| 157 |
+
<dim>-1</dim>
|
| 158 |
+
</port>
|
| 159 |
+
<port id="5" precision="U8">
|
| 160 |
+
<dim>1890</dim>
|
| 161 |
+
</port>
|
| 162 |
+
</input>
|
| 163 |
+
<output>
|
| 164 |
+
<port id="6" precision="I32">
|
| 165 |
+
<dim>-1</dim>
|
| 166 |
+
</port>
|
| 167 |
+
<port id="7" precision="I32">
|
| 168 |
+
<dim>-1</dim>
|
| 169 |
+
</port>
|
| 170 |
+
<port id="8" precision="I32">
|
| 171 |
+
<dim>-1</dim>
|
| 172 |
+
</port>
|
| 173 |
+
<port id="9" precision="I32">
|
| 174 |
+
<dim>-1</dim>
|
| 175 |
+
</port>
|
| 176 |
+
<port id="10" precision="U8">
|
| 177 |
+
<dim>-1</dim>
|
| 178 |
+
</port>
|
| 179 |
+
<port id="11" precision="BOOL">
|
| 180 |
+
<dim>-1</dim>
|
| 181 |
+
</port>
|
| 182 |
+
</output>
|
| 183 |
+
</layer>
|
| 184 |
+
<layer id="16" name="CharsMapNormalization_157102" type="CharsMapNormalization" version="extension">
|
| 185 |
+
<data add_dummy_prefix="false" remove_extra_whitespaces="false" escape_whitespaces="false" normalization_form="nfc" case_fold="false" nmt="false" />
|
| 186 |
+
<input>
|
| 187 |
+
<port id="0" precision="I32">
|
| 188 |
+
<dim>-1</dim>
|
| 189 |
+
</port>
|
| 190 |
+
<port id="1" precision="I32">
|
| 191 |
+
<dim>-1</dim>
|
| 192 |
+
</port>
|
| 193 |
+
<port id="2" precision="U8">
|
| 194 |
+
<dim>-1</dim>
|
| 195 |
+
</port>
|
| 196 |
+
<port id="3" precision="BOOL">
|
| 197 |
+
<dim>-1</dim>
|
| 198 |
+
</port>
|
| 199 |
+
</input>
|
| 200 |
+
<output>
|
| 201 |
+
<port id="4" precision="I32">
|
| 202 |
+
<dim>-1</dim>
|
| 203 |
+
</port>
|
| 204 |
+
<port id="5" precision="I32">
|
| 205 |
+
<dim>-1</dim>
|
| 206 |
+
</port>
|
| 207 |
+
<port id="6" precision="U8">
|
| 208 |
+
<dim>-1</dim>
|
| 209 |
+
</port>
|
| 210 |
+
<port id="7" precision="BOOL">
|
| 211 |
+
<dim>-1</dim>
|
| 212 |
+
</port>
|
| 213 |
+
</output>
|
| 214 |
+
</layer>
|
| 215 |
+
<layer id="17" name="Constant_157104" type="Const" version="opset1">
|
| 216 |
+
<data element_type="u8" shape="110" offset="1906" size="110" />
|
| 217 |
+
<output>
|
| 218 |
+
<port id="0" precision="U8">
|
| 219 |
+
<dim>110</dim>
|
| 220 |
+
</port>
|
| 221 |
+
</output>
|
| 222 |
+
</layer>
|
| 223 |
+
<layer id="18" name="RegexSplit_157105" type="RegexSplit" version="extension">
|
| 224 |
+
<data behaviour="isolate" invert="false" max_splits="-1" />
|
| 225 |
+
<input>
|
| 226 |
+
<port id="0" precision="I32">
|
| 227 |
+
<dim>-1</dim>
|
| 228 |
+
</port>
|
| 229 |
+
<port id="1" precision="I32">
|
| 230 |
+
<dim>-1</dim>
|
| 231 |
+
</port>
|
| 232 |
+
<port id="2" precision="I32">
|
| 233 |
+
<dim>-1</dim>
|
| 234 |
+
</port>
|
| 235 |
+
<port id="3" precision="I32">
|
| 236 |
+
<dim>-1</dim>
|
| 237 |
+
</port>
|
| 238 |
+
<port id="4" precision="U8">
|
| 239 |
+
<dim>-1</dim>
|
| 240 |
+
</port>
|
| 241 |
+
<port id="5" precision="BOOL">
|
| 242 |
+
<dim>-1</dim>
|
| 243 |
+
</port>
|
| 244 |
+
<port id="6" precision="U8">
|
| 245 |
+
<dim>110</dim>
|
| 246 |
+
</port>
|
| 247 |
+
</input>
|
| 248 |
+
<output>
|
| 249 |
+
<port id="7" precision="I32">
|
| 250 |
+
<dim>-1</dim>
|
| 251 |
+
</port>
|
| 252 |
+
<port id="8" precision="I32">
|
| 253 |
+
<dim>-1</dim>
|
| 254 |
+
</port>
|
| 255 |
+
<port id="9" precision="I32">
|
| 256 |
+
<dim>-1</dim>
|
| 257 |
+
</port>
|
| 258 |
+
<port id="10" precision="I32">
|
| 259 |
+
<dim>-1</dim>
|
| 260 |
+
</port>
|
| 261 |
+
<port id="11" precision="U8">
|
| 262 |
+
<dim>-1</dim>
|
| 263 |
+
</port>
|
| 264 |
+
<port id="12" precision="BOOL">
|
| 265 |
+
<dim>-1</dim>
|
| 266 |
+
</port>
|
| 267 |
+
</output>
|
| 268 |
+
</layer>
|
| 269 |
+
<layer id="19" name="Constant_157107" type="Const" version="opset1">
|
| 270 |
+
<data element_type="i32" shape="151748" offset="2016" size="606992" />
|
| 271 |
+
<output>
|
| 272 |
+
<port id="0" precision="I32">
|
| 273 |
+
<dim>151748</dim>
|
| 274 |
+
</port>
|
| 275 |
+
</output>
|
| 276 |
+
</layer>
|
| 277 |
+
<layer id="20" name="Constant_157109" type="Const" version="opset1">
|
| 278 |
+
<data element_type="i32" shape="151748" offset="609008" size="606992" />
|
| 279 |
+
<output>
|
| 280 |
+
<port id="0" precision="I32">
|
| 281 |
+
<dim>151748</dim>
|
| 282 |
+
</port>
|
| 283 |
+
</output>
|
| 284 |
+
</layer>
|
| 285 |
+
<layer id="21" name="Constant_157111" type="Const" version="opset1">
|
| 286 |
+
<data element_type="u8" shape="977358" offset="1216000" size="977358" />
|
| 287 |
+
<output>
|
| 288 |
+
<port id="0" precision="U8">
|
| 289 |
+
<dim>977358</dim>
|
| 290 |
+
</port>
|
| 291 |
+
</output>
|
| 292 |
+
</layer>
|
| 293 |
+
<layer id="22" name="Constant_157119" type="Const" version="opset1">
|
| 294 |
+
<data element_type="i32" shape="151387" offset="2193358" size="605548" />
|
| 295 |
+
<output>
|
| 296 |
+
<port id="0" precision="I32">
|
| 297 |
+
<dim>151387</dim>
|
| 298 |
+
</port>
|
| 299 |
+
</output>
|
| 300 |
+
</layer>
|
| 301 |
+
<layer id="23" name="Constant_157121" type="Const" version="opset1">
|
| 302 |
+
<data element_type="i32" shape="151387" offset="2798906" size="605548" />
|
| 303 |
+
<output>
|
| 304 |
+
<port id="0" precision="I32">
|
| 305 |
+
<dim>151387</dim>
|
| 306 |
+
</port>
|
| 307 |
+
</output>
|
| 308 |
+
</layer>
|
| 309 |
+
<layer id="24" name="Constant_157123" type="Const" version="opset1">
|
| 310 |
+
<data element_type="u8" shape="491359" offset="3404454" size="491359" />
|
| 311 |
+
<output>
|
| 312 |
+
<port id="0" precision="U8">
|
| 313 |
+
<dim>491359</dim>
|
| 314 |
+
</port>
|
| 315 |
+
</output>
|
| 316 |
+
</layer>
|
| 317 |
+
<layer id="25" name="Constant_157125" type="Const" version="opset1">
|
| 318 |
+
<data element_type="i32" shape="151387" offset="3895813" size="605548" />
|
| 319 |
+
<output>
|
| 320 |
+
<port id="0" precision="I32">
|
| 321 |
+
<dim>151387</dim>
|
| 322 |
+
</port>
|
| 323 |
+
</output>
|
| 324 |
+
</layer>
|
| 325 |
+
<layer id="26" name="Constant_157127" type="Const" version="opset1">
|
| 326 |
+
<data element_type="i32" shape="151387" offset="4501361" size="605548" />
|
| 327 |
+
<output>
|
| 328 |
+
<port id="0" precision="I32">
|
| 329 |
+
<dim>151387</dim>
|
| 330 |
+
</port>
|
| 331 |
+
</output>
|
| 332 |
+
</layer>
|
| 333 |
+
<layer id="27" name="Constant_157129" type="Const" version="opset1">
|
| 334 |
+
<data element_type="u8" shape="484354" offset="5106909" size="484354" />
|
| 335 |
+
<output>
|
| 336 |
+
<port id="0" precision="U8">
|
| 337 |
+
<dim>484354</dim>
|
| 338 |
+
</port>
|
| 339 |
+
</output>
|
| 340 |
+
</layer>
|
| 341 |
+
<layer id="28" name="Constant_157113" type="Const" version="opset1">
|
| 342 |
+
<data element_type="i32" shape="106" offset="5591263" size="424" />
|
| 343 |
+
<output>
|
| 344 |
+
<port id="0" precision="I32">
|
| 345 |
+
<dim>106</dim>
|
| 346 |
+
</port>
|
| 347 |
+
</output>
|
| 348 |
+
</layer>
|
| 349 |
+
<layer id="29" name="Constant_157115" type="Const" version="opset1">
|
| 350 |
+
<data element_type="i32" shape="106" offset="5591687" size="424" />
|
| 351 |
+
<output>
|
| 352 |
+
<port id="0" precision="I32">
|
| 353 |
+
<dim>106</dim>
|
| 354 |
+
</port>
|
| 355 |
+
</output>
|
| 356 |
+
</layer>
|
| 357 |
+
<layer id="30" name="Constant_157117" type="Const" version="opset1">
|
| 358 |
+
<data element_type="u8" shape="1394" offset="5592111" size="1394" />
|
| 359 |
+
<output>
|
| 360 |
+
<port id="0" precision="U8">
|
| 361 |
+
<dim>1394</dim>
|
| 362 |
+
</port>
|
| 363 |
+
</output>
|
| 364 |
+
</layer>
|
| 365 |
+
<layer id="31" name="Constant_157130" type="Const" version="opset1">
|
| 366 |
+
<data element_type="i32" shape="106" offset="5593505" size="424" />
|
| 367 |
+
<output>
|
| 368 |
+
<port id="0" precision="I32">
|
| 369 |
+
<dim>106</dim>
|
| 370 |
+
</port>
|
| 371 |
+
</output>
|
| 372 |
+
</layer>
|
| 373 |
+
<layer id="32" name="BPETokenizer_157131" type="BPETokenizer" version="extension">
|
| 374 |
+
<data unk_token="" fuse_unk="false" suffix_indicator="" end_suffix="" byte_fallback="false" cache_capacity="30328" />
|
| 375 |
+
<input>
|
| 376 |
+
<port id="0" precision="I32">
|
| 377 |
+
<dim>-1</dim>
|
| 378 |
+
</port>
|
| 379 |
+
<port id="1" precision="I32">
|
| 380 |
+
<dim>-1</dim>
|
| 381 |
+
</port>
|
| 382 |
+
<port id="2" precision="I32">
|
| 383 |
+
<dim>-1</dim>
|
| 384 |
+
</port>
|
| 385 |
+
<port id="3" precision="I32">
|
| 386 |
+
<dim>-1</dim>
|
| 387 |
+
</port>
|
| 388 |
+
<port id="4" precision="U8">
|
| 389 |
+
<dim>-1</dim>
|
| 390 |
+
</port>
|
| 391 |
+
<port id="5" precision="I32">
|
| 392 |
+
<dim>151748</dim>
|
| 393 |
+
</port>
|
| 394 |
+
<port id="6" precision="I32">
|
| 395 |
+
<dim>151748</dim>
|
| 396 |
+
</port>
|
| 397 |
+
<port id="7" precision="U8">
|
| 398 |
+
<dim>977358</dim>
|
| 399 |
+
</port>
|
| 400 |
+
<port id="8" precision="I32">
|
| 401 |
+
<dim>151387</dim>
|
| 402 |
+
</port>
|
| 403 |
+
<port id="9" precision="I32">
|
| 404 |
+
<dim>151387</dim>
|
| 405 |
+
</port>
|
| 406 |
+
<port id="10" precision="U8">
|
| 407 |
+
<dim>491359</dim>
|
| 408 |
+
</port>
|
| 409 |
+
<port id="11" precision="I32">
|
| 410 |
+
<dim>151387</dim>
|
| 411 |
+
</port>
|
| 412 |
+
<port id="12" precision="I32">
|
| 413 |
+
<dim>151387</dim>
|
| 414 |
+
</port>
|
| 415 |
+
<port id="13" precision="U8">
|
| 416 |
+
<dim>484354</dim>
|
| 417 |
+
</port>
|
| 418 |
+
<port id="14" precision="I32">
|
| 419 |
+
<dim>106</dim>
|
| 420 |
+
</port>
|
| 421 |
+
<port id="15" precision="I32">
|
| 422 |
+
<dim>106</dim>
|
| 423 |
+
</port>
|
| 424 |
+
<port id="16" precision="U8">
|
| 425 |
+
<dim>1394</dim>
|
| 426 |
+
</port>
|
| 427 |
+
<port id="17" precision="I32">
|
| 428 |
+
<dim>106</dim>
|
| 429 |
+
</port>
|
| 430 |
+
</input>
|
| 431 |
+
<output>
|
| 432 |
+
<port id="18" precision="I32">
|
| 433 |
+
<dim>-1</dim>
|
| 434 |
+
</port>
|
| 435 |
+
<port id="19" precision="I32">
|
| 436 |
+
<dim>-1</dim>
|
| 437 |
+
</port>
|
| 438 |
+
<port id="20" precision="I32">
|
| 439 |
+
<dim>-1</dim>
|
| 440 |
+
</port>
|
| 441 |
+
</output>
|
| 442 |
+
</layer>
|
| 443 |
+
<layer id="33" name="Constant_157132" type="Const" version="opset1">
|
| 444 |
+
<data element_type="i32" shape="" offset="5593929" size="4" />
|
| 445 |
+
<output>
|
| 446 |
+
<port id="0" precision="I32" />
|
| 447 |
+
</output>
|
| 448 |
+
</layer>
|
| 449 |
+
<layer id="34" name="Constant_157134" type="Const" version="opset1">
|
| 450 |
+
<data element_type="u8" shape="4" offset="5593933" size="4" />
|
| 451 |
+
<output>
|
| 452 |
+
<port id="0" precision="U8">
|
| 453 |
+
<dim>4</dim>
|
| 454 |
+
</port>
|
| 455 |
+
</output>
|
| 456 |
+
</layer>
|
| 457 |
+
<layer id="35" name="Constant_157136" type="Const" version="opset1">
|
| 458 |
+
<data element_type="u8" shape="13" offset="5593937" size="13" />
|
| 459 |
+
<output>
|
| 460 |
+
<port id="0" precision="U8">
|
| 461 |
+
<dim>13</dim>
|
| 462 |
+
</port>
|
| 463 |
+
</output>
|
| 464 |
+
</layer>
|
| 465 |
+
<layer id="36" name="Truncate_157137" type="Truncate" version="extension">
|
| 466 |
+
<data m_num_inputs="1" />
|
| 467 |
+
<input>
|
| 468 |
+
<port id="0" precision="I32">
|
| 469 |
+
<dim>-1</dim>
|
| 470 |
+
</port>
|
| 471 |
+
<port id="1" precision="I32">
|
| 472 |
+
<dim>-1</dim>
|
| 473 |
+
</port>
|
| 474 |
+
<port id="2" precision="I32">
|
| 475 |
+
<dim>-1</dim>
|
| 476 |
+
</port>
|
| 477 |
+
<port id="3" precision="I32" />
|
| 478 |
+
<port id="4" precision="U8">
|
| 479 |
+
<dim>4</dim>
|
| 480 |
+
</port>
|
| 481 |
+
<port id="5" precision="U8">
|
| 482 |
+
<dim>13</dim>
|
| 483 |
+
</port>
|
| 484 |
+
</input>
|
| 485 |
+
<output>
|
| 486 |
+
<port id="6" precision="I32">
|
| 487 |
+
<dim>-1</dim>
|
| 488 |
+
</port>
|
| 489 |
+
<port id="7" precision="I32">
|
| 490 |
+
<dim>-1</dim>
|
| 491 |
+
</port>
|
| 492 |
+
<port id="8" precision="I32">
|
| 493 |
+
<dim>-1</dim>
|
| 494 |
+
</port>
|
| 495 |
+
</output>
|
| 496 |
+
</layer>
|
| 497 |
+
<layer id="37" name="Constant_157138" type="Const" version="opset1">
|
| 498 |
+
<data element_type="i32" shape="1" offset="5593950" size="4" />
|
| 499 |
+
<output>
|
| 500 |
+
<port id="0" precision="I32">
|
| 501 |
+
<dim>1</dim>
|
| 502 |
+
</port>
|
| 503 |
+
</output>
|
| 504 |
+
</layer>
|
| 505 |
+
<layer id="38" name="CombineSegments_157139" type="CombineSegments" version="extension">
|
| 506 |
+
<input>
|
| 507 |
+
<port id="0" precision="I32">
|
| 508 |
+
<dim>-1</dim>
|
| 509 |
+
</port>
|
| 510 |
+
<port id="1" precision="I32">
|
| 511 |
+
<dim>-1</dim>
|
| 512 |
+
</port>
|
| 513 |
+
<port id="2" precision="I32">
|
| 514 |
+
<dim>-1</dim>
|
| 515 |
+
</port>
|
| 516 |
+
<port id="3" precision="I32">
|
| 517 |
+
<dim>1</dim>
|
| 518 |
+
</port>
|
| 519 |
+
</input>
|
| 520 |
+
<output>
|
| 521 |
+
<port id="4" precision="I32">
|
| 522 |
+
<dim>-1</dim>
|
| 523 |
+
</port>
|
| 524 |
+
<port id="5" precision="I32">
|
| 525 |
+
<dim>-1</dim>
|
| 526 |
+
</port>
|
| 527 |
+
<port id="6" precision="I32">
|
| 528 |
+
<dim>-1</dim>
|
| 529 |
+
</port>
|
| 530 |
+
<port id="7" precision="I32">
|
| 531 |
+
<dim>-1</dim>
|
| 532 |
+
</port>
|
| 533 |
+
<port id="8" precision="I32">
|
| 534 |
+
<dim>-1</dim>
|
| 535 |
+
</port>
|
| 536 |
+
<port id="9" precision="I32">
|
| 537 |
+
<dim>-1</dim>
|
| 538 |
+
</port>
|
| 539 |
+
</output>
|
| 540 |
+
</layer>
|
| 541 |
+
<layer id="39" name="Subtract_157140" type="Subtract" version="opset1">
|
| 542 |
+
<data auto_broadcast="numpy" />
|
| 543 |
+
<input>
|
| 544 |
+
<port id="0" precision="I32">
|
| 545 |
+
<dim>-1</dim>
|
| 546 |
+
</port>
|
| 547 |
+
<port id="1" precision="I32">
|
| 548 |
+
<dim>-1</dim>
|
| 549 |
+
</port>
|
| 550 |
+
</input>
|
| 551 |
+
<output>
|
| 552 |
+
<port id="2" precision="I32">
|
| 553 |
+
<dim>-1</dim>
|
| 554 |
+
</port>
|
| 555 |
+
</output>
|
| 556 |
+
</layer>
|
| 557 |
+
<layer id="40" name="Constant_157141" type="Const" version="opset1">
|
| 558 |
+
<data element_type="i32" shape="" offset="5593950" size="4" />
|
| 559 |
+
<output>
|
| 560 |
+
<port id="0" precision="I32" />
|
| 561 |
+
</output>
|
| 562 |
+
</layer>
|
| 563 |
+
<layer id="41" name="ReduceMax_157142" type="ReduceMax" version="opset1">
|
| 564 |
+
<data keep_dims="false" />
|
| 565 |
+
<input>
|
| 566 |
+
<port id="0" precision="I32">
|
| 567 |
+
<dim>-1</dim>
|
| 568 |
+
</port>
|
| 569 |
+
<port id="1" precision="I32" />
|
| 570 |
+
</input>
|
| 571 |
+
<output>
|
| 572 |
+
<port id="2" precision="I32" />
|
| 573 |
+
</output>
|
| 574 |
+
</layer>
|
| 575 |
+
<layer id="42" name="Constant_157143" type="Const" version="opset1">
|
| 576 |
+
<data element_type="i32" shape="" offset="5593954" size="4" />
|
| 577 |
+
<output>
|
| 578 |
+
<port id="0" precision="I32" />
|
| 579 |
+
</output>
|
| 580 |
+
</layer>
|
| 581 |
+
<layer id="43" name="RaggedToDense_157144" type="RaggedToDense" version="extension">
|
| 582 |
+
<data pad_right="false" m_pad_max_length="false" />
|
| 583 |
+
<input>
|
| 584 |
+
<port id="0" precision="I32">
|
| 585 |
+
<dim>-1</dim>
|
| 586 |
+
</port>
|
| 587 |
+
<port id="1" precision="I32">
|
| 588 |
+
<dim>-1</dim>
|
| 589 |
+
</port>
|
| 590 |
+
<port id="2" precision="I32">
|
| 591 |
+
<dim>-1</dim>
|
| 592 |
+
</port>
|
| 593 |
+
<port id="3" precision="I32" />
|
| 594 |
+
<port id="4" precision="I32" />
|
| 595 |
+
</input>
|
| 596 |
+
<output>
|
| 597 |
+
<port id="5" precision="I32">
|
| 598 |
+
<dim>-1</dim>
|
| 599 |
+
<dim>-1</dim>
|
| 600 |
+
</port>
|
| 601 |
+
<port id="6" precision="BOOL">
|
| 602 |
+
<dim>-1</dim>
|
| 603 |
+
<dim>-1</dim>
|
| 604 |
+
</port>
|
| 605 |
+
</output>
|
| 606 |
+
</layer>
|
| 607 |
+
<layer id="44" name="Convert_157145" type="Convert" version="opset1">
|
| 608 |
+
<data destination_type="i32" />
|
| 609 |
+
<input>
|
| 610 |
+
<port id="0" precision="BOOL">
|
| 611 |
+
<dim>-1</dim>
|
| 612 |
+
<dim>-1</dim>
|
| 613 |
+
</port>
|
| 614 |
+
</input>
|
| 615 |
+
<output>
|
| 616 |
+
<port id="1" precision="I32">
|
| 617 |
+
<dim>-1</dim>
|
| 618 |
+
<dim>-1</dim>
|
| 619 |
+
</port>
|
| 620 |
+
</output>
|
| 621 |
+
</layer>
|
| 622 |
+
<layer id="45" name="Convert_157145.0" type="Convert" version="opset1">
|
| 623 |
+
<data destination_type="i64" />
|
| 624 |
+
<input>
|
| 625 |
+
<port id="0" precision="I32">
|
| 626 |
+
<dim>-1</dim>
|
| 627 |
+
<dim>-1</dim>
|
| 628 |
+
</port>
|
| 629 |
+
</input>
|
| 630 |
+
<output>
|
| 631 |
+
<port id="1" precision="I64" names="attention_mask">
|
| 632 |
+
<dim>-1</dim>
|
| 633 |
+
<dim>-1</dim>
|
| 634 |
+
</port>
|
| 635 |
+
</output>
|
| 636 |
+
</layer>
|
| 637 |
+
<layer id="46" name="RaggedToDense_157144.0" type="Convert" version="opset1">
|
| 638 |
+
<data destination_type="i64" />
|
| 639 |
+
<input>
|
| 640 |
+
<port id="0" precision="I32">
|
| 641 |
+
<dim>-1</dim>
|
| 642 |
+
<dim>-1</dim>
|
| 643 |
+
</port>
|
| 644 |
+
</input>
|
| 645 |
+
<output>
|
| 646 |
+
<port id="1" precision="I64" names="input_ids">
|
| 647 |
+
<dim>-1</dim>
|
| 648 |
+
<dim>-1</dim>
|
| 649 |
+
</port>
|
| 650 |
+
</output>
|
| 651 |
+
</layer>
|
| 652 |
+
<layer id="47" name="Result_157148" type="Result" version="opset1" output_names="input_ids">
|
| 653 |
+
<input>
|
| 654 |
+
<port id="0" precision="I64">
|
| 655 |
+
<dim>-1</dim>
|
| 656 |
+
<dim>-1</dim>
|
| 657 |
+
</port>
|
| 658 |
+
</input>
|
| 659 |
+
</layer>
|
| 660 |
+
<layer id="48" name="Result_157150" type="Result" version="opset1" output_names="attention_mask">
|
| 661 |
+
<input>
|
| 662 |
+
<port id="0" precision="I64">
|
| 663 |
+
<dim>-1</dim>
|
| 664 |
+
<dim>-1</dim>
|
| 665 |
+
</port>
|
| 666 |
+
</input>
|
| 667 |
+
</layer>
|
| 668 |
+
</layers>
|
| 669 |
+
<edges>
|
| 670 |
+
<edge from-layer="0" from-port="0" to-layer="2" to-port="0" />
|
| 671 |
+
<edge from-layer="1" from-port="0" to-layer="8" to-port="0" />
|
| 672 |
+
<edge from-layer="2" from-port="1" to-layer="3" to-port="0" />
|
| 673 |
+
<edge from-layer="2" from-port="3" to-layer="15" to-port="4" />
|
| 674 |
+
<edge from-layer="2" from-port="2" to-layer="15" to-port="3" />
|
| 675 |
+
<edge from-layer="2" from-port="1" to-layer="15" to-port="2" />
|
| 676 |
+
<edge from-layer="3" from-port="1" to-layer="6" to-port="0" />
|
| 677 |
+
<edge from-layer="4" from-port="0" to-layer="6" to-port="1" />
|
| 678 |
+
<edge from-layer="5" from-port="0" to-layer="6" to-port="2" />
|
| 679 |
+
<edge from-layer="6" from-port="3" to-layer="11" to-port="0" />
|
| 680 |
+
<edge from-layer="6" from-port="3" to-layer="8" to-port="1" />
|
| 681 |
+
<edge from-layer="7" from-port="0" to-layer="8" to-port="2" />
|
| 682 |
+
<edge from-layer="8" from-port="3" to-layer="15" to-port="0" />
|
| 683 |
+
<edge from-layer="9" from-port="0" to-layer="13" to-port="0" />
|
| 684 |
+
<edge from-layer="10" from-port="0" to-layer="11" to-port="1" />
|
| 685 |
+
<edge from-layer="11" from-port="2" to-layer="13" to-port="1" />
|
| 686 |
+
<edge from-layer="12" from-port="0" to-layer="13" to-port="2" />
|
| 687 |
+
<edge from-layer="13" from-port="3" to-layer="15" to-port="1" />
|
| 688 |
+
<edge from-layer="14" from-port="0" to-layer="15" to-port="5" />
|
| 689 |
+
<edge from-layer="15" from-port="10" to-layer="16" to-port="2" />
|
| 690 |
+
<edge from-layer="15" from-port="7" to-layer="18" to-port="1" />
|
| 691 |
+
<edge from-layer="15" from-port="6" to-layer="18" to-port="0" />
|
| 692 |
+
<edge from-layer="15" from-port="11" to-layer="16" to-port="3" />
|
| 693 |
+
<edge from-layer="15" from-port="9" to-layer="16" to-port="1" />
|
| 694 |
+
<edge from-layer="15" from-port="8" to-layer="16" to-port="0" />
|
| 695 |
+
<edge from-layer="16" from-port="4" to-layer="18" to-port="2" />
|
| 696 |
+
<edge from-layer="16" from-port="5" to-layer="18" to-port="3" />
|
| 697 |
+
<edge from-layer="16" from-port="6" to-layer="18" to-port="4" />
|
| 698 |
+
<edge from-layer="16" from-port="7" to-layer="18" to-port="5" />
|
| 699 |
+
<edge from-layer="17" from-port="0" to-layer="18" to-port="6" />
|
| 700 |
+
<edge from-layer="18" from-port="7" to-layer="32" to-port="0" />
|
| 701 |
+
<edge from-layer="18" from-port="8" to-layer="32" to-port="1" />
|
| 702 |
+
<edge from-layer="18" from-port="9" to-layer="32" to-port="2" />
|
| 703 |
+
<edge from-layer="18" from-port="10" to-layer="32" to-port="3" />
|
| 704 |
+
<edge from-layer="18" from-port="11" to-layer="32" to-port="4" />
|
| 705 |
+
<edge from-layer="19" from-port="0" to-layer="32" to-port="5" />
|
| 706 |
+
<edge from-layer="20" from-port="0" to-layer="32" to-port="6" />
|
| 707 |
+
<edge from-layer="21" from-port="0" to-layer="32" to-port="7" />
|
| 708 |
+
<edge from-layer="22" from-port="0" to-layer="32" to-port="8" />
|
| 709 |
+
<edge from-layer="23" from-port="0" to-layer="32" to-port="9" />
|
| 710 |
+
<edge from-layer="24" from-port="0" to-layer="32" to-port="10" />
|
| 711 |
+
<edge from-layer="25" from-port="0" to-layer="32" to-port="11" />
|
| 712 |
+
<edge from-layer="26" from-port="0" to-layer="32" to-port="12" />
|
| 713 |
+
<edge from-layer="27" from-port="0" to-layer="32" to-port="13" />
|
| 714 |
+
<edge from-layer="28" from-port="0" to-layer="32" to-port="14" />
|
| 715 |
+
<edge from-layer="29" from-port="0" to-layer="32" to-port="15" />
|
| 716 |
+
<edge from-layer="30" from-port="0" to-layer="32" to-port="16" />
|
| 717 |
+
<edge from-layer="31" from-port="0" to-layer="32" to-port="17" />
|
| 718 |
+
<edge from-layer="32" from-port="18" to-layer="36" to-port="0" />
|
| 719 |
+
<edge from-layer="32" from-port="19" to-layer="36" to-port="1" />
|
| 720 |
+
<edge from-layer="32" from-port="20" to-layer="36" to-port="2" />
|
| 721 |
+
<edge from-layer="33" from-port="0" to-layer="36" to-port="3" />
|
| 722 |
+
<edge from-layer="34" from-port="0" to-layer="36" to-port="4" />
|
| 723 |
+
<edge from-layer="35" from-port="0" to-layer="36" to-port="5" />
|
| 724 |
+
<edge from-layer="36" from-port="6" to-layer="38" to-port="0" />
|
| 725 |
+
<edge from-layer="36" from-port="8" to-layer="38" to-port="2" />
|
| 726 |
+
<edge from-layer="36" from-port="7" to-layer="38" to-port="1" />
|
| 727 |
+
<edge from-layer="37" from-port="0" to-layer="38" to-port="3" />
|
| 728 |
+
<edge from-layer="38" from-port="5" to-layer="39" to-port="0" />
|
| 729 |
+
<edge from-layer="38" from-port="4" to-layer="39" to-port="1" />
|
| 730 |
+
<edge from-layer="38" from-port="4" to-layer="43" to-port="0" />
|
| 731 |
+
<edge from-layer="38" from-port="5" to-layer="43" to-port="1" />
|
| 732 |
+
<edge from-layer="38" from-port="6" to-layer="43" to-port="2" />
|
| 733 |
+
<edge from-layer="39" from-port="2" to-layer="41" to-port="0" />
|
| 734 |
+
<edge from-layer="40" from-port="0" to-layer="41" to-port="1" />
|
| 735 |
+
<edge from-layer="41" from-port="2" to-layer="43" to-port="3" />
|
| 736 |
+
<edge from-layer="42" from-port="0" to-layer="43" to-port="4" />
|
| 737 |
+
<edge from-layer="43" from-port="6" to-layer="44" to-port="0" />
|
| 738 |
+
<edge from-layer="43" from-port="5" to-layer="46" to-port="0" />
|
| 739 |
+
<edge from-layer="44" from-port="1" to-layer="45" to-port="0" />
|
| 740 |
+
<edge from-layer="45" from-port="1" to-layer="48" to-port="0" />
|
| 741 |
+
<edge from-layer="46" from-port="1" to-layer="47" to-port="0" />
|
| 742 |
+
</edges>
|
| 743 |
+
<rt_info>
|
| 744 |
+
<add_attention_mask value="True" />
|
| 745 |
+
<add_prefix_space />
|
| 746 |
+
<add_special_tokens value="True" />
|
| 747 |
+
<bos_token_id value="151644" />
|
| 748 |
+
<chat_template value="{%- if tools %} {{- '<|im_start|>system\n' }} {%- if messages[0].role == 'system' %} {{- messages[0].content + '\n\n' }} {%- endif %} {{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }} {%- for tool in tools %} {{- "\n" }} {{- tool | tojson }} {%- endfor %} {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }} {%- else %} {%- if messages[0].role == 'system' %} {{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }} {%- endif %} {%- endif %} {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %} {%- for message in messages[::-1] %} {%- set index = (messages|length - 1) - loop.index0 %} {%- if ns.multi_step_tool and message.role == "user" and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %} {%- set ns.multi_step_tool = false %} {%- set ns.last_query_index = index %} {%- endif %} {%- endfor %} {%- for message in messages %} {%- if (message.role == "user") or (message.role == "system" and not loop.first) %} {{- '<|im_start|>' + message.role + '\n' + message.content + '<|im_end|>' + '\n' }} {%- elif message.role == "assistant" %} {%- set content = message.content %} {%- set reasoning_content = '' %} {%- if message.reasoning_content is defined and message.reasoning_content is not none %} {%- set reasoning_content = message.reasoning_content %} {%- else %} {%- if '</think>' in message.content %} {%- set content = message.content.split('</think>')[-1].lstrip('\n') %} {%- set reasoning_content = message.content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %} {%- endif %} {%- endif %} {%- if loop.index0 > ns.last_query_index %} {%- if loop.last or (not loop.last and reasoning_content) %} {{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }} {%- else %} {{- '<|im_start|>' + message.role + '\n' + content }} {%- endif %} {%- else %} {{- '<|im_start|>' + message.role + '\n' + content }} {%- endif %} {%- if message.tool_calls %} {%- for tool_call in message.tool_calls %} {%- if (loop.first and content) or (not loop.first) %} {{- '\n' }} {%- endif %} {%- if tool_call.function %} {%- set tool_call = tool_call.function %} {%- endif %} {{- '<tool_call>\n{"name": "' }} {{- tool_call.name }} {{- '", "arguments": ' }} {%- if tool_call.arguments is string %} {{- tool_call.arguments }} {%- else %} {{- tool_call.arguments | tojson }} {%- endif %} {{- '}\n</tool_call>' }} {%- endfor %} {%- endif %} {{- '<|im_end|>\n' }} {%- elif message.role == "tool" %} {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %} {{- '<|im_start|>user' }} {%- endif %} {{- '\n<tool_response>\n' }} {{- message.content }} {{- '\n</tool_response>' }} {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} {{- '<|im_end|>\n' }} {%- endif %} {%- endif %} {%- endfor %} {%- if add_generation_prompt %} {{- '<|im_start|>assistant\n' }} {%- if enable_thinking is defined and enable_thinking is false %} {{- '<think>\n\n</think>\n\n' }} {%- endif %} {%- if enable_thinking is defined and enable_thinking is true %} {{- '<think>\n' }} {%- endif %} {%- endif %}" />
|
| 749 |
+
<clean_up_tokenization_spaces />
|
| 750 |
+
<detokenizer_input_type value="i64" />
|
| 751 |
+
<eos_token_id value="151645" />
|
| 752 |
+
<handle_special_tokens_with_re />
|
| 753 |
+
<max_length />
|
| 754 |
+
<number_of_inputs value="1" />
|
| 755 |
+
<openvino_tokenizers_version value="2026.0.0.0-632-47cea02a2d4" />
|
| 756 |
+
<openvino_version value="2026.0.0-20965-c6d6a13a886-releases/2026/0" />
|
| 757 |
+
<original_post_processor_template value="{"type": "ByteLevel", "add_prefix_space": false, "trim_offsets": false, "use_regex": false}" />
|
| 758 |
+
<original_tokenizer_class value="<class 'transformers_modules.MiniCPM-V-4_5.tokenization_minicpmv_fast.MiniCPMVTokenizerFast'>" />
|
| 759 |
+
<pad_token_id value="151643" />
|
| 760 |
+
<processed_post_processor_template value="{"single": {"ids": [-1], "type_ids": [0]}, "pair": {"ids": [-1, -2], "type_ids": [0, 0]}}" />
|
| 761 |
+
<sentencepiece_version value="0.2.1" />
|
| 762 |
+
<skip_special_tokens value="True" />
|
| 763 |
+
<streaming_detokenizer value="False" />
|
| 764 |
+
<tiktoken_version value="0.7.0" />
|
| 765 |
+
<tokenizer_output_type value="i64" />
|
| 766 |
+
<tokenizers_version value="0.21.4" />
|
| 767 |
+
<transformers_version value="4.53.3" />
|
| 768 |
+
<use_max_padding value="False" />
|
| 769 |
+
<use_sentencepiece_backend value="False" />
|
| 770 |
+
<utf8_replace_mode value="replace" />
|
| 771 |
+
<with_detokenizer value="True" />
|
| 772 |
+
</rt_info>
|
| 773 |
+
</net>
|
openvino_vision_embeddings_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5fcb1e60f82ee7050b418508ff30551b9f46bfbe4702c4ad260cd51957f0b06c
|
| 3 |
+
size 446077856
|
openvino_vision_embeddings_model.xml
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
preprocessor_config.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoImageProcessor": "image_processing_minicpmv.MiniCPMVImageProcessor",
|
| 4 |
+
"AutoProcessor": "processing_minicpmv.MiniCPMVProcessor"
|
| 5 |
+
},
|
| 6 |
+
"im_end": "</image>",
|
| 7 |
+
"im_end_token": "</image>",
|
| 8 |
+
"im_id_end": "</image_id>",
|
| 9 |
+
"im_id_start": "<image_id>",
|
| 10 |
+
"im_start": "<image>",
|
| 11 |
+
"im_start_token": "<image>",
|
| 12 |
+
"image_feature_size": 64,
|
| 13 |
+
"image_processor_type": "MiniCPMVImageProcessor",
|
| 14 |
+
"max_slice_nums": 9,
|
| 15 |
+
"mean": [
|
| 16 |
+
0.5,
|
| 17 |
+
0.5,
|
| 18 |
+
0.5
|
| 19 |
+
],
|
| 20 |
+
"norm_mean": [
|
| 21 |
+
0.5,
|
| 22 |
+
0.5,
|
| 23 |
+
0.5
|
| 24 |
+
],
|
| 25 |
+
"norm_std": [
|
| 26 |
+
0.5,
|
| 27 |
+
0.5,
|
| 28 |
+
0.5
|
| 29 |
+
],
|
| 30 |
+
"patch_size": 14,
|
| 31 |
+
"processor_class": "MiniCPMVProcessor",
|
| 32 |
+
"scale_resolution": 448,
|
| 33 |
+
"slice_end": "</slice>",
|
| 34 |
+
"slice_end_token": "</slice>",
|
| 35 |
+
"slice_mode": true,
|
| 36 |
+
"slice_start": "<slice>",
|
| 37 |
+
"slice_start_token": "<slice>",
|
| 38 |
+
"std": [
|
| 39 |
+
0.5,
|
| 40 |
+
0.5,
|
| 41 |
+
0.5
|
| 42 |
+
],
|
| 43 |
+
"unk": "<unk>",
|
| 44 |
+
"unk_token": "<unk>",
|
| 45 |
+
"use_image_id": true,
|
| 46 |
+
"version": 2.6
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# coding=utf-8
|
| 2 |
+
# Copyright 2024 The HuggingFace Inc. team.
|
| 3 |
+
#
|
| 4 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 5 |
+
# you may not use this file except in compliance with the License.
|
| 6 |
+
# You may obtain a copy of the License at
|
| 7 |
+
#
|
| 8 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
+
#
|
| 10 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 11 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
+
# See the License for the specific language governing permissions and
|
| 14 |
+
# limitations under the License.
|
| 15 |
+
"""
|
| 16 |
+
Processor class for MiniCPMV.
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
from typing import List, Optional, Union, Dict, Any
|
| 20 |
+
import torch
|
| 21 |
+
import re
|
| 22 |
+
|
| 23 |
+
from transformers.image_processing_utils import BatchFeature
|
| 24 |
+
from transformers.image_utils import ImageInput
|
| 25 |
+
from transformers.processing_utils import ProcessorMixin
|
| 26 |
+
from transformers.tokenization_utils_base import PaddingStrategy, PreTokenizedInput, TextInput, TruncationStrategy
|
| 27 |
+
from transformers.utils import TensorType, requires_backends, is_torch_dtype, is_torch_device
|
| 28 |
+
|
| 29 |
+
from .image_processing_minicpmv import MiniCPMVBatchFeature
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
class MiniCPMVProcessor(ProcessorMixin):
|
| 33 |
+
r"""
|
| 34 |
+
Constructs a MiniCPMV processor which wraps a MiniCPMV image processor and a MiniCPMV tokenizer into a single processor.
|
| 35 |
+
|
| 36 |
+
[`MiniCPMVProcessor`] offers all the functionalities of [`MiniCPMVImageProcessor`] and [`LlamaTokenizerWrapper`]. See the
|
| 37 |
+
[`~MiniCPMVProcessor.__call__`] and [`~MiniCPMVProcessor.decode`] for more information.
|
| 38 |
+
|
| 39 |
+
Args:
|
| 40 |
+
image_processor ([`MiniCPMVImageProcessor`], *optional*):
|
| 41 |
+
The image processor is a required input.
|
| 42 |
+
tokenizer ([`LlamaTokenizerWrapper`], *optional*):
|
| 43 |
+
The tokenizer is a required input.
|
| 44 |
+
"""
|
| 45 |
+
attributes = ["image_processor", "tokenizer"]
|
| 46 |
+
image_processor_class = "AutoImageProcessor"
|
| 47 |
+
tokenizer_class = "AutoTokenizer"
|
| 48 |
+
|
| 49 |
+
def __init__(self, image_processor=None, tokenizer=None):
|
| 50 |
+
super().__init__(image_processor, tokenizer)
|
| 51 |
+
self.version = image_processor.version
|
| 52 |
+
|
| 53 |
+
def __call__(
|
| 54 |
+
self,
|
| 55 |
+
text: Union[TextInput, PreTokenizedInput, List[TextInput], List[PreTokenizedInput]],
|
| 56 |
+
images: ImageInput = None,
|
| 57 |
+
max_length: Optional[int] = None,
|
| 58 |
+
do_pad: Optional[bool] = True,
|
| 59 |
+
max_slice_nums: int = None,
|
| 60 |
+
use_image_id: bool = None,
|
| 61 |
+
temporal_ids: Optional[Union[List[List[int]], List[List[List[int]]]]] = None,
|
| 62 |
+
return_tensors: Optional[Union[str, TensorType]] = TensorType.PYTORCH,
|
| 63 |
+
**kwargs
|
| 64 |
+
) -> MiniCPMVBatchFeature:
|
| 65 |
+
|
| 66 |
+
if images is not None:
|
| 67 |
+
# image_inputs = self.image_processor(images, do_pad=do_pad, max_slice_nums=max_slice_nums, return_tensors=return_tensors)
|
| 68 |
+
image_inputs = self.image_processor(images, do_pad=do_pad, max_slice_nums=max_slice_nums, temporal_ids=temporal_ids, return_tensors=return_tensors)
|
| 69 |
+
# return self._convert_images_texts_to_inputs(image_inputs, text, max_slice_nums=max_slice_nums, use_image_id=use_image_id, max_length=max_length, **kwargs)
|
| 70 |
+
return self._convert_images_texts_to_inputs(image_inputs, text, max_slice_nums=max_slice_nums, use_image_id=use_image_id, max_length=max_length, temporal_ids=temporal_ids, **kwargs)
|
| 71 |
+
|
| 72 |
+
# Copied from transformers.models.clip.processing_clip.CLIPProcessor.batch_decode with CLIP->Llama
|
| 73 |
+
def batch_decode(self, *args, **kwargs):
|
| 74 |
+
"""
|
| 75 |
+
This method forwards all its arguments to LlamaTokenizerFast's [`~PreTrainedTokenizer.batch_decode`]. Please
|
| 76 |
+
refer to the docstring of this method for more information.
|
| 77 |
+
"""
|
| 78 |
+
output_ids = args[0]
|
| 79 |
+
result_text = []
|
| 80 |
+
for result in output_ids:
|
| 81 |
+
result = result[result != 0]
|
| 82 |
+
if result[0] == self.tokenizer.bos_id:
|
| 83 |
+
result = result[1:]
|
| 84 |
+
if result[-1] == self.tokenizer.eos_id:
|
| 85 |
+
result = result[:-1]
|
| 86 |
+
result_text.append(self.tokenizer.decode(result, *args[1:], **kwargs).strip())
|
| 87 |
+
return result_text
|
| 88 |
+
# return self.tokenizer.batch_decode(*args, **kwargs)
|
| 89 |
+
|
| 90 |
+
# Copied from transformers.models.clip.processing_clip.CLIPProcessor.decode with CLIP->Llama
|
| 91 |
+
def decode(self, *args, **kwargs):
|
| 92 |
+
"""
|
| 93 |
+
This method forwards all its arguments to LlamaTokenizerFast's [`~PreTrainedTokenizer.decode`]. Please refer to
|
| 94 |
+
the docstring of this method for more information.
|
| 95 |
+
"""
|
| 96 |
+
result = args[0]
|
| 97 |
+
result = result[result != 0]
|
| 98 |
+
if result[0] == self.tokenizer.bos_id:
|
| 99 |
+
result = result[1:]
|
| 100 |
+
if result[-1] == self.tokenizer.eos_id or (hasattr(self.tokenizer, "eot_id") and result[-1] == self.tokenizer.eot_id):
|
| 101 |
+
result = result[:-1]
|
| 102 |
+
return self.tokenizer.decode(result, *args[1:], **kwargs).strip()
|
| 103 |
+
|
| 104 |
+
def _convert(
|
| 105 |
+
self, input_str, max_inp_length: Optional[int] = None
|
| 106 |
+
):
|
| 107 |
+
if self.version > 2.5 or not getattr(self.tokenizer, "add_bos_token", False):
|
| 108 |
+
input_ids = self.tokenizer.encode(input_str)
|
| 109 |
+
else:
|
| 110 |
+
input_ids = [self.tokenizer.bos_id] + self.tokenizer.encode(input_str)
|
| 111 |
+
if max_inp_length is not None:
|
| 112 |
+
input_ids = input_ids[:max_inp_length]
|
| 113 |
+
input_ids = torch.tensor(input_ids, dtype=torch.int32)
|
| 114 |
+
|
| 115 |
+
start_cond = (input_ids == self.tokenizer.im_start_id) | (input_ids == self.tokenizer.slice_start_id)
|
| 116 |
+
end_cond = (input_ids == self.tokenizer.im_end_id) | (input_ids == self.tokenizer.slice_end_id)
|
| 117 |
+
|
| 118 |
+
image_start_tokens = torch.where(start_cond)[0]
|
| 119 |
+
image_start_tokens += 1
|
| 120 |
+
image_end_tokens = torch.where(end_cond)[0]
|
| 121 |
+
|
| 122 |
+
valid_image_nums = max(len(image_start_tokens), len(image_end_tokens))
|
| 123 |
+
|
| 124 |
+
image_bounds = torch.hstack(
|
| 125 |
+
[
|
| 126 |
+
image_start_tokens[:valid_image_nums].unsqueeze(-1),
|
| 127 |
+
image_end_tokens[:valid_image_nums].unsqueeze(-1),
|
| 128 |
+
]
|
| 129 |
+
)
|
| 130 |
+
return input_ids, image_bounds
|
| 131 |
+
|
| 132 |
+
def _convert_images_texts_to_inputs(
|
| 133 |
+
self,
|
| 134 |
+
images,
|
| 135 |
+
texts: Union[str, List[str]],
|
| 136 |
+
truncation=None,
|
| 137 |
+
max_length=None,
|
| 138 |
+
max_slice_nums=None,
|
| 139 |
+
use_image_id=None,
|
| 140 |
+
return_tensors=None,
|
| 141 |
+
**kwargs
|
| 142 |
+
):
|
| 143 |
+
if images is None or not len(images):
|
| 144 |
+
model_inputs = self.tokenizer(texts, return_tensors=return_tensors, truncation=truncation, max_length=max_length, **kwargs)
|
| 145 |
+
return MiniCPMVBatchFeature(data={**model_inputs})
|
| 146 |
+
|
| 147 |
+
pattern = "(<image>./</image>)"
|
| 148 |
+
# images, image_sizes, tgt_sizes = images["pixel_values"], images["image_sizes"], images["tgt_sizes"]
|
| 149 |
+
images, image_sizes, tgt_sizes, temporal_ids, skip_image_idx = images["pixel_values"], images["image_sizes"], images["tgt_sizes"], images["temporal_ids"], images["skip_image_idx"]
|
| 150 |
+
|
| 151 |
+
if isinstance(texts, str):
|
| 152 |
+
texts = [texts]
|
| 153 |
+
input_ids_list = []
|
| 154 |
+
image_bounds_list = []
|
| 155 |
+
for index, (text, skip_idx) in enumerate(zip(texts, skip_image_idx)):
|
| 156 |
+
image_tags = re.findall(pattern, text)
|
| 157 |
+
assert len(image_tags) == len(image_sizes[index])
|
| 158 |
+
text_chunks = text.split(pattern)
|
| 159 |
+
final_text = ""
|
| 160 |
+
|
| 161 |
+
for i in range(len(image_tags)):
|
| 162 |
+
if i in skip_idx:
|
| 163 |
+
image_placeholder = ''
|
| 164 |
+
text_chunk = text_chunks[i].strip()
|
| 165 |
+
|
| 166 |
+
else:
|
| 167 |
+
image_placeholder = self.image_processor.get_slice_image_placeholder(
|
| 168 |
+
image_sizes[index][i],
|
| 169 |
+
i,
|
| 170 |
+
max_slice_nums,
|
| 171 |
+
use_image_id
|
| 172 |
+
)
|
| 173 |
+
text_chunk = text_chunks[i]
|
| 174 |
+
|
| 175 |
+
final_text = final_text + text_chunk + image_placeholder
|
| 176 |
+
|
| 177 |
+
final_text += text_chunks[-1]
|
| 178 |
+
|
| 179 |
+
input_ids, image_bounds = self._convert(final_text, max_length)
|
| 180 |
+
input_ids_list.append(input_ids)
|
| 181 |
+
image_bounds_list.append(image_bounds)
|
| 182 |
+
padded_input_ids, padding_lengths = self.pad(
|
| 183 |
+
input_ids_list,
|
| 184 |
+
padding_side="left"
|
| 185 |
+
)
|
| 186 |
+
for i, length in enumerate(padding_lengths):
|
| 187 |
+
image_bounds_list[i] = image_bounds_list[i] + length
|
| 188 |
+
attention_mask = padded_input_ids.ne(0)
|
| 189 |
+
|
| 190 |
+
return MiniCPMVBatchFeature(data={
|
| 191 |
+
"input_ids": padded_input_ids,
|
| 192 |
+
"attention_mask": attention_mask,
|
| 193 |
+
"pixel_values": images,
|
| 194 |
+
"image_sizes": image_sizes,
|
| 195 |
+
"image_bound": image_bounds_list,
|
| 196 |
+
"tgt_sizes": tgt_sizes,
|
| 197 |
+
"temporal_ids": temporal_ids
|
| 198 |
+
})
|
| 199 |
+
|
| 200 |
+
@property
|
| 201 |
+
# Copied from transformers.models.clip.processing_clip.CLIPProcessor.model_input_names
|
| 202 |
+
def model_input_names(self):
|
| 203 |
+
tokenizer_input_names = self.tokenizer.model_input_names
|
| 204 |
+
image_processor_input_names = self.image_processor.model_input_names
|
| 205 |
+
return list(dict.fromkeys(tokenizer_input_names + image_processor_input_names))
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
def pad(self, inputs, max_length=None, padding_value=0, padding_side="left"):
|
| 209 |
+
items = []
|
| 210 |
+
if isinstance(inputs[0], list):
|
| 211 |
+
assert isinstance(inputs[0][0], torch.Tensor)
|
| 212 |
+
for it in inputs:
|
| 213 |
+
for tr in it:
|
| 214 |
+
items.append(tr)
|
| 215 |
+
else:
|
| 216 |
+
assert isinstance(inputs[0], torch.Tensor)
|
| 217 |
+
items = inputs
|
| 218 |
+
|
| 219 |
+
batch_size = len(items)
|
| 220 |
+
shape = items[0].shape
|
| 221 |
+
dim = len(shape)
|
| 222 |
+
assert dim <= 2
|
| 223 |
+
if max_length is None:
|
| 224 |
+
max_length = 0
|
| 225 |
+
max_length = max(max_length, max(item.shape[-1] for item in items))
|
| 226 |
+
min_length = min(item.shape[-1] for item in items)
|
| 227 |
+
dtype = items[0].dtype
|
| 228 |
+
|
| 229 |
+
if dim == 0:
|
| 230 |
+
return torch.stack([item for item in items], dim=0), [0]
|
| 231 |
+
elif dim == 1:
|
| 232 |
+
if max_length == min_length:
|
| 233 |
+
return torch.stack([item for item in items], dim=0), [0] * batch_size
|
| 234 |
+
tensor = torch.zeros((batch_size, max_length), dtype=dtype) + padding_value
|
| 235 |
+
else:
|
| 236 |
+
tensor = (
|
| 237 |
+
torch.zeros((batch_size, max_length, shape[-1]), dtype=dtype)
|
| 238 |
+
+ padding_value
|
| 239 |
+
)
|
| 240 |
+
|
| 241 |
+
padding_length = []
|
| 242 |
+
for i, item in enumerate(items):
|
| 243 |
+
if dim == 1:
|
| 244 |
+
if padding_side == "left":
|
| 245 |
+
tensor[i, -len(item) :] = item.clone()
|
| 246 |
+
else:
|
| 247 |
+
tensor[i, : len(item)] = item.clone()
|
| 248 |
+
elif dim == 2:
|
| 249 |
+
if padding_side == "left":
|
| 250 |
+
tensor[i, -len(item) :, :] = item.clone()
|
| 251 |
+
else:
|
| 252 |
+
tensor[i, : len(item), :] = item.clone()
|
| 253 |
+
padding_length.append(tensor.shape[-1] - len(item))
|
| 254 |
+
|
| 255 |
+
return tensor, padding_length
|
processor_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"auto_map": {
|
| 3 |
+
"AutoProcessor": "processing_minicpmv.MiniCPMVProcessor"
|
| 4 |
+
},
|
| 5 |
+
"processor_class": "MiniCPMVProcessor"
|
| 6 |
+
}
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"additional_special_tokens": [
|
| 3 |
+
"<unk>",
|
| 4 |
+
"<image>",
|
| 5 |
+
"</image>",
|
| 6 |
+
"<ref>",
|
| 7 |
+
"</ref>",
|
| 8 |
+
"<box>",
|
| 9 |
+
"</box>",
|
| 10 |
+
"<quad>",
|
| 11 |
+
"</quad>",
|
| 12 |
+
"<point>",
|
| 13 |
+
"</point>",
|
| 14 |
+
"<slice>",
|
| 15 |
+
"</slice>",
|
| 16 |
+
"<image_id>",
|
| 17 |
+
"</image_id>",
|
| 18 |
+
"<unit>",
|
| 19 |
+
"</unit>",
|
| 20 |
+
"<|reserved_0|>",
|
| 21 |
+
"<|reserved_1|>",
|
| 22 |
+
"<|reserved_2|>",
|
| 23 |
+
"<|reserved_3|>",
|
| 24 |
+
"<|reserved_4|>",
|
| 25 |
+
"<|reserved_5|>",
|
| 26 |
+
"<|reserved_6|>",
|
| 27 |
+
"<|reserved_7|>",
|
| 28 |
+
"<|reserved_8|>",
|
| 29 |
+
"<|reserved_9|>",
|
| 30 |
+
"<|reserved_10|>",
|
| 31 |
+
"<|reserved_11|>",
|
| 32 |
+
"<|reserved_12|>",
|
| 33 |
+
"<|reserved_13|>",
|
| 34 |
+
"<|reserved_14|>",
|
| 35 |
+
"<|reserved_15|>",
|
| 36 |
+
"<|reserved_16|>",
|
| 37 |
+
"<|reserved_17|>",
|
| 38 |
+
"<|reserved_18|>",
|
| 39 |
+
"<|reserved_19|>",
|
| 40 |
+
"<|reserved_20|>",
|
| 41 |
+
"<|reserved_21|>",
|
| 42 |
+
"<|reserved_22|>",
|
| 43 |
+
"<|reserved_23|>",
|
| 44 |
+
"<|reserved_24|>",
|
| 45 |
+
"<|reserved_25|>",
|
| 46 |
+
"<|reserved_26|>",
|
| 47 |
+
"<|reserved_27|>",
|
| 48 |
+
"<|reserved_28|>",
|
| 49 |
+
"<|reserved_29|>",
|
| 50 |
+
"<|reserved_30|>",
|
| 51 |
+
"<|reserved_31|>",
|
| 52 |
+
"<|reserved_32|>",
|
| 53 |
+
"<|reserved_33|>",
|
| 54 |
+
"<|reserved_34|>",
|
| 55 |
+
"<|reserved_35|>",
|
| 56 |
+
"<|reserved_36|>",
|
| 57 |
+
"<|reserved_37|>",
|
| 58 |
+
"<|reserved_38|>",
|
| 59 |
+
"<|reserved_39|>",
|
| 60 |
+
"<|reserved_40|>",
|
| 61 |
+
"<|reserved_41|>",
|
| 62 |
+
"<|reserved_42|>",
|
| 63 |
+
"<|reserved_43|>",
|
| 64 |
+
"<|reserved_44|>",
|
| 65 |
+
"<|reserved_45|>",
|
| 66 |
+
"<|reserved_46|>",
|
| 67 |
+
"<|reserved_47|>",
|
| 68 |
+
"<|reserved_48|>",
|
| 69 |
+
"<|reserved_49|>",
|
| 70 |
+
"<|reserved_50|>",
|
| 71 |
+
"<|reserved_51|>",
|
| 72 |
+
"<|reserved_52|>",
|
| 73 |
+
"<|reserved_53|>",
|
| 74 |
+
"<|reserved_54|>",
|
| 75 |
+
"<|reserved_55|>",
|
| 76 |
+
"<|reserved_56|>",
|
| 77 |
+
"<|reserved_57|>",
|
| 78 |
+
"<|reserved_58|>",
|
| 79 |
+
"<|reserved_59|>",
|
| 80 |
+
"<|reserved_60|>",
|
| 81 |
+
"<|reserved_61|>",
|
| 82 |
+
"<|reserved_62|>"
|
| 83 |
+
],
|
| 84 |
+
"bos_token": {
|
| 85 |
+
"content": "<|im_start|>",
|
| 86 |
+
"lstrip": false,
|
| 87 |
+
"normalized": false,
|
| 88 |
+
"rstrip": false,
|
| 89 |
+
"single_word": false
|
| 90 |
+
},
|
| 91 |
+
"eos_token": {
|
| 92 |
+
"content": "<|im_end|>",
|
| 93 |
+
"lstrip": false,
|
| 94 |
+
"normalized": false,
|
| 95 |
+
"rstrip": false,
|
| 96 |
+
"single_word": false
|
| 97 |
+
},
|
| 98 |
+
"pad_token": {
|
| 99 |
+
"content": "<|endoftext|>",
|
| 100 |
+
"lstrip": false,
|
| 101 |
+
"normalized": false,
|
| 102 |
+
"rstrip": false,
|
| 103 |
+
"single_word": false
|
| 104 |
+
},
|
| 105 |
+
"unk_token": {
|
| 106 |
+
"content": "<unk>",
|
| 107 |
+
"lstrip": false,
|
| 108 |
+
"normalized": false,
|
| 109 |
+
"rstrip": false,
|
| 110 |
+
"single_word": false
|
| 111 |
+
}
|
| 112 |
+
}
|
tokenization_minicpmv_fast.py
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import Qwen2TokenizerFast
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class MiniCPMVTokenizerFast(Qwen2TokenizerFast):
|
| 5 |
+
def __init__(self, **kwargs):
|
| 6 |
+
super().__init__(**kwargs)
|
| 7 |
+
self.im_start = "<image>"
|
| 8 |
+
self.im_end = "</image>"
|
| 9 |
+
self.ref_start = "<ref>"
|
| 10 |
+
self.ref_end = "</ref>"
|
| 11 |
+
self.box_start = "<box>"
|
| 12 |
+
self.box_end = "</box>"
|
| 13 |
+
self.quad_start = "<quad>"
|
| 14 |
+
self.quad_end = "</quad>"
|
| 15 |
+
self.slice_start = "<slice>"
|
| 16 |
+
self.slice_end = "</slice>"
|
| 17 |
+
self.im_id_start = "<image_id>"
|
| 18 |
+
self.im_id_end = "</image_id>"
|
| 19 |
+
|
| 20 |
+
@property
|
| 21 |
+
def eos_id(self):
|
| 22 |
+
return self.eos_token_id
|
| 23 |
+
|
| 24 |
+
@property
|
| 25 |
+
def bos_id(self):
|
| 26 |
+
return self.bos_token_id
|
| 27 |
+
|
| 28 |
+
@property
|
| 29 |
+
def unk_id(self):
|
| 30 |
+
return self.unk_token_id
|
| 31 |
+
|
| 32 |
+
@property
|
| 33 |
+
def im_start_id(self):
|
| 34 |
+
return self.convert_tokens_to_ids(self.im_start)
|
| 35 |
+
|
| 36 |
+
@property
|
| 37 |
+
def im_end_id(self):
|
| 38 |
+
return self.convert_tokens_to_ids(self.im_end)
|
| 39 |
+
|
| 40 |
+
@property
|
| 41 |
+
def slice_start_id(self):
|
| 42 |
+
return self.convert_tokens_to_ids(self.slice_start)
|
| 43 |
+
|
| 44 |
+
@property
|
| 45 |
+
def slice_end_id(self):
|
| 46 |
+
return self.convert_tokens_to_ids(self.slice_end)
|
| 47 |
+
|
| 48 |
+
@property
|
| 49 |
+
def im_id_start_id(self):
|
| 50 |
+
return self.convert_tokens_to_ids(self.im_id_start)
|
| 51 |
+
|
| 52 |
+
@property
|
| 53 |
+
def im_id_end_id(self):
|
| 54 |
+
return self.convert_tokens_to_ids(self.im_id_end)
|
| 55 |
+
|
| 56 |
+
@property
|
| 57 |
+
def newline_id(self):
|
| 58 |
+
return self.convert_tokens_to_ids('\n')
|
| 59 |
+
|
| 60 |
+
@staticmethod
|
| 61 |
+
def escape(text: str) -> str:
|
| 62 |
+
return text
|
| 63 |
+
|
| 64 |
+
@staticmethod
|
| 65 |
+
def unescape(text: str) -> str:
|
| 66 |
+
return text
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c5a94a2c3913b8aa2175fffb5fd6cf4301958f323d06475bfd91037c13bdd74b
|
| 3 |
+
size 11437868
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,954 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_bos_token": false,
|
| 3 |
+
"add_prefix_space": false,
|
| 4 |
+
"added_tokens_decoder": {
|
| 5 |
+
"128244": {
|
| 6 |
+
"content": "<unk>",
|
| 7 |
+
"lstrip": false,
|
| 8 |
+
"normalized": false,
|
| 9 |
+
"rstrip": false,
|
| 10 |
+
"single_word": false,
|
| 11 |
+
"special": true
|
| 12 |
+
},
|
| 13 |
+
"151643": {
|
| 14 |
+
"content": "<|endoftext|>",
|
| 15 |
+
"lstrip": false,
|
| 16 |
+
"normalized": false,
|
| 17 |
+
"rstrip": false,
|
| 18 |
+
"single_word": false,
|
| 19 |
+
"special": true
|
| 20 |
+
},
|
| 21 |
+
"151644": {
|
| 22 |
+
"content": "<|im_start|>",
|
| 23 |
+
"lstrip": false,
|
| 24 |
+
"normalized": false,
|
| 25 |
+
"rstrip": false,
|
| 26 |
+
"single_word": false,
|
| 27 |
+
"special": true
|
| 28 |
+
},
|
| 29 |
+
"151645": {
|
| 30 |
+
"content": "<|im_end|>",
|
| 31 |
+
"lstrip": false,
|
| 32 |
+
"normalized": false,
|
| 33 |
+
"rstrip": false,
|
| 34 |
+
"single_word": false,
|
| 35 |
+
"special": true
|
| 36 |
+
},
|
| 37 |
+
"151646": {
|
| 38 |
+
"content": "<|object_ref_start|>",
|
| 39 |
+
"lstrip": false,
|
| 40 |
+
"normalized": false,
|
| 41 |
+
"rstrip": false,
|
| 42 |
+
"single_word": false,
|
| 43 |
+
"special": true
|
| 44 |
+
},
|
| 45 |
+
"151647": {
|
| 46 |
+
"content": "<|object_ref_end|>",
|
| 47 |
+
"lstrip": false,
|
| 48 |
+
"normalized": false,
|
| 49 |
+
"rstrip": false,
|
| 50 |
+
"single_word": false,
|
| 51 |
+
"special": true
|
| 52 |
+
},
|
| 53 |
+
"151648": {
|
| 54 |
+
"content": "<|box_start|>",
|
| 55 |
+
"lstrip": false,
|
| 56 |
+
"normalized": false,
|
| 57 |
+
"rstrip": false,
|
| 58 |
+
"single_word": false,
|
| 59 |
+
"special": true
|
| 60 |
+
},
|
| 61 |
+
"151649": {
|
| 62 |
+
"content": "<|box_end|>",
|
| 63 |
+
"lstrip": false,
|
| 64 |
+
"normalized": false,
|
| 65 |
+
"rstrip": false,
|
| 66 |
+
"single_word": false,
|
| 67 |
+
"special": true
|
| 68 |
+
},
|
| 69 |
+
"151650": {
|
| 70 |
+
"content": "<|quad_start|>",
|
| 71 |
+
"lstrip": false,
|
| 72 |
+
"normalized": false,
|
| 73 |
+
"rstrip": false,
|
| 74 |
+
"single_word": false,
|
| 75 |
+
"special": true
|
| 76 |
+
},
|
| 77 |
+
"151651": {
|
| 78 |
+
"content": "<|quad_end|>",
|
| 79 |
+
"lstrip": false,
|
| 80 |
+
"normalized": false,
|
| 81 |
+
"rstrip": false,
|
| 82 |
+
"single_word": false,
|
| 83 |
+
"special": true
|
| 84 |
+
},
|
| 85 |
+
"151652": {
|
| 86 |
+
"content": "<|vision_start|>",
|
| 87 |
+
"lstrip": false,
|
| 88 |
+
"normalized": false,
|
| 89 |
+
"rstrip": false,
|
| 90 |
+
"single_word": false,
|
| 91 |
+
"special": true
|
| 92 |
+
},
|
| 93 |
+
"151653": {
|
| 94 |
+
"content": "<|vision_end|>",
|
| 95 |
+
"lstrip": false,
|
| 96 |
+
"normalized": false,
|
| 97 |
+
"rstrip": false,
|
| 98 |
+
"single_word": false,
|
| 99 |
+
"special": true
|
| 100 |
+
},
|
| 101 |
+
"151654": {
|
| 102 |
+
"content": "<|vision_pad|>",
|
| 103 |
+
"lstrip": false,
|
| 104 |
+
"normalized": false,
|
| 105 |
+
"rstrip": false,
|
| 106 |
+
"single_word": false,
|
| 107 |
+
"special": true
|
| 108 |
+
},
|
| 109 |
+
"151655": {
|
| 110 |
+
"content": "<|image_pad|>",
|
| 111 |
+
"lstrip": false,
|
| 112 |
+
"normalized": false,
|
| 113 |
+
"rstrip": false,
|
| 114 |
+
"single_word": false,
|
| 115 |
+
"special": true
|
| 116 |
+
},
|
| 117 |
+
"151656": {
|
| 118 |
+
"content": "<|video_pad|>",
|
| 119 |
+
"lstrip": false,
|
| 120 |
+
"normalized": false,
|
| 121 |
+
"rstrip": false,
|
| 122 |
+
"single_word": false,
|
| 123 |
+
"special": true
|
| 124 |
+
},
|
| 125 |
+
"151657": {
|
| 126 |
+
"content": "<tool_call>",
|
| 127 |
+
"lstrip": false,
|
| 128 |
+
"normalized": false,
|
| 129 |
+
"rstrip": false,
|
| 130 |
+
"single_word": false,
|
| 131 |
+
"special": false
|
| 132 |
+
},
|
| 133 |
+
"151658": {
|
| 134 |
+
"content": "</tool_call>",
|
| 135 |
+
"lstrip": false,
|
| 136 |
+
"normalized": false,
|
| 137 |
+
"rstrip": false,
|
| 138 |
+
"single_word": false,
|
| 139 |
+
"special": false
|
| 140 |
+
},
|
| 141 |
+
"151659": {
|
| 142 |
+
"content": "<|fim_prefix|>",
|
| 143 |
+
"lstrip": false,
|
| 144 |
+
"normalized": false,
|
| 145 |
+
"rstrip": false,
|
| 146 |
+
"single_word": false,
|
| 147 |
+
"special": false
|
| 148 |
+
},
|
| 149 |
+
"151660": {
|
| 150 |
+
"content": "<|fim_middle|>",
|
| 151 |
+
"lstrip": false,
|
| 152 |
+
"normalized": false,
|
| 153 |
+
"rstrip": false,
|
| 154 |
+
"single_word": false,
|
| 155 |
+
"special": false
|
| 156 |
+
},
|
| 157 |
+
"151661": {
|
| 158 |
+
"content": "<|fim_suffix|>",
|
| 159 |
+
"lstrip": false,
|
| 160 |
+
"normalized": false,
|
| 161 |
+
"rstrip": false,
|
| 162 |
+
"single_word": false,
|
| 163 |
+
"special": false
|
| 164 |
+
},
|
| 165 |
+
"151662": {
|
| 166 |
+
"content": "<|fim_pad|>",
|
| 167 |
+
"lstrip": false,
|
| 168 |
+
"normalized": false,
|
| 169 |
+
"rstrip": false,
|
| 170 |
+
"single_word": false,
|
| 171 |
+
"special": false
|
| 172 |
+
},
|
| 173 |
+
"151663": {
|
| 174 |
+
"content": "<|repo_name|>",
|
| 175 |
+
"lstrip": false,
|
| 176 |
+
"normalized": false,
|
| 177 |
+
"rstrip": false,
|
| 178 |
+
"single_word": false,
|
| 179 |
+
"special": false
|
| 180 |
+
},
|
| 181 |
+
"151664": {
|
| 182 |
+
"content": "<|file_sep|>",
|
| 183 |
+
"lstrip": false,
|
| 184 |
+
"normalized": false,
|
| 185 |
+
"rstrip": false,
|
| 186 |
+
"single_word": false,
|
| 187 |
+
"special": false
|
| 188 |
+
},
|
| 189 |
+
"151665": {
|
| 190 |
+
"content": "<tool_response>",
|
| 191 |
+
"lstrip": false,
|
| 192 |
+
"normalized": false,
|
| 193 |
+
"rstrip": false,
|
| 194 |
+
"single_word": false,
|
| 195 |
+
"special": false
|
| 196 |
+
},
|
| 197 |
+
"151666": {
|
| 198 |
+
"content": "</tool_response>",
|
| 199 |
+
"lstrip": false,
|
| 200 |
+
"normalized": false,
|
| 201 |
+
"rstrip": false,
|
| 202 |
+
"single_word": false,
|
| 203 |
+
"special": false
|
| 204 |
+
},
|
| 205 |
+
"151667": {
|
| 206 |
+
"content": "<think>",
|
| 207 |
+
"lstrip": false,
|
| 208 |
+
"normalized": false,
|
| 209 |
+
"rstrip": false,
|
| 210 |
+
"single_word": false,
|
| 211 |
+
"special": false
|
| 212 |
+
},
|
| 213 |
+
"151668": {
|
| 214 |
+
"content": "</think>",
|
| 215 |
+
"lstrip": false,
|
| 216 |
+
"normalized": false,
|
| 217 |
+
"rstrip": false,
|
| 218 |
+
"single_word": false,
|
| 219 |
+
"special": false
|
| 220 |
+
},
|
| 221 |
+
"151669": {
|
| 222 |
+
"content": "<image>",
|
| 223 |
+
"lstrip": false,
|
| 224 |
+
"normalized": false,
|
| 225 |
+
"rstrip": false,
|
| 226 |
+
"single_word": false,
|
| 227 |
+
"special": true
|
| 228 |
+
},
|
| 229 |
+
"151670": {
|
| 230 |
+
"content": "</image>",
|
| 231 |
+
"lstrip": false,
|
| 232 |
+
"normalized": false,
|
| 233 |
+
"rstrip": false,
|
| 234 |
+
"single_word": false,
|
| 235 |
+
"special": true
|
| 236 |
+
},
|
| 237 |
+
"151671": {
|
| 238 |
+
"content": "<ref>",
|
| 239 |
+
"lstrip": false,
|
| 240 |
+
"normalized": false,
|
| 241 |
+
"rstrip": false,
|
| 242 |
+
"single_word": false,
|
| 243 |
+
"special": true
|
| 244 |
+
},
|
| 245 |
+
"151672": {
|
| 246 |
+
"content": "</ref>",
|
| 247 |
+
"lstrip": false,
|
| 248 |
+
"normalized": false,
|
| 249 |
+
"rstrip": false,
|
| 250 |
+
"single_word": false,
|
| 251 |
+
"special": true
|
| 252 |
+
},
|
| 253 |
+
"151673": {
|
| 254 |
+
"content": "<box>",
|
| 255 |
+
"lstrip": false,
|
| 256 |
+
"normalized": false,
|
| 257 |
+
"rstrip": false,
|
| 258 |
+
"single_word": false,
|
| 259 |
+
"special": true
|
| 260 |
+
},
|
| 261 |
+
"151674": {
|
| 262 |
+
"content": "</box>",
|
| 263 |
+
"lstrip": false,
|
| 264 |
+
"normalized": false,
|
| 265 |
+
"rstrip": false,
|
| 266 |
+
"single_word": false,
|
| 267 |
+
"special": true
|
| 268 |
+
},
|
| 269 |
+
"151675": {
|
| 270 |
+
"content": "<quad>",
|
| 271 |
+
"lstrip": false,
|
| 272 |
+
"normalized": false,
|
| 273 |
+
"rstrip": false,
|
| 274 |
+
"single_word": false,
|
| 275 |
+
"special": true
|
| 276 |
+
},
|
| 277 |
+
"151676": {
|
| 278 |
+
"content": "</quad>",
|
| 279 |
+
"lstrip": false,
|
| 280 |
+
"normalized": false,
|
| 281 |
+
"rstrip": false,
|
| 282 |
+
"single_word": false,
|
| 283 |
+
"special": true
|
| 284 |
+
},
|
| 285 |
+
"151677": {
|
| 286 |
+
"content": "<point>",
|
| 287 |
+
"lstrip": false,
|
| 288 |
+
"normalized": false,
|
| 289 |
+
"rstrip": false,
|
| 290 |
+
"single_word": false,
|
| 291 |
+
"special": true
|
| 292 |
+
},
|
| 293 |
+
"151678": {
|
| 294 |
+
"content": "</point>",
|
| 295 |
+
"lstrip": false,
|
| 296 |
+
"normalized": false,
|
| 297 |
+
"rstrip": false,
|
| 298 |
+
"single_word": false,
|
| 299 |
+
"special": true
|
| 300 |
+
},
|
| 301 |
+
"151679": {
|
| 302 |
+
"content": "<slice>",
|
| 303 |
+
"lstrip": false,
|
| 304 |
+
"normalized": false,
|
| 305 |
+
"rstrip": false,
|
| 306 |
+
"single_word": false,
|
| 307 |
+
"special": true
|
| 308 |
+
},
|
| 309 |
+
"151680": {
|
| 310 |
+
"content": "</slice>",
|
| 311 |
+
"lstrip": false,
|
| 312 |
+
"normalized": false,
|
| 313 |
+
"rstrip": false,
|
| 314 |
+
"single_word": false,
|
| 315 |
+
"special": true
|
| 316 |
+
},
|
| 317 |
+
"151681": {
|
| 318 |
+
"content": "<image_id>",
|
| 319 |
+
"lstrip": false,
|
| 320 |
+
"normalized": false,
|
| 321 |
+
"rstrip": false,
|
| 322 |
+
"single_word": false,
|
| 323 |
+
"special": true
|
| 324 |
+
},
|
| 325 |
+
"151682": {
|
| 326 |
+
"content": "</image_id>",
|
| 327 |
+
"lstrip": false,
|
| 328 |
+
"normalized": false,
|
| 329 |
+
"rstrip": false,
|
| 330 |
+
"single_word": false,
|
| 331 |
+
"special": true
|
| 332 |
+
},
|
| 333 |
+
"151683": {
|
| 334 |
+
"content": "<unit>",
|
| 335 |
+
"lstrip": false,
|
| 336 |
+
"normalized": false,
|
| 337 |
+
"rstrip": false,
|
| 338 |
+
"single_word": false,
|
| 339 |
+
"special": true
|
| 340 |
+
},
|
| 341 |
+
"151684": {
|
| 342 |
+
"content": "</unit>",
|
| 343 |
+
"lstrip": false,
|
| 344 |
+
"normalized": false,
|
| 345 |
+
"rstrip": false,
|
| 346 |
+
"single_word": false,
|
| 347 |
+
"special": true
|
| 348 |
+
},
|
| 349 |
+
"151685": {
|
| 350 |
+
"content": "<|reserved_0|>",
|
| 351 |
+
"lstrip": false,
|
| 352 |
+
"normalized": false,
|
| 353 |
+
"rstrip": false,
|
| 354 |
+
"single_word": false,
|
| 355 |
+
"special": true
|
| 356 |
+
},
|
| 357 |
+
"151686": {
|
| 358 |
+
"content": "<|reserved_1|>",
|
| 359 |
+
"lstrip": false,
|
| 360 |
+
"normalized": false,
|
| 361 |
+
"rstrip": false,
|
| 362 |
+
"single_word": false,
|
| 363 |
+
"special": true
|
| 364 |
+
},
|
| 365 |
+
"151687": {
|
| 366 |
+
"content": "<|reserved_2|>",
|
| 367 |
+
"lstrip": false,
|
| 368 |
+
"normalized": false,
|
| 369 |
+
"rstrip": false,
|
| 370 |
+
"single_word": false,
|
| 371 |
+
"special": true
|
| 372 |
+
},
|
| 373 |
+
"151688": {
|
| 374 |
+
"content": "<|reserved_3|>",
|
| 375 |
+
"lstrip": false,
|
| 376 |
+
"normalized": false,
|
| 377 |
+
"rstrip": false,
|
| 378 |
+
"single_word": false,
|
| 379 |
+
"special": true
|
| 380 |
+
},
|
| 381 |
+
"151689": {
|
| 382 |
+
"content": "<|reserved_4|>",
|
| 383 |
+
"lstrip": false,
|
| 384 |
+
"normalized": false,
|
| 385 |
+
"rstrip": false,
|
| 386 |
+
"single_word": false,
|
| 387 |
+
"special": true
|
| 388 |
+
},
|
| 389 |
+
"151690": {
|
| 390 |
+
"content": "<|reserved_5|>",
|
| 391 |
+
"lstrip": false,
|
| 392 |
+
"normalized": false,
|
| 393 |
+
"rstrip": false,
|
| 394 |
+
"single_word": false,
|
| 395 |
+
"special": true
|
| 396 |
+
},
|
| 397 |
+
"151691": {
|
| 398 |
+
"content": "<|reserved_6|>",
|
| 399 |
+
"lstrip": false,
|
| 400 |
+
"normalized": false,
|
| 401 |
+
"rstrip": false,
|
| 402 |
+
"single_word": false,
|
| 403 |
+
"special": true
|
| 404 |
+
},
|
| 405 |
+
"151692": {
|
| 406 |
+
"content": "<|reserved_7|>",
|
| 407 |
+
"lstrip": false,
|
| 408 |
+
"normalized": false,
|
| 409 |
+
"rstrip": false,
|
| 410 |
+
"single_word": false,
|
| 411 |
+
"special": true
|
| 412 |
+
},
|
| 413 |
+
"151693": {
|
| 414 |
+
"content": "<|reserved_8|>",
|
| 415 |
+
"lstrip": false,
|
| 416 |
+
"normalized": false,
|
| 417 |
+
"rstrip": false,
|
| 418 |
+
"single_word": false,
|
| 419 |
+
"special": true
|
| 420 |
+
},
|
| 421 |
+
"151694": {
|
| 422 |
+
"content": "<|reserved_9|>",
|
| 423 |
+
"lstrip": false,
|
| 424 |
+
"normalized": false,
|
| 425 |
+
"rstrip": false,
|
| 426 |
+
"single_word": false,
|
| 427 |
+
"special": true
|
| 428 |
+
},
|
| 429 |
+
"151695": {
|
| 430 |
+
"content": "<|reserved_10|>",
|
| 431 |
+
"lstrip": false,
|
| 432 |
+
"normalized": false,
|
| 433 |
+
"rstrip": false,
|
| 434 |
+
"single_word": false,
|
| 435 |
+
"special": true
|
| 436 |
+
},
|
| 437 |
+
"151696": {
|
| 438 |
+
"content": "<|reserved_11|>",
|
| 439 |
+
"lstrip": false,
|
| 440 |
+
"normalized": false,
|
| 441 |
+
"rstrip": false,
|
| 442 |
+
"single_word": false,
|
| 443 |
+
"special": true
|
| 444 |
+
},
|
| 445 |
+
"151697": {
|
| 446 |
+
"content": "<|reserved_12|>",
|
| 447 |
+
"lstrip": false,
|
| 448 |
+
"normalized": false,
|
| 449 |
+
"rstrip": false,
|
| 450 |
+
"single_word": false,
|
| 451 |
+
"special": true
|
| 452 |
+
},
|
| 453 |
+
"151698": {
|
| 454 |
+
"content": "<|reserved_13|>",
|
| 455 |
+
"lstrip": false,
|
| 456 |
+
"normalized": false,
|
| 457 |
+
"rstrip": false,
|
| 458 |
+
"single_word": false,
|
| 459 |
+
"special": true
|
| 460 |
+
},
|
| 461 |
+
"151699": {
|
| 462 |
+
"content": "<|reserved_14|>",
|
| 463 |
+
"lstrip": false,
|
| 464 |
+
"normalized": false,
|
| 465 |
+
"rstrip": false,
|
| 466 |
+
"single_word": false,
|
| 467 |
+
"special": true
|
| 468 |
+
},
|
| 469 |
+
"151700": {
|
| 470 |
+
"content": "<|reserved_15|>",
|
| 471 |
+
"lstrip": false,
|
| 472 |
+
"normalized": false,
|
| 473 |
+
"rstrip": false,
|
| 474 |
+
"single_word": false,
|
| 475 |
+
"special": true
|
| 476 |
+
},
|
| 477 |
+
"151701": {
|
| 478 |
+
"content": "<|reserved_16|>",
|
| 479 |
+
"lstrip": false,
|
| 480 |
+
"normalized": false,
|
| 481 |
+
"rstrip": false,
|
| 482 |
+
"single_word": false,
|
| 483 |
+
"special": true
|
| 484 |
+
},
|
| 485 |
+
"151702": {
|
| 486 |
+
"content": "<|reserved_17|>",
|
| 487 |
+
"lstrip": false,
|
| 488 |
+
"normalized": false,
|
| 489 |
+
"rstrip": false,
|
| 490 |
+
"single_word": false,
|
| 491 |
+
"special": true
|
| 492 |
+
},
|
| 493 |
+
"151703": {
|
| 494 |
+
"content": "<|reserved_18|>",
|
| 495 |
+
"lstrip": false,
|
| 496 |
+
"normalized": false,
|
| 497 |
+
"rstrip": false,
|
| 498 |
+
"single_word": false,
|
| 499 |
+
"special": true
|
| 500 |
+
},
|
| 501 |
+
"151704": {
|
| 502 |
+
"content": "<|reserved_19|>",
|
| 503 |
+
"lstrip": false,
|
| 504 |
+
"normalized": false,
|
| 505 |
+
"rstrip": false,
|
| 506 |
+
"single_word": false,
|
| 507 |
+
"special": true
|
| 508 |
+
},
|
| 509 |
+
"151705": {
|
| 510 |
+
"content": "<|reserved_20|>",
|
| 511 |
+
"lstrip": false,
|
| 512 |
+
"normalized": false,
|
| 513 |
+
"rstrip": false,
|
| 514 |
+
"single_word": false,
|
| 515 |
+
"special": true
|
| 516 |
+
},
|
| 517 |
+
"151706": {
|
| 518 |
+
"content": "<|reserved_21|>",
|
| 519 |
+
"lstrip": false,
|
| 520 |
+
"normalized": false,
|
| 521 |
+
"rstrip": false,
|
| 522 |
+
"single_word": false,
|
| 523 |
+
"special": true
|
| 524 |
+
},
|
| 525 |
+
"151707": {
|
| 526 |
+
"content": "<|reserved_22|>",
|
| 527 |
+
"lstrip": false,
|
| 528 |
+
"normalized": false,
|
| 529 |
+
"rstrip": false,
|
| 530 |
+
"single_word": false,
|
| 531 |
+
"special": true
|
| 532 |
+
},
|
| 533 |
+
"151708": {
|
| 534 |
+
"content": "<|reserved_23|>",
|
| 535 |
+
"lstrip": false,
|
| 536 |
+
"normalized": false,
|
| 537 |
+
"rstrip": false,
|
| 538 |
+
"single_word": false,
|
| 539 |
+
"special": true
|
| 540 |
+
},
|
| 541 |
+
"151709": {
|
| 542 |
+
"content": "<|reserved_24|>",
|
| 543 |
+
"lstrip": false,
|
| 544 |
+
"normalized": false,
|
| 545 |
+
"rstrip": false,
|
| 546 |
+
"single_word": false,
|
| 547 |
+
"special": true
|
| 548 |
+
},
|
| 549 |
+
"151710": {
|
| 550 |
+
"content": "<|reserved_25|>",
|
| 551 |
+
"lstrip": false,
|
| 552 |
+
"normalized": false,
|
| 553 |
+
"rstrip": false,
|
| 554 |
+
"single_word": false,
|
| 555 |
+
"special": true
|
| 556 |
+
},
|
| 557 |
+
"151711": {
|
| 558 |
+
"content": "<|reserved_26|>",
|
| 559 |
+
"lstrip": false,
|
| 560 |
+
"normalized": false,
|
| 561 |
+
"rstrip": false,
|
| 562 |
+
"single_word": false,
|
| 563 |
+
"special": true
|
| 564 |
+
},
|
| 565 |
+
"151712": {
|
| 566 |
+
"content": "<|reserved_27|>",
|
| 567 |
+
"lstrip": false,
|
| 568 |
+
"normalized": false,
|
| 569 |
+
"rstrip": false,
|
| 570 |
+
"single_word": false,
|
| 571 |
+
"special": true
|
| 572 |
+
},
|
| 573 |
+
"151713": {
|
| 574 |
+
"content": "<|reserved_28|>",
|
| 575 |
+
"lstrip": false,
|
| 576 |
+
"normalized": false,
|
| 577 |
+
"rstrip": false,
|
| 578 |
+
"single_word": false,
|
| 579 |
+
"special": true
|
| 580 |
+
},
|
| 581 |
+
"151714": {
|
| 582 |
+
"content": "<|reserved_29|>",
|
| 583 |
+
"lstrip": false,
|
| 584 |
+
"normalized": false,
|
| 585 |
+
"rstrip": false,
|
| 586 |
+
"single_word": false,
|
| 587 |
+
"special": true
|
| 588 |
+
},
|
| 589 |
+
"151715": {
|
| 590 |
+
"content": "<|reserved_30|>",
|
| 591 |
+
"lstrip": false,
|
| 592 |
+
"normalized": false,
|
| 593 |
+
"rstrip": false,
|
| 594 |
+
"single_word": false,
|
| 595 |
+
"special": true
|
| 596 |
+
},
|
| 597 |
+
"151716": {
|
| 598 |
+
"content": "<|reserved_31|>",
|
| 599 |
+
"lstrip": false,
|
| 600 |
+
"normalized": false,
|
| 601 |
+
"rstrip": false,
|
| 602 |
+
"single_word": false,
|
| 603 |
+
"special": true
|
| 604 |
+
},
|
| 605 |
+
"151717": {
|
| 606 |
+
"content": "<|reserved_32|>",
|
| 607 |
+
"lstrip": false,
|
| 608 |
+
"normalized": false,
|
| 609 |
+
"rstrip": false,
|
| 610 |
+
"single_word": false,
|
| 611 |
+
"special": true
|
| 612 |
+
},
|
| 613 |
+
"151718": {
|
| 614 |
+
"content": "<|reserved_33|>",
|
| 615 |
+
"lstrip": false,
|
| 616 |
+
"normalized": false,
|
| 617 |
+
"rstrip": false,
|
| 618 |
+
"single_word": false,
|
| 619 |
+
"special": true
|
| 620 |
+
},
|
| 621 |
+
"151719": {
|
| 622 |
+
"content": "<|reserved_34|>",
|
| 623 |
+
"lstrip": false,
|
| 624 |
+
"normalized": false,
|
| 625 |
+
"rstrip": false,
|
| 626 |
+
"single_word": false,
|
| 627 |
+
"special": true
|
| 628 |
+
},
|
| 629 |
+
"151720": {
|
| 630 |
+
"content": "<|reserved_35|>",
|
| 631 |
+
"lstrip": false,
|
| 632 |
+
"normalized": false,
|
| 633 |
+
"rstrip": false,
|
| 634 |
+
"single_word": false,
|
| 635 |
+
"special": true
|
| 636 |
+
},
|
| 637 |
+
"151721": {
|
| 638 |
+
"content": "<|reserved_36|>",
|
| 639 |
+
"lstrip": false,
|
| 640 |
+
"normalized": false,
|
| 641 |
+
"rstrip": false,
|
| 642 |
+
"single_word": false,
|
| 643 |
+
"special": true
|
| 644 |
+
},
|
| 645 |
+
"151722": {
|
| 646 |
+
"content": "<|reserved_37|>",
|
| 647 |
+
"lstrip": false,
|
| 648 |
+
"normalized": false,
|
| 649 |
+
"rstrip": false,
|
| 650 |
+
"single_word": false,
|
| 651 |
+
"special": true
|
| 652 |
+
},
|
| 653 |
+
"151723": {
|
| 654 |
+
"content": "<|reserved_38|>",
|
| 655 |
+
"lstrip": false,
|
| 656 |
+
"normalized": false,
|
| 657 |
+
"rstrip": false,
|
| 658 |
+
"single_word": false,
|
| 659 |
+
"special": true
|
| 660 |
+
},
|
| 661 |
+
"151724": {
|
| 662 |
+
"content": "<|reserved_39|>",
|
| 663 |
+
"lstrip": false,
|
| 664 |
+
"normalized": false,
|
| 665 |
+
"rstrip": false,
|
| 666 |
+
"single_word": false,
|
| 667 |
+
"special": true
|
| 668 |
+
},
|
| 669 |
+
"151725": {
|
| 670 |
+
"content": "<|reserved_40|>",
|
| 671 |
+
"lstrip": false,
|
| 672 |
+
"normalized": false,
|
| 673 |
+
"rstrip": false,
|
| 674 |
+
"single_word": false,
|
| 675 |
+
"special": true
|
| 676 |
+
},
|
| 677 |
+
"151726": {
|
| 678 |
+
"content": "<|reserved_41|>",
|
| 679 |
+
"lstrip": false,
|
| 680 |
+
"normalized": false,
|
| 681 |
+
"rstrip": false,
|
| 682 |
+
"single_word": false,
|
| 683 |
+
"special": true
|
| 684 |
+
},
|
| 685 |
+
"151727": {
|
| 686 |
+
"content": "<|reserved_42|>",
|
| 687 |
+
"lstrip": false,
|
| 688 |
+
"normalized": false,
|
| 689 |
+
"rstrip": false,
|
| 690 |
+
"single_word": false,
|
| 691 |
+
"special": true
|
| 692 |
+
},
|
| 693 |
+
"151728": {
|
| 694 |
+
"content": "<|reserved_43|>",
|
| 695 |
+
"lstrip": false,
|
| 696 |
+
"normalized": false,
|
| 697 |
+
"rstrip": false,
|
| 698 |
+
"single_word": false,
|
| 699 |
+
"special": true
|
| 700 |
+
},
|
| 701 |
+
"151729": {
|
| 702 |
+
"content": "<|reserved_44|>",
|
| 703 |
+
"lstrip": false,
|
| 704 |
+
"normalized": false,
|
| 705 |
+
"rstrip": false,
|
| 706 |
+
"single_word": false,
|
| 707 |
+
"special": true
|
| 708 |
+
},
|
| 709 |
+
"151730": {
|
| 710 |
+
"content": "<|reserved_45|>",
|
| 711 |
+
"lstrip": false,
|
| 712 |
+
"normalized": false,
|
| 713 |
+
"rstrip": false,
|
| 714 |
+
"single_word": false,
|
| 715 |
+
"special": true
|
| 716 |
+
},
|
| 717 |
+
"151731": {
|
| 718 |
+
"content": "<|reserved_46|>",
|
| 719 |
+
"lstrip": false,
|
| 720 |
+
"normalized": false,
|
| 721 |
+
"rstrip": false,
|
| 722 |
+
"single_word": false,
|
| 723 |
+
"special": true
|
| 724 |
+
},
|
| 725 |
+
"151732": {
|
| 726 |
+
"content": "<|reserved_47|>",
|
| 727 |
+
"lstrip": false,
|
| 728 |
+
"normalized": false,
|
| 729 |
+
"rstrip": false,
|
| 730 |
+
"single_word": false,
|
| 731 |
+
"special": true
|
| 732 |
+
},
|
| 733 |
+
"151733": {
|
| 734 |
+
"content": "<|reserved_48|>",
|
| 735 |
+
"lstrip": false,
|
| 736 |
+
"normalized": false,
|
| 737 |
+
"rstrip": false,
|
| 738 |
+
"single_word": false,
|
| 739 |
+
"special": true
|
| 740 |
+
},
|
| 741 |
+
"151734": {
|
| 742 |
+
"content": "<|reserved_49|>",
|
| 743 |
+
"lstrip": false,
|
| 744 |
+
"normalized": false,
|
| 745 |
+
"rstrip": false,
|
| 746 |
+
"single_word": false,
|
| 747 |
+
"special": true
|
| 748 |
+
},
|
| 749 |
+
"151735": {
|
| 750 |
+
"content": "<|reserved_50|>",
|
| 751 |
+
"lstrip": false,
|
| 752 |
+
"normalized": false,
|
| 753 |
+
"rstrip": false,
|
| 754 |
+
"single_word": false,
|
| 755 |
+
"special": true
|
| 756 |
+
},
|
| 757 |
+
"151736": {
|
| 758 |
+
"content": "<|reserved_51|>",
|
| 759 |
+
"lstrip": false,
|
| 760 |
+
"normalized": false,
|
| 761 |
+
"rstrip": false,
|
| 762 |
+
"single_word": false,
|
| 763 |
+
"special": true
|
| 764 |
+
},
|
| 765 |
+
"151737": {
|
| 766 |
+
"content": "<|reserved_52|>",
|
| 767 |
+
"lstrip": false,
|
| 768 |
+
"normalized": false,
|
| 769 |
+
"rstrip": false,
|
| 770 |
+
"single_word": false,
|
| 771 |
+
"special": true
|
| 772 |
+
},
|
| 773 |
+
"151738": {
|
| 774 |
+
"content": "<|reserved_53|>",
|
| 775 |
+
"lstrip": false,
|
| 776 |
+
"normalized": false,
|
| 777 |
+
"rstrip": false,
|
| 778 |
+
"single_word": false,
|
| 779 |
+
"special": true
|
| 780 |
+
},
|
| 781 |
+
"151739": {
|
| 782 |
+
"content": "<|reserved_54|>",
|
| 783 |
+
"lstrip": false,
|
| 784 |
+
"normalized": false,
|
| 785 |
+
"rstrip": false,
|
| 786 |
+
"single_word": false,
|
| 787 |
+
"special": true
|
| 788 |
+
},
|
| 789 |
+
"151740": {
|
| 790 |
+
"content": "<|reserved_55|>",
|
| 791 |
+
"lstrip": false,
|
| 792 |
+
"normalized": false,
|
| 793 |
+
"rstrip": false,
|
| 794 |
+
"single_word": false,
|
| 795 |
+
"special": true
|
| 796 |
+
},
|
| 797 |
+
"151741": {
|
| 798 |
+
"content": "<|reserved_56|>",
|
| 799 |
+
"lstrip": false,
|
| 800 |
+
"normalized": false,
|
| 801 |
+
"rstrip": false,
|
| 802 |
+
"single_word": false,
|
| 803 |
+
"special": true
|
| 804 |
+
},
|
| 805 |
+
"151742": {
|
| 806 |
+
"content": "<|reserved_57|>",
|
| 807 |
+
"lstrip": false,
|
| 808 |
+
"normalized": false,
|
| 809 |
+
"rstrip": false,
|
| 810 |
+
"single_word": false,
|
| 811 |
+
"special": true
|
| 812 |
+
},
|
| 813 |
+
"151743": {
|
| 814 |
+
"content": "<|reserved_58|>",
|
| 815 |
+
"lstrip": false,
|
| 816 |
+
"normalized": false,
|
| 817 |
+
"rstrip": false,
|
| 818 |
+
"single_word": false,
|
| 819 |
+
"special": true
|
| 820 |
+
},
|
| 821 |
+
"151744": {
|
| 822 |
+
"content": "<|reserved_59|>",
|
| 823 |
+
"lstrip": false,
|
| 824 |
+
"normalized": false,
|
| 825 |
+
"rstrip": false,
|
| 826 |
+
"single_word": false,
|
| 827 |
+
"special": true
|
| 828 |
+
},
|
| 829 |
+
"151745": {
|
| 830 |
+
"content": "<|reserved_60|>",
|
| 831 |
+
"lstrip": false,
|
| 832 |
+
"normalized": false,
|
| 833 |
+
"rstrip": false,
|
| 834 |
+
"single_word": false,
|
| 835 |
+
"special": true
|
| 836 |
+
},
|
| 837 |
+
"151746": {
|
| 838 |
+
"content": "<|reserved_61|>",
|
| 839 |
+
"lstrip": false,
|
| 840 |
+
"normalized": false,
|
| 841 |
+
"rstrip": false,
|
| 842 |
+
"single_word": false,
|
| 843 |
+
"special": true
|
| 844 |
+
},
|
| 845 |
+
"151747": {
|
| 846 |
+
"content": "<|reserved_62|>",
|
| 847 |
+
"lstrip": false,
|
| 848 |
+
"normalized": false,
|
| 849 |
+
"rstrip": false,
|
| 850 |
+
"single_word": false,
|
| 851 |
+
"special": true
|
| 852 |
+
}
|
| 853 |
+
},
|
| 854 |
+
"additional_special_tokens": [
|
| 855 |
+
"<unk>",
|
| 856 |
+
"<image>",
|
| 857 |
+
"</image>",
|
| 858 |
+
"<ref>",
|
| 859 |
+
"</ref>",
|
| 860 |
+
"<box>",
|
| 861 |
+
"</box>",
|
| 862 |
+
"<quad>",
|
| 863 |
+
"</quad>",
|
| 864 |
+
"<point>",
|
| 865 |
+
"</point>",
|
| 866 |
+
"<slice>",
|
| 867 |
+
"</slice>",
|
| 868 |
+
"<image_id>",
|
| 869 |
+
"</image_id>",
|
| 870 |
+
"<unit>",
|
| 871 |
+
"</unit>",
|
| 872 |
+
"<|reserved_0|>",
|
| 873 |
+
"<|reserved_1|>",
|
| 874 |
+
"<|reserved_2|>",
|
| 875 |
+
"<|reserved_3|>",
|
| 876 |
+
"<|reserved_4|>",
|
| 877 |
+
"<|reserved_5|>",
|
| 878 |
+
"<|reserved_6|>",
|
| 879 |
+
"<|reserved_7|>",
|
| 880 |
+
"<|reserved_8|>",
|
| 881 |
+
"<|reserved_9|>",
|
| 882 |
+
"<|reserved_10|>",
|
| 883 |
+
"<|reserved_11|>",
|
| 884 |
+
"<|reserved_12|>",
|
| 885 |
+
"<|reserved_13|>",
|
| 886 |
+
"<|reserved_14|>",
|
| 887 |
+
"<|reserved_15|>",
|
| 888 |
+
"<|reserved_16|>",
|
| 889 |
+
"<|reserved_17|>",
|
| 890 |
+
"<|reserved_18|>",
|
| 891 |
+
"<|reserved_19|>",
|
| 892 |
+
"<|reserved_20|>",
|
| 893 |
+
"<|reserved_21|>",
|
| 894 |
+
"<|reserved_22|>",
|
| 895 |
+
"<|reserved_23|>",
|
| 896 |
+
"<|reserved_24|>",
|
| 897 |
+
"<|reserved_25|>",
|
| 898 |
+
"<|reserved_26|>",
|
| 899 |
+
"<|reserved_27|>",
|
| 900 |
+
"<|reserved_28|>",
|
| 901 |
+
"<|reserved_29|>",
|
| 902 |
+
"<|reserved_30|>",
|
| 903 |
+
"<|reserved_31|>",
|
| 904 |
+
"<|reserved_32|>",
|
| 905 |
+
"<|reserved_33|>",
|
| 906 |
+
"<|reserved_34|>",
|
| 907 |
+
"<|reserved_35|>",
|
| 908 |
+
"<|reserved_36|>",
|
| 909 |
+
"<|reserved_37|>",
|
| 910 |
+
"<|reserved_38|>",
|
| 911 |
+
"<|reserved_39|>",
|
| 912 |
+
"<|reserved_40|>",
|
| 913 |
+
"<|reserved_41|>",
|
| 914 |
+
"<|reserved_42|>",
|
| 915 |
+
"<|reserved_43|>",
|
| 916 |
+
"<|reserved_44|>",
|
| 917 |
+
"<|reserved_45|>",
|
| 918 |
+
"<|reserved_46|>",
|
| 919 |
+
"<|reserved_47|>",
|
| 920 |
+
"<|reserved_48|>",
|
| 921 |
+
"<|reserved_49|>",
|
| 922 |
+
"<|reserved_50|>",
|
| 923 |
+
"<|reserved_51|>",
|
| 924 |
+
"<|reserved_52|>",
|
| 925 |
+
"<|reserved_53|>",
|
| 926 |
+
"<|reserved_54|>",
|
| 927 |
+
"<|reserved_55|>",
|
| 928 |
+
"<|reserved_56|>",
|
| 929 |
+
"<|reserved_57|>",
|
| 930 |
+
"<|reserved_58|>",
|
| 931 |
+
"<|reserved_59|>",
|
| 932 |
+
"<|reserved_60|>",
|
| 933 |
+
"<|reserved_61|>",
|
| 934 |
+
"<|reserved_62|>"
|
| 935 |
+
],
|
| 936 |
+
"auto_map": {
|
| 937 |
+
"AutoProcessor": "processing_minicpmv.MiniCPMVProcessor",
|
| 938 |
+
"AutoTokenizer": [
|
| 939 |
+
"tokenization_qwen2.Qwen2Tokenizer",
|
| 940 |
+
"tokenization_minicpmv_fast.MiniCPMVTokenizerFast"
|
| 941 |
+
]
|
| 942 |
+
},
|
| 943 |
+
"bos_token": "<|im_start|>",
|
| 944 |
+
"clean_up_tokenization_spaces": false,
|
| 945 |
+
"eos_token": "<|im_end|>",
|
| 946 |
+
"errors": "replace",
|
| 947 |
+
"extra_special_tokens": {},
|
| 948 |
+
"model_max_length": 131072,
|
| 949 |
+
"pad_token": "<|endoftext|>",
|
| 950 |
+
"processor_class": "MiniCPMVProcessor",
|
| 951 |
+
"split_special_tokens": false,
|
| 952 |
+
"tokenizer_class": "MiniCPMVTokenizer",
|
| 953 |
+
"unk_token": "<unk>"
|
| 954 |
+
}
|
vocab.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|