ehartford commited on
Commit
7cb2f27
·
verified ·
1 Parent(s): 04048d8

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -0
  2. README.md +152 -0
  3. chat_template.jinja +141 -0
  4. config.json +80 -0
  5. convert.py +259 -0
  6. generation_config.json +14 -0
  7. model-00002-of-00041.safetensors +3 -0
  8. model-00003-of-00041.safetensors +3 -0
  9. model-00004-of-00041.safetensors +3 -0
  10. model-00005-of-00041.safetensors +3 -0
  11. model-00006-of-00041.safetensors +3 -0
  12. model-00007-of-00041.safetensors +3 -0
  13. model-00008-of-00041.safetensors +3 -0
  14. model-00009-of-00041.safetensors +3 -0
  15. model-00010-of-00041.safetensors +3 -0
  16. model-00011-of-00041.safetensors +3 -0
  17. model-00012-of-00041.safetensors +3 -0
  18. model-00013-of-00041.safetensors +3 -0
  19. model-00014-of-00041.safetensors +3 -0
  20. model-00015-of-00041.safetensors +3 -0
  21. model-00016-of-00041.safetensors +3 -0
  22. model-00017-of-00041.safetensors +3 -0
  23. model-00018-of-00041.safetensors +3 -0
  24. model-00019-of-00041.safetensors +3 -0
  25. model-00020-of-00041.safetensors +3 -0
  26. model-00021-of-00041.safetensors +3 -0
  27. model-00022-of-00041.safetensors +3 -0
  28. model-00023-of-00041.safetensors +3 -0
  29. model-00024-of-00041.safetensors +3 -0
  30. model-00025-of-00041.safetensors +3 -0
  31. model-00026-of-00041.safetensors +3 -0
  32. model-00027-of-00041.safetensors +3 -0
  33. model-00028-of-00041.safetensors +3 -0
  34. model-00029-of-00041.safetensors +3 -0
  35. model-00030-of-00041.safetensors +3 -0
  36. model-00031-of-00041.safetensors +3 -0
  37. model-00032-of-00041.safetensors +3 -0
  38. model-00033-of-00041.safetensors +3 -0
  39. model-00034-of-00041.safetensors +3 -0
  40. model-00035-of-00041.safetensors +3 -0
  41. model-00036-of-00041.safetensors +3 -0
  42. model-00037-of-00041.safetensors +3 -0
  43. model-00039-of-00041.safetensors +3 -0
  44. model-00040-of-00041.safetensors +3 -0
  45. model-00041-of-00041.safetensors +3 -0
  46. model.safetensors.index.json +0 -0
  47. preprocessor_config.json +11 -0
  48. requirements.txt +3 -0
  49. tokenizer.json +3 -0
  50. tokenizer_config.json +327 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,152 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # INTELLECT-3-V
2
+
3
+ A vision-language model created by grafting the language model weights from [INTELLECT-3](https://huggingface.co/PrimeIntellect/INTELLECT-3) into the [GLM-4.6V](https://huggingface.co/THUDM/GLM-4.6V) architecture.
4
+
5
+ ## Motivation
6
+
7
+ INTELLECT-3 is a strong open-source language model, but lacks vision capabilities. GLM-4.6V is a vision-language model with an identical language model architecture. By replacing GLM-4.6V's language model weights with INTELLECT-3's weights while preserving the vision encoder and projection layers, we create a vision-language model powered by INTELLECT-3.
8
+
9
+ ## Architecture
10
+
11
+ Both models share the same language model backbone:
12
+ - 46 transformer layers (layer 0 is dense MLP, layers 1-45 are MoE)
13
+ - 4096 hidden dimension
14
+ - 128 routed experts + shared experts per MoE layer
15
+ - Grouped Query Attention (12288 q_proj, 1024 k/v_proj)
16
+ - 151552 vocabulary size
17
+ - BF16 weights
18
+
19
+ GLM-4.6V additionally includes:
20
+ - 24-layer vision transformer (1536 hidden dim)
21
+ - Visual merger projecting vision features to LLM hidden dimension
22
+ - Downsampling convolution for spatial compression
23
+
24
+ ## What Was Grafted
25
+
26
+ The following weights were copied from INTELLECT-3 to GLM-4.6V:
27
+
28
+ | INTELLECT-3 | GLM-4.6V |
29
+ |-------------|----------|
30
+ | `model.layers.*` | `model.language_model.layers.*` |
31
+ | `model.norm.weight` | `model.language_model.norm.weight` |
32
+
33
+ ## What Was Preserved (from GLM-4.6V)
34
+
35
+ - `model.language_model.embed_tokens.weight` — kept to maintain vision token compatibility
36
+ - `lm_head.weight` — kept aligned with embed_tokens
37
+ - `model.visual.*` — entire vision encoder and merger preserved
38
+
39
+ ## Rationale
40
+
41
+ **Why replace the final norm?** The RMSNorm after the last transformer layer is tightly coupled to the layer outputs it normalizes. INTELLECT-3's norm was trained end-to-end with its layers and learned to normalize their specific output distribution.
42
+
43
+ **Why keep embed_tokens?** The vision merger projects visual features into the same embedding space as text tokens. Replacing embed_tokens could break the alignment between text and vision embeddings. Additionally, lm_head is often tied or co-trained with embed_tokens.
44
+
45
+ **Why not replace lm_head?** Same reasoning — keeping lm_head and embed_tokens together maintains their learned relationship.
46
+
47
+ ## Known Limitations
48
+
49
+ 1. **Embedding space mismatch**: INTELLECT-3's layers learned representations in a potentially different embedding space than GLM-4.6V. This may cause some degradation in both language and vision-language performance.
50
+
51
+ 2. **Vision-language alignment**: The visual merger was trained to project into GLM-4.6V's representation space. INTELLECT-3 may have learned different internal representations, potentially affecting vision-language tasks.
52
+
53
+ 3. **Tokenizer compatibility**: While both models have the same vocabulary size (151552), verify tokenizer compatibility for your use case.
54
+
55
+ ## Creation Script
56
+
57
+ The model was created using `graft_intellect3_to_glm.py`:
58
+
59
+ ```bash
60
+ python graft_intellect3_to_glm.py \
61
+ --intellect3 ~/models/INTELLECT-3 \
62
+ --glm ~/models/GLM-4.6V \
63
+ --output ~/models/INTELLECT-3-V
64
+ ```
65
+
66
+ ## Source Model Architectures
67
+
68
+ ### INTELLECT-3
69
+
70
+ ```
71
+ lm_head.weight,[151552,4096],BF16
72
+ model.embed_tokens.weight,[151552,4096],BF16
73
+ model.layers.0.mlp.down_proj.weight,[4096,10944],BF16
74
+ model.layers.0.mlp.gate_proj.weight,[10944,4096],BF16
75
+ model.layers.0.mlp.up_proj.weight,[10944,4096],BF16
76
+ model.layers.[0-45].input_layernorm.weight,[4096],BF16
77
+ model.layers.[0-45].post_attention_layernorm.weight,[4096],BF16
78
+ model.layers.[0-45].self_attn.k_proj.bias,[1024],BF16
79
+ model.layers.[0-45].self_attn.k_proj.weight,[1024,4096],BF16
80
+ model.layers.[0-45].self_attn.o_proj.weight,[4096,12288],BF16
81
+ model.layers.[0-45].self_attn.q_proj.bias,[12288],BF16
82
+ model.layers.[0-45].self_attn.q_proj.weight,[12288,4096],BF16
83
+ model.layers.[0-45].self_attn.v_proj.bias,[1024],BF16
84
+ model.layers.[0-45].self_attn.v_proj.weight,[1024,4096],BF16
85
+ model.layers.[1-45].mlp.experts.[0-127].down_proj.weight,[4096,1408],BF16
86
+ model.layers.[1-45].mlp.experts.[0-127].gate_proj.weight,[1408,4096],BF16
87
+ model.layers.[1-45].mlp.experts.[0-127].up_proj.weight,[1408,4096],BF16
88
+ model.layers.[1-45].mlp.gate.e_score_correction_bias,[128],F32
89
+ model.layers.[1-45].mlp.gate.weight,[128,4096],BF16
90
+ model.layers.[1-45].mlp.shared_experts.down_proj.weight,[4096,1408],BF16
91
+ model.layers.[1-45].mlp.shared_experts.gate_proj.weight,[1408,4096],BF16
92
+ model.layers.[1-45].mlp.shared_experts.up_proj.weight,[1408,4096],BF16
93
+ model.norm.weight,[4096],BF16
94
+ ```
95
+
96
+ ### GLM-4.6V
97
+
98
+ ```
99
+ lm_head.weight,[151552,4096],BF16
100
+ model.language_model.embed_tokens.weight,[151552,4096],BF16
101
+ model.language_model.layers.0.mlp.down_proj.weight,[4096,10944],BF16
102
+ model.language_model.layers.0.mlp.gate_proj.weight,[10944,4096],BF16
103
+ model.language_model.layers.0.mlp.up_proj.weight,[10944,4096],BF16
104
+ model.language_model.layers.[0-45].input_layernorm.weight,[4096],BF16
105
+ model.language_model.layers.[0-45].post_attention_layernorm.weight,[4096],BF16
106
+ model.language_model.layers.[0-45].self_attn.k_proj.bias,[1024],BF16
107
+ model.language_model.layers.[0-45].self_attn.k_proj.weight,[1024,4096],BF16
108
+ model.language_model.layers.[0-45].self_attn.o_proj.weight,[4096,12288],BF16
109
+ model.language_model.layers.[0-45].self_attn.q_proj.bias,[12288],BF16
110
+ model.language_model.layers.[0-45].self_attn.q_proj.weight,[12288,4096],BF16
111
+ model.language_model.layers.[0-45].self_attn.v_proj.bias,[1024],BF16
112
+ model.language_model.layers.[0-45].self_attn.v_proj.weight,[1024,4096],BF16
113
+ model.language_model.layers.[1-45].mlp.experts.[0-127].down_proj.weight,[4096,1408],BF16
114
+ model.language_model.layers.[1-45].mlp.experts.[0-127].gate_proj.weight,[1408,4096],BF16
115
+ model.language_model.layers.[1-45].mlp.experts.[0-127].up_proj.weight,[1408,4096],BF16
116
+ model.language_model.layers.[1-45].mlp.gate.e_score_correction_bias,[128],F32
117
+ model.language_model.layers.[1-45].mlp.gate.weight,[128,4096],BF16
118
+ model.language_model.layers.[1-45].mlp.shared_experts.down_proj.weight,[4096,1408],BF16
119
+ model.language_model.layers.[1-45].mlp.shared_experts.gate_proj.weight,[1408,4096],BF16
120
+ model.language_model.layers.[1-45].mlp.shared_experts.up_proj.weight,[1408,4096],BF16
121
+ model.language_model.norm.weight,[4096],BF16
122
+ model.visual.blocks.[0-23].attn.proj.weight,[1536,1536],BF16
123
+ model.visual.blocks.[0-23].attn.qkv.weight,[4608,1536],BF16
124
+ model.visual.blocks.[0-23].mlp.down_proj.weight,[1536,4096],BF16
125
+ model.visual.blocks.[0-23].mlp.gate_proj.weight,[4096,1536],BF16
126
+ model.visual.blocks.[0-23].mlp.up_proj.weight,[4096,1536],BF16
127
+ model.visual.blocks.[0-23].norm[1-2].weight,[1536],BF16
128
+ model.visual.downsample.bias,[4096],BF16
129
+ model.visual.downsample.weight,[4096,1536,2,2],BF16
130
+ model.visual.embeddings.position_embedding.weight,[576,1536],BF16
131
+ model.visual.merger.down_proj.weight,[4096,10944],BF16
132
+ model.visual.merger.gate_proj.weight,[10944,4096],BF16
133
+ model.visual.merger.post_projection_norm.bias,[4096],BF16
134
+ model.visual.merger.post_projection_norm.weight,[4096],BF16
135
+ model.visual.merger.proj.weight,[4096,4096],BF16
136
+ model.visual.merger.up_proj.weight,[10944,4096],BF16
137
+ model.visual.patch_embed.proj.bias,[1536],BF16
138
+ model.visual.patch_embed.proj.weight,[1536,3,2,14,14],BF16
139
+ model.visual.post_conv_layernorm.weight,[1536],BF16
140
+ model.visual.post_layernorm.weight,[1536],BF16
141
+ ```
142
+
143
+ ## License
144
+
145
+ Please refer to the licenses of the source models:
146
+ - [INTELLECT-3 License](https://huggingface.co/PrimeIntellect/INTELLECT-3)
147
+ - [GLM-4.6V License](https://huggingface.co/THUDM/GLM-4.6V)
148
+
149
+ ## Acknowledgments
150
+
151
+ - [Prime Intellect](https://www.primeintellect.ai/) for INTELLECT-3
152
+ - [THUDM](https://github.com/THUDM) for GLM-4.6V
chat_template.jinja ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [gMASK]<sop>
2
+ {%- if tools -%}
3
+ <|system|>
4
+ # Tools
5
+
6
+ You may call one or more functions to assist with the user query.
7
+
8
+ You are provided with function signatures within <tools></tools> XML tags:
9
+ <tools>
10
+ {% for tool in tools %}
11
+ {{ tool | tojson(ensure_ascii=False) }}
12
+ {% endfor %}
13
+ </tools>
14
+
15
+ For each function call, output the function name and arguments within the following XML format:
16
+ <tool_call>{function-name}
17
+ <arg_key>{arg-key-1}</arg_key>
18
+ <arg_value>{arg-value-1}</arg_value>
19
+ <arg_key>{arg-key-2}</arg_key>
20
+ <arg_value>{arg-value-2}</arg_value>
21
+ ...
22
+ </tool_call>{%- endif -%}
23
+ {%- macro visible_text(content) -%}
24
+ {%- if content is string -%}
25
+ {{- content }}
26
+ {%- elif content is iterable and content is not mapping -%}
27
+ {%- for item in content -%}
28
+ {%- if item is mapping and item.type == 'text' -%}
29
+ {{- item.text }}
30
+ {%- elif item is mapping and (item.type == 'image' or 'image' in item) -%}
31
+ <|begin_of_image|><|image|><|end_of_image|>
32
+ {%- elif item is mapping and (item.type == 'video' or 'video' in item) -%}
33
+ <|begin_of_video|><|video|><|end_of_video|>
34
+ {%- elif item is string -%}
35
+ {{- item }}
36
+ {%- endif -%}
37
+ {%- endfor -%}
38
+ {%- else -%}
39
+ {{- content }}
40
+ {%- endif -%}
41
+ {%- endmacro -%}
42
+ {%- set ns = namespace(last_user_index=-1) %}
43
+ {%- for m in messages %}
44
+ {%- if m.role == 'user' %}
45
+ {% set ns.last_user_index = loop.index0 -%}
46
+ {%- endif %}
47
+ {%- endfor %}
48
+ {% for m in messages %}
49
+ {%- if m.role == 'user' -%}<|user|>
50
+ {% if m.content is string %}
51
+ {{ m.content }}
52
+ {%- else %}
53
+ {%- for item in m.content %}
54
+ {% if item.type == 'video' or 'video' in item %}
55
+ <|begin_of_video|><|video|><|end_of_video|>{% elif item.type == 'image' or 'image' in item %}
56
+ <|begin_of_image|><|image|><|end_of_image|>{% elif item.type == 'text' %}
57
+ {{ item.text }}
58
+ {%- endif %}
59
+ {%- endfor %}
60
+ {%- endif %}
61
+ {{- '/nothink' if (enable_thinking is defined and not enable_thinking and not visible_text(m.content).endswith("/nothink")) else '' -}}
62
+ {%- elif m.role == 'assistant' -%}
63
+ <|assistant|>
64
+ {%- set reasoning_content = '' %}
65
+ {%- set content = visible_text(m.content) %}
66
+ {%- if m.reasoning_content is string %}
67
+ {%- set reasoning_content = m.reasoning_content %}
68
+ {%- else %}
69
+ {%- if '</think>' in content %}
70
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
71
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
72
+ {%- endif %}
73
+ {%- endif %}
74
+ {%- if loop.index0 > ns.last_user_index and reasoning_content -%}
75
+ {{ '\n<think>' + reasoning_content.strip() + '</think>'}}
76
+ {%- else -%}
77
+ {{ '\n<think></think>' }}
78
+ {%- endif -%}
79
+ {%- if content.strip() -%}
80
+ {{ '\n' + content.strip() }}
81
+ {%- endif -%}
82
+ {% if m.tool_calls %}
83
+ {% for tc in m.tool_calls %}
84
+ {%- if tc.function %}
85
+ {%- set tc = tc.function %}
86
+ {%- endif %}
87
+ {{ '\n<tool_call>' + tc.name }}
88
+ {% set _args = tc.arguments %}
89
+ {% for k, v in _args.items() %}
90
+ <arg_key>{{ k }}</arg_key>
91
+ <arg_value>{{ v | tojson(ensure_ascii=False) if v is not string else v }}</arg_value>
92
+ {% endfor %}
93
+ </tool_call>{% endfor %}
94
+ {% endif %}
95
+ {%- elif m.role == 'tool' -%}
96
+ {%- if m.content is string -%}
97
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
98
+ {{- '<|observation|>' }}
99
+ {%- endif %}
100
+ {{- '\n<tool_response>\n' }}
101
+ {{- m.content }}
102
+ {{- '\n</tool_response>' }}
103
+ {% elif m.content is iterable and m.content is not mapping %}
104
+ {%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
105
+ {{- '<|observation|>' }}
106
+ {%- endif %}
107
+ {{- '\n<tool_response>\n' }}
108
+ {%- for tr in m.content -%}
109
+ {%- if tr is mapping and tr.type is defined -%}
110
+ {%- set t = tr.type | lower -%}
111
+ {%- if t == 'text' and tr.text is defined -%}
112
+ {{ tr.text }}
113
+ {%- elif t in ['image', 'image_url'] -%}
114
+ <|begin_of_image|><|image|><|end_of_image|>
115
+ {%- elif t in ['video', 'video_url'] -%}
116
+ <|begin_of_video|><|video|><|end_of_video|>
117
+ {%- else -%}
118
+ {{ tr | tojson(ensure_ascii=False) }}
119
+ {%- endif -%}
120
+ {%- else -%}
121
+ {{ tr.output if tr.output is defined else tr }}
122
+ {%- endif -%}
123
+ {%- endfor -%}
124
+ {{- '\n</tool_response>' }}
125
+ {%- else -%}
126
+ <|observation|>{% for tr in m.content %}
127
+
128
+ <tool_response>
129
+ {{ tr.output if tr.output is defined else tr }}
130
+ </tool_response>{% endfor -%}
131
+ {% endif -%}
132
+ {# ====== 逻辑结束 ====== #}
133
+ {%- elif m.role == 'system' -%}
134
+ <|system|>
135
+ {{ visible_text(m.content) }}
136
+ {%- endif -%}
137
+ {%- endfor -%}
138
+ {%- if add_generation_prompt -%}
139
+ <|assistant|>
140
+ {{'<think></think>\n' if (enable_thinking is defined and not enable_thinking) else ''}}
141
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Glm4vMoeForConditionalGeneration"
4
+ ],
5
+ "model_type": "glm4v_moe",
6
+ "text_config": {
7
+ "attention_bias": true,
8
+ "attention_dropout": 0.0,
9
+ "dtype": "bfloat16",
10
+ "eos_token_id": [
11
+ 151329,
12
+ 151336,
13
+ 151338
14
+ ],
15
+ "first_k_dense_replace": 1,
16
+ "head_dim": 128,
17
+ "hidden_act": "silu",
18
+ "hidden_size": 4096,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 10944,
21
+ "max_position_embeddings": 131072,
22
+ "model_type": "glm4v_moe_text",
23
+ "moe_intermediate_size": 1408,
24
+ "n_group": 1,
25
+ "n_routed_experts": 128,
26
+ "n_shared_experts": 1,
27
+ "norm_topk_prob": true,
28
+ "num_attention_heads": 96,
29
+ "num_experts_per_tok": 8,
30
+ "num_hidden_layers": 46,
31
+ "num_key_value_heads": 8,
32
+ "num_nextn_predict_layers": 0,
33
+ "pad_token_id": 151329,
34
+ "partial_rotary_factor": 0.5,
35
+ "qk_layernorm": false,
36
+ "rms_norm_eps": 1e-05,
37
+ "rope_parameters": {
38
+ "mrope_section": [
39
+ 8,
40
+ 12,
41
+ 12
42
+ ],
43
+ "partial_rotary_factor": 0.5,
44
+ "rope_theta": 500000,
45
+ "rope_type": "default"
46
+ },
47
+ "routed_scaling_factor": 1.0,
48
+ "topk_group": 1,
49
+ "use_cache": true,
50
+ "use_qk_norm": false,
51
+ "vocab_size": 151552
52
+ },
53
+ "tie_word_embeddings": false,
54
+ "transformers_version": "5.0.0rc0",
55
+ "image_start_token_id": 151339,
56
+ "image_end_token_id": 151340,
57
+ "video_start_token_id": 151341,
58
+ "video_end_token_id": 151342,
59
+ "image_token_id": 151363,
60
+ "video_token_id": 151364,
61
+ "vision_config": {
62
+ "attention_bias": false,
63
+ "attention_dropout": 0.0,
64
+ "depth": 24,
65
+ "hidden_act": "silu",
66
+ "hidden_dropout_prob": 0.0,
67
+ "hidden_size": 1536,
68
+ "image_size": 336,
69
+ "in_channels": 3,
70
+ "initializer_range": 0.02,
71
+ "intermediate_size": 10944,
72
+ "model_type": "glm4v_moe_vision",
73
+ "num_heads": 12,
74
+ "out_hidden_size": 4096,
75
+ "patch_size": 14,
76
+ "rms_norm_eps": 1e-05,
77
+ "spatial_merge_size": 2,
78
+ "temporal_patch_size": 2
79
+ }
80
+ }
convert.py ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Graft INTELLECT-3 language model weights into GLM-4.6V vision-language model.
4
+
5
+ This script:
6
+ 1. Loads both models into CPU memory
7
+ 2. Copies model.layers.* from INTELLECT-3 to model.language_model.layers.* in GLM-4.6V
8
+ 3. Copies model.norm.weight from INTELLECT-3 to model.language_model.norm.weight in GLM-4.6V
9
+ 4. Saves the resulting model to a new directory
10
+
11
+ Does NOT touch:
12
+ - model.language_model.embed_tokens (needed for vision token compatibility)
13
+ - lm_head (kept aligned with embed_tokens)
14
+ - model.visual.* (vision encoder preserved)
15
+ """
16
+
17
+ import os
18
+ import argparse
19
+ import json
20
+ import shutil
21
+ from pathlib import Path
22
+ from safetensors import safe_open
23
+ from safetensors.torch import save_file
24
+ import torch
25
+ from tqdm import tqdm
26
+
27
+
28
+ def get_safetensor_files(model_dir: Path) -> list[Path]:
29
+ """Get all safetensor files in a model directory."""
30
+ files = sorted(model_dir.glob("*.safetensors"))
31
+ if not files:
32
+ raise FileNotFoundError(f"No safetensor files found in {model_dir}")
33
+ return files
34
+
35
+
36
+ def load_state_dict_from_safetensors(model_dir: Path) -> dict[str, torch.Tensor]:
37
+ """Load all tensors from safetensor files into a state dict."""
38
+ state_dict = {}
39
+ files = get_safetensor_files(model_dir)
40
+
41
+ for f in tqdm(files, desc=f"Loading {model_dir.name}"):
42
+ with safe_open(f, framework="pt", device="cpu") as st:
43
+ for key in st.keys():
44
+ state_dict[key] = st.get_tensor(key)
45
+
46
+ return state_dict
47
+
48
+
49
+ def graft_weights(
50
+ intellect3_state: dict[str, torch.Tensor],
51
+ glm_state: dict[str, torch.Tensor]
52
+ ) -> dict[str, torch.Tensor]:
53
+ """
54
+ Graft INTELLECT-3 weights into GLM-4.6V state dict.
55
+
56
+ Mapping:
57
+ - model.layers.* -> model.language_model.layers.*
58
+ - model.norm.weight -> model.language_model.norm.weight
59
+ """
60
+ grafted_state = dict(glm_state) # shallow copy
61
+
62
+ grafted_count = 0
63
+ skipped_keys = []
64
+
65
+ for intellect_key, tensor in tqdm(intellect3_state.items(), desc="Grafting weights"):
66
+ # Skip embed_tokens and lm_head from INTELLECT-3
67
+ if "embed_tokens" in intellect_key or "lm_head" in intellect_key:
68
+ skipped_keys.append(intellect_key)
69
+ continue
70
+
71
+ # Map model.layers.* -> model.language_model.layers.*
72
+ if intellect_key.startswith("model.layers."):
73
+ glm_key = intellect_key.replace("model.layers.", "model.language_model.layers.")
74
+ # Map model.norm.weight -> model.language_model.norm.weight
75
+ elif intellect_key == "model.norm.weight":
76
+ glm_key = "model.language_model.norm.weight"
77
+ else:
78
+ skipped_keys.append(intellect_key)
79
+ continue
80
+
81
+ # Verify the key exists in GLM and shapes match
82
+ if glm_key not in grafted_state:
83
+ print(f"WARNING: {glm_key} not found in GLM-4.6V state dict!")
84
+ continue
85
+
86
+ if grafted_state[glm_key].shape != tensor.shape:
87
+ print(f"WARNING: Shape mismatch for {glm_key}:")
88
+ print(f" INTELLECT-3: {tensor.shape}")
89
+ print(f" GLM-4.6V: {grafted_state[glm_key].shape}")
90
+ continue
91
+
92
+ grafted_state[glm_key] = tensor
93
+ grafted_count += 1
94
+
95
+ print(f"\nGrafted {grafted_count} tensors from INTELLECT-3")
96
+ print(f"Skipped {len(skipped_keys)} tensors: {skipped_keys[:5]}{'...' if len(skipped_keys) > 5 else ''}")
97
+
98
+ return grafted_state
99
+
100
+
101
+ def save_state_dict_to_safetensors(
102
+ state_dict: dict[str, torch.Tensor],
103
+ output_dir: Path,
104
+ max_shard_size: int = 5 * 1024 ** 3 # 5GB default
105
+ ):
106
+ """Save state dict to sharded safetensor files."""
107
+ output_dir.mkdir(parents=True, exist_ok=True)
108
+
109
+ # Calculate total size and plan shards
110
+ tensors_by_size = [(k, v, v.numel() * v.element_size()) for k, v in state_dict.items()]
111
+ total_size = sum(size for _, _, size in tensors_by_size)
112
+
113
+ print(f"\nTotal model size: {total_size / 1024**3:.2f} GB")
114
+
115
+ # Create shards
116
+ shards = []
117
+ current_shard = {}
118
+ current_size = 0
119
+
120
+ for key, tensor, size in tensors_by_size:
121
+ if current_size + size > max_shard_size and current_shard:
122
+ shards.append(current_shard)
123
+ current_shard = {}
124
+ current_size = 0
125
+
126
+ current_shard[key] = tensor
127
+ current_size += size
128
+
129
+ if current_shard:
130
+ shards.append(current_shard)
131
+
132
+ print(f"Saving to {len(shards)} shard(s)...")
133
+
134
+ # Save shards and build index
135
+ weight_map = {}
136
+
137
+ for i, shard in enumerate(tqdm(shards, desc="Saving shards")):
138
+ if len(shards) == 1:
139
+ filename = "model.safetensors"
140
+ else:
141
+ filename = f"model-{i+1:05d}-of-{len(shards):05d}.safetensors"
142
+
143
+ filepath = output_dir / filename
144
+ save_file(shard, filepath)
145
+
146
+ for key in shard.keys():
147
+ weight_map[key] = filename
148
+
149
+ # Save index if sharded
150
+ if len(shards) > 1:
151
+ index = {
152
+ "metadata": {"total_size": total_size},
153
+ "weight_map": weight_map
154
+ }
155
+ with open(output_dir / "model.safetensors.index.json", "w") as f:
156
+ json.dump(index, f, indent=2)
157
+
158
+ return weight_map
159
+
160
+
161
+ def copy_config_files(src_dir: Path, dst_dir: Path):
162
+ """Copy config files from source to destination."""
163
+ config_files = [
164
+ "config.json",
165
+ "tokenizer.json",
166
+ "tokenizer_config.json",
167
+ "special_tokens_map.json",
168
+ "generation_config.json",
169
+ "preprocessor_config.json",
170
+ "chat_template.json",
171
+ ]
172
+
173
+ for filename in config_files:
174
+ src_file = src_dir / filename
175
+ if src_file.exists():
176
+ shutil.copy2(src_file, dst_dir / filename)
177
+ print(f"Copied {filename}")
178
+
179
+
180
+ def main():
181
+ parser = argparse.ArgumentParser(
182
+ description="Graft INTELLECT-3 weights into GLM-4.6V"
183
+ )
184
+ parser.add_argument(
185
+ "--intellect3",
186
+ type=Path,
187
+ default=Path.home() / "models" / "INTELLECT-3",
188
+ help="Path to INTELLECT-3 model directory"
189
+ )
190
+ parser.add_argument(
191
+ "--glm",
192
+ type=Path,
193
+ default=Path.home() / "models" / "GLM-4.6V",
194
+ help="Path to GLM-4.6V model directory"
195
+ )
196
+ parser.add_argument(
197
+ "--output",
198
+ type=Path,
199
+ default=Path.home() / "models" / "INTELLECT-3-V",
200
+ help="Path to output directory"
201
+ )
202
+ parser.add_argument(
203
+ "--shard-size",
204
+ type=int,
205
+ default=5,
206
+ help="Maximum shard size in GB (default: 5)"
207
+ )
208
+
209
+ args = parser.parse_args()
210
+
211
+ print("=" * 60)
212
+ print("INTELLECT-3 -> GLM-4.6V Weight Grafting")
213
+ print("=" * 60)
214
+ print(f"INTELLECT-3 source: {args.intellect3}")
215
+ print(f"GLM-4.6V source: {args.glm}")
216
+ print(f"Output directory: {args.output}")
217
+ print("=" * 60)
218
+
219
+ # Verify source directories exist
220
+ if not args.intellect3.exists():
221
+ raise FileNotFoundError(f"INTELLECT-3 directory not found: {args.intellect3}")
222
+ if not args.glm.exists():
223
+ raise FileNotFoundError(f"GLM-4.6V directory not found: {args.glm}")
224
+
225
+ # Load both models
226
+ print("\nStep 1: Loading models into CPU memory...")
227
+ intellect3_state = load_state_dict_from_safetensors(args.intellect3)
228
+ glm_state = load_state_dict_from_safetensors(args.glm)
229
+
230
+ print(f"\nINTELLECT-3 tensors: {len(intellect3_state)}")
231
+ print(f"GLM-4.6V tensors: {len(glm_state)}")
232
+
233
+ # Graft weights
234
+ print("\nStep 2: Grafting INTELLECT-3 weights into GLM-4.6V...")
235
+ grafted_state = graft_weights(intellect3_state, glm_state)
236
+
237
+ # Free memory from source models
238
+ del intellect3_state
239
+ del glm_state
240
+
241
+ # Save grafted model
242
+ print("\nStep 3: Saving grafted model...")
243
+ save_state_dict_to_safetensors(
244
+ grafted_state,
245
+ args.output,
246
+ max_shard_size=args.shard_size * 1024 ** 3
247
+ )
248
+
249
+ # Copy config files from GLM-4.6V (since we're keeping its architecture)
250
+ print("\nStep 4: Copying config files from GLM-4.6V...")
251
+ copy_config_files(args.glm, args.output)
252
+
253
+ print("\n" + "=" * 60)
254
+ print("Done! Grafted model saved to:", args.output)
255
+ print("=" * 60)
256
+
257
+
258
+ if __name__ == "__main__":
259
+ main()
generation_config.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "do_sample": true,
4
+ "eos_token_id": [
5
+ 151329,
6
+ 151336,
7
+ 151338
8
+ ],
9
+ "pad_token_id": 151329,
10
+ "top_p": 0.6,
11
+ "temperature": 0.8,
12
+ "top_k": 2,
13
+ "transformers_version": "5.0.0rc0"
14
+ }
model-00002-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:04e16916549c3f2c5beaaa8ce76c48a73260af7e0a019ea96adbbe3ffca2923b
3
+ size 5363575312
model-00003-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:294d4ade39bb96ef966cc241c190b17bff37210a1dd6ea41a53620c598214309
3
+ size 5363619592
model-00004-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:070a9a69f9cceeb0514e07e565c0bca22ef02412b5ea67083470df9d9f862f02
3
+ size 5363575224
model-00005-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5c6c7badf80f149045fd76946a03c4e152b1a9490606bde43b0e478249752e41
3
+ size 5363575224
model-00006-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:43ae1a55c7a4f08899c926f2dc69ca09cbec5c0ee5066d043eb8df36a5b6d544
3
+ size 5363575224
model-00007-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9d57281997daedd2cd8bfb64bef13d01fc48fa69d8ae627d35d0dece2803704a
3
+ size 5363575272
model-00008-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:acb579063d3e0aef416c935469aeeb4ef71121bbddf65c75bcfd04b5186b902d
3
+ size 5363566960
model-00009-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5537541ed849d1aec5a03ba3f6fbd412420ecc123baf6407392ebf9ec79a1778
3
+ size 5363583992
model-00010-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:910065ed4f943bde57e99b614995a025d22083f9dba9e74a78f5b0b08cf613a5
3
+ size 5363620024
model-00011-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38d068184dedf2e75febd4500f7dbac3c304da64a916a5504325055bbb0db36b
3
+ size 5363575680
model-00012-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:62e8f7bb30f6f67beea4a9c046f2757ea9b6063a3e43c9751be12300caf4acac
3
+ size 5363575680
model-00013-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b05c10ffd6afdce59491acbae09d8d6276210aca5aef1f6e7a54bcc48aa15750
3
+ size 5363575688
model-00014-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a92ae88cb4cec2c5edae04e7a8ba515892131b9294e212d3e5297c6e7e6a3e56
3
+ size 5363575728
model-00015-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6fd86d501d81c538c6215c096318a4d0813ac149eacf6b8dc32384ed3a6580fc
3
+ size 5363575736
model-00016-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8e53b380fdb8442cf5199a8d099fbf633f7cc201030c4cbbec7a24e76636687
3
+ size 5361489896
model-00017-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7dd04e94143cc3ab4959e7be4e99b725dcd6dfb6be448d5a71827ede6434e7ce
3
+ size 5365705936
model-00018-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:34921251b4117d709f9b870def609c06a0ee19a947591326740846f3e395c29a
3
+ size 5363575680
model-00019-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cfac271a321ffdf71f18339d68ca9a963b561e66482939d27037b037b6f591e7
3
+ size 5363575680
model-00020-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cc665d4223264593cdfb236f9983d35cbfb8d22b75659cfd70cf812392fa1560
3
+ size 5363575696
model-00021-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e24a876ca2551d8f26bcbde6ab69eb0912b7d381c3d7032c44c85780c49c3ce8
3
+ size 5363575736
model-00022-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2fe3b04644e856b30b50fd58f821458166b65807962d8d8afbd9789b063b96c8
3
+ size 5363575736
model-00023-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:294316579802e473bc9067b5d63ff3e3c3336b2601fba86b0fcbc32a61dfca6d
3
+ size 5280748552
model-00024-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:abbe67f9fe5867bd046d7952f035ea4a317695427ed09732da863a49f10f120f
3
+ size 5365705928
model-00025-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9c550e04a34e8996ff55eb04e5f07131dbeeeda8b6ce8c261262b3bf010ac6ee
3
+ size 5363575680
model-00026-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:51242ebda76d87c6b6554e89646efe52d5378c9c4151ccaa5682b241114f892a
3
+ size 5363575680
model-00027-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:61ba10028421f788dd6bda5f923a7070a14da5ca94829e851eff5eec8e63d750
3
+ size 5363575696
model-00028-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2465c61939b44de2a1c01e813784b1f5ed13174a31482e9ef27173d7c956cdf0
3
+ size 5363575728
model-00029-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ae8a9fe785fe86f299c3fd9a54c708eb3f7bb26c63f9ad15761776d23d6cf3c9
3
+ size 5363575736
model-00030-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b8f3d581024b5782391e7a848ab952e663a59ce93c62df55f9209e58e270b214
3
+ size 5361478264
model-00031-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4ab10f73490a4d676b90eb06ea7b402fbbc8145c9cc3de9f2b2170b5b8a4739
3
+ size 5365717520
model-00032-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0a222975edd317613a379b812f92d05ee00bb414af3fda0437ab0474ddc1c617
3
+ size 5363575680
model-00033-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7f02049b5ce95890500ce992b9cd75282e89e5ad276d5c1f6999336d4794eabf
3
+ size 5363575680
model-00034-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:088a6843e5334436c9f85679a029b4b471f6f1b85238175b59bce1d27bf43cdb
3
+ size 5363575704
model-00035-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:194df5d2ce09178c02104cc3a23823b739c458b7b9504b389461ce45f6f661e3
3
+ size 5363575728
model-00036-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8c5dee2d30f392e6ebe05c3569d12f3dacf3bf3b71c2e0c0ab130a1d1fe1e36e
3
+ size 5363575736
model-00037-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:220dd8e4c825621a54251220ffa87d02080cd4e0955b29dcc61f050643778f38
3
+ size 5309059384
model-00039-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:15e9c3446f8a3d34e9f7112e72532fa026d52738376269862db7c93ab5e1eb76
3
+ size 5363567360
model-00040-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6c482478e5d4f5e0e4d77ba4cb4f0ba75a749c94e526dee1ef6c1e5281ebcf22
3
+ size 5360945920
model-00041-of-00041.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ea489fae1616921703724208cf7c6b9aa2ef4eae0e0acc06f1e456f5cdd8646
3
+ size 1023744840
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "size": {"shortest_edge": 12544, "longest_edge": 9633792},
3
+ "do_rescale": true,
4
+ "patch_size": 14,
5
+ "temporal_patch_size": 2,
6
+ "merge_size": 2,
7
+ "image_mean": [0.48145466, 0.4578275, 0.40821073],
8
+ "image_std": [0.26862954, 0.26130258, 0.27577711],
9
+ "image_processor_type": "Glm46VImageProcessor",
10
+ "processor_class": "Glm46VProcessor"
11
+ }
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ torch
2
+ safetensors
3
+ tqdm
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9340665016419c825c4bdabbcc9acc43b7ca2c68ce142724afa829abb1be5efd
3
+ size 19970699
tokenizer_config.json ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "151329": {
4
+ "content": "<|endoftext|>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "151330": {
12
+ "content": "[MASK]",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "151331": {
20
+ "content": "[gMASK]",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "151332": {
28
+ "content": "[sMASK]",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "151333": {
36
+ "content": "<sop>",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "151334": {
44
+ "content": "<eop>",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "151335": {
52
+ "content": "<|system|>",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "151336": {
60
+ "content": "<|user|>",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "151337": {
68
+ "content": "<|assistant|>",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "151338": {
76
+ "content": "<|observation|>",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "151339": {
84
+ "content": "<|begin_of_image|>",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "151340": {
92
+ "content": "<|end_of_image|>",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "151341": {
100
+ "content": "<|begin_of_video|>",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "151342": {
108
+ "content": "<|end_of_video|>",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "151343": {
116
+ "content": "<|begin_of_audio|>",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "151344": {
124
+ "content": "<|end_of_audio|>",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "151345": {
132
+ "content": "<|begin_of_transcription|>",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "151346": {
140
+ "content": "<|end_of_transcription|>",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ },
147
+ "151347": {
148
+ "content": "<|code_prefix|>",
149
+ "lstrip": false,
150
+ "normalized": false,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": true
154
+ },
155
+ "151348": {
156
+ "content": "<|code_middle|>",
157
+ "lstrip": false,
158
+ "normalized": false,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": true
162
+ },
163
+ "151349": {
164
+ "content": "<|code_suffix|>",
165
+ "lstrip": false,
166
+ "normalized": false,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": true
170
+ },
171
+ "151350": {
172
+ "content": "<think>",
173
+ "lstrip": false,
174
+ "normalized": false,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": false
178
+ },
179
+ "151351": {
180
+ "content": "</think>",
181
+ "lstrip": false,
182
+ "normalized": false,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": false
186
+ },
187
+ "151352": {
188
+ "content": "<tool_call>",
189
+ "lstrip": false,
190
+ "normalized": false,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": false
194
+ },
195
+ "151353": {
196
+ "content": "</tool_call>",
197
+ "lstrip": false,
198
+ "normalized": false,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": false
202
+ },
203
+ "151354": {
204
+ "content": "<tool_response>",
205
+ "lstrip": false,
206
+ "normalized": false,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": false
210
+ },
211
+ "151355": {
212
+ "content": "</tool_response>",
213
+ "lstrip": false,
214
+ "normalized": false,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": false
218
+ },
219
+ "151356": {
220
+ "content": "<arg_key>",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": false
226
+ },
227
+ "151357": {
228
+ "content": "</arg_key>",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": false
234
+ },
235
+ "151358": {
236
+ "content": "<arg_value>",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": false
242
+ },
243
+ "151359": {
244
+ "content": "</arg_value>",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": false
250
+ },
251
+ "151360": {
252
+ "content": "/nothink",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "151361": {
260
+ "content": "<|begin_of_box|>",
261
+ "lstrip": false,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": false
266
+ },
267
+ "151362": {
268
+ "content": "<|end_of_box|>",
269
+ "lstrip": false,
270
+ "normalized": false,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": false
274
+ },
275
+ "151363": {
276
+ "content": "<|image|>",
277
+ "lstrip": false,
278
+ "normalized": false,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": false
282
+ },
283
+ "151364": {
284
+ "content": "<|video|>",
285
+ "lstrip": false,
286
+ "normalized": false,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": false
290
+ }
291
+ },
292
+ "additional_special_tokens": [
293
+ "<|endoftext|>",
294
+ "[MASK]",
295
+ "[gMASK]",
296
+ "[sMASK]",
297
+ "<sop>",
298
+ "<eop>",
299
+ "<|system|>",
300
+ "<|user|>",
301
+ "<|assistant|>",
302
+ "<|observation|>",
303
+ "<|begin_of_image|>",
304
+ "<|end_of_image|>",
305
+ "<|begin_of_video|>",
306
+ "<|end_of_video|>",
307
+ "<|begin_of_audio|>",
308
+ "<|end_of_audio|>",
309
+ "<|image|>",
310
+ "<|video|>",
311
+ "<|begin_of_transcription|>",
312
+ "<|end_of_transcription|>",
313
+ "<|code_prefix|>",
314
+ "<|code_middle|>",
315
+ "<|code_suffix|>",
316
+ "/nothink"
317
+ ],
318
+ "clean_up_tokenization_spaces": false,
319
+ "do_lower_case": false,
320
+ "eos_token": "<|endoftext|>",
321
+ "extra_special_tokens": {},
322
+ "model_max_length": 128000,
323
+ "pad_token": "<|endoftext|>",
324
+ "padding_side": "left",
325
+ "remove_space": false,
326
+ "tokenizer_class": "PreTrainedTokenizer"
327
+ }