yujiepan commited on
Commit
d847a87
·
verified ·
1 Parent(s): e5ef62c

Upload folder using huggingface_hub

Browse files
.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,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: transformers
3
+ base_model:
4
+ - zai-org/GLM-4.6V
5
+ ---
6
+
7
+ This tiny model is intended for debugging. It is randomly initialized using the configuration adapted from [zai-org/GLM-4.6V](https://huggingface.co/zai-org/GLM-4.6V).
8
+
9
+ ### Example usage:
10
+
11
+ ```python
12
+ import torch
13
+ from transformers import AutoProcessor, Glm4vMoeForConditionalGeneration
14
+
15
+ model_id = "tiny-random/glm-4.6v"
16
+ messages = [
17
+ {
18
+ "role": "user",
19
+ "content": [
20
+ {
21
+ "type": "image",
22
+ "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"
23
+ },
24
+ {
25
+ "type": "text",
26
+ "text": "describe this image"
27
+ }
28
+ ],
29
+ }
30
+ ]
31
+ processor = AutoProcessor.from_pretrained(model_id)
32
+ model = Glm4vMoeForConditionalGeneration.from_pretrained(
33
+ model_id,
34
+ torch_dtype=torch.bfloat16,
35
+ device_map="cuda",
36
+ )
37
+ inputs = processor.apply_chat_template(
38
+ messages,
39
+ tokenize=True,
40
+ add_generation_prompt=True,
41
+ return_dict=True,
42
+ return_tensors="pt"
43
+ ).to(model.device)
44
+ inputs.pop("token_type_ids", None)
45
+ generated_ids = model.generate(**inputs, max_new_tokens=16)
46
+ output_text = processor.decode(
47
+ generated_ids[0][inputs["input_ids"].shape[1]:], skip_special_tokens=False)
48
+ print(output_text)
49
+ ```
50
+
51
+ ### Codes to create this repo:
52
+
53
+ ```python
54
+ import json
55
+ from pathlib import Path
56
+
57
+ import accelerate
58
+ import torch
59
+ from huggingface_hub import file_exists, hf_hub_download
60
+ from transformers import (
61
+ AutoConfig,
62
+ AutoModelForCausalLM,
63
+ AutoProcessor,
64
+ GenerationConfig,
65
+ Glm4vForConditionalGeneration,
66
+ Glm4vMoeForConditionalGeneration,
67
+ set_seed,
68
+ )
69
+ from transformers.models.glm4v_moe.modeling_glm4v_moe import Glm4vMoeTextTopkRouter
70
+
71
+ source_model_id = "zai-org/GLM-4.6V"
72
+ save_folder = "/tmp/tiny-random/glm-4.6v"
73
+ processor = AutoProcessor.from_pretrained(
74
+ source_model_id, trust_remote_code=True)
75
+ processor.save_pretrained(save_folder)
76
+
77
+ with open(hf_hub_download(source_model_id, filename='config.json', repo_type='model'), 'r', encoding='utf-8') as f:
78
+ config_json = json.load(f)
79
+ config_json['text_config'].update({
80
+ "hidden_size": 8,
81
+ "head_dim": 32,
82
+ "intermediate_size": 64,
83
+ "first_k_dense_replace": 1,
84
+ "moe_intermediate_size": 64,
85
+ "num_attention_heads": 8,
86
+ "num_key_value_heads": 4,
87
+ "num_hidden_layers": 2, # one dense, one moe
88
+ "tie_word_embeddings": True,
89
+ })
90
+ config_json['text_config']['rope_parameters']['mrope_section'] = [2, 2, 4]
91
+ config_json['vision_config']['hidden_size'] = 64
92
+ config_json['vision_config']['depth'] = 2
93
+ config_json['vision_config']['num_heads'] = 2
94
+ config_json['vision_config']['intermediate_size'] = 64
95
+ config_json['vision_config']['out_hidden_size'] = config_json['text_config']['hidden_size']
96
+
97
+ with open(f"{save_folder}/config.json", "w", encoding='utf-8') as f:
98
+ json.dump(config_json, f, indent=2)
99
+
100
+ config = AutoConfig.from_pretrained(
101
+ save_folder,
102
+ trust_remote_code=True,
103
+ )
104
+ print(config)
105
+ torch.set_default_dtype(torch.bfloat16)
106
+ model = Glm4vMoeForConditionalGeneration(config)
107
+ torch.set_default_dtype(torch.float32)
108
+ if file_exists(filename="generation_config.json", repo_id=source_model_id, repo_type='model'):
109
+ model.generation_config = GenerationConfig.from_pretrained(
110
+ source_model_id, trust_remote_code=True,
111
+ )
112
+ set_seed(42)
113
+ model = model.cpu() # cpu is more stable for random initialization across machines
114
+ num_params = sum(p.numel() for p in model.parameters())
115
+ with torch.no_grad():
116
+ for name, p in sorted(model.named_parameters()):
117
+ torch.nn.init.normal_(p, 0, 0.1)
118
+ print(name, p.shape, p.dtype, p.device,
119
+ f'{p.numel() / num_params * 100: .2f}%')
120
+ for _, m in sorted(model.named_modules()):
121
+ if isinstance(m, Glm4vMoeTextTopkRouter):
122
+ assert 'e_score_correction_bias' in m.state_dict()
123
+ torch.nn.init.normal_(m.e_score_correction_bias, 0, 1)
124
+ model.save_pretrained(save_folder)
125
+ print(model)
126
+ ```
127
+
128
+ ### Printing the model:
129
+
130
+ ```text
131
+ Glm4vMoeForConditionalGeneration(
132
+ (model): Glm4vMoeModel(
133
+ (visual): Glm4vMoeVisionModel(
134
+ (embeddings): Glm4vMoeVisionEmbeddings(
135
+ (position_embedding): Embedding(576, 64)
136
+ )
137
+ (patch_embed): Glm4vMoeVisionPatchEmbed(
138
+ (proj): Conv3d(3, 64, kernel_size=(2, 14, 14), stride=(2, 14, 14))
139
+ )
140
+ (rotary_pos_emb): Glm4vMoeVisionRotaryEmbedding()
141
+ (blocks): ModuleList(
142
+ (0-1): 2 x Glm4vMoeVisionBlock(
143
+ (norm1): Glm4vMoeRMSNorm((64,), eps=1e-05)
144
+ (norm2): Glm4vMoeRMSNorm((64,), eps=1e-05)
145
+ (attn): Glm4vMoeVisionAttention(
146
+ (qkv): Linear(in_features=64, out_features=192, bias=False)
147
+ (proj): Linear(in_features=64, out_features=64, bias=False)
148
+ )
149
+ (mlp): Glm4vMoeisionMlp(
150
+ (gate_proj): Linear(in_features=64, out_features=8, bias=False)
151
+ (up_proj): Linear(in_features=64, out_features=8, bias=False)
152
+ (down_proj): Linear(in_features=8, out_features=64, bias=False)
153
+ (act_fn): SiLUActivation()
154
+ )
155
+ )
156
+ )
157
+ (merger): Glm4vMoeVisionPatchMerger(
158
+ (proj): Linear(in_features=8, out_features=8, bias=False)
159
+ (post_projection_norm): LayerNorm((8,), eps=1e-05, elementwise_affine=True)
160
+ (gate_proj): Linear(in_features=8, out_features=64, bias=False)
161
+ (up_proj): Linear(in_features=8, out_features=64, bias=False)
162
+ (down_proj): Linear(in_features=64, out_features=8, bias=False)
163
+ (act1): GELU(approximate='none')
164
+ (act_fn): SiLUActivation()
165
+ )
166
+ (post_conv_layernorm): Glm4vMoeRMSNorm((64,), eps=1e-05)
167
+ (downsample): Conv2d(64, 8, kernel_size=(2, 2), stride=(2, 2))
168
+ (post_layernorm): Glm4vMoeRMSNorm((64,), eps=1e-05)
169
+ )
170
+ (language_model): Glm4vMoeTextModel(
171
+ (embed_tokens): Embedding(151552, 8, padding_idx=151329)
172
+ (layers): ModuleList(
173
+ (0): Glm4vMoeTextDecoderLayer(
174
+ (self_attn): Glm4vMoeTextAttention(
175
+ (q_proj): Linear(in_features=8, out_features=256, bias=True)
176
+ (k_proj): Linear(in_features=8, out_features=128, bias=True)
177
+ (v_proj): Linear(in_features=8, out_features=128, bias=True)
178
+ (o_proj): Linear(in_features=256, out_features=8, bias=False)
179
+ )
180
+ (mlp): Glm4vMoeTextMLP(
181
+ (gate_proj): Linear(in_features=8, out_features=64, bias=False)
182
+ (up_proj): Linear(in_features=8, out_features=64, bias=False)
183
+ (down_proj): Linear(in_features=64, out_features=8, bias=False)
184
+ (act_fn): SiLUActivation()
185
+ )
186
+ (input_layernorm): Glm4vMoeTextRMSNorm((8,), eps=1e-05)
187
+ (post_attention_layernorm): Glm4vMoeTextRMSNorm((8,), eps=1e-05)
188
+ )
189
+ (1): Glm4vMoeTextDecoderLayer(
190
+ (self_attn): Glm4vMoeTextAttention(
191
+ (q_proj): Linear(in_features=8, out_features=256, bias=True)
192
+ (k_proj): Linear(in_features=8, out_features=128, bias=True)
193
+ (v_proj): Linear(in_features=8, out_features=128, bias=True)
194
+ (o_proj): Linear(in_features=256, out_features=8, bias=False)
195
+ )
196
+ (mlp): Glm4vMoeTextMoE(
197
+ (experts): Glm4vMoeTextNaiveMoe(
198
+ (act_fn): SiLUActivation()
199
+ )
200
+ (gate): Glm4vMoeTextTopkRouter()
201
+ (shared_experts): Glm4vMoeTextMLP(
202
+ (gate_proj): Linear(in_features=8, out_features=64, bias=False)
203
+ (up_proj): Linear(in_features=8, out_features=64, bias=False)
204
+ (down_proj): Linear(in_features=64, out_features=8, bias=False)
205
+ (act_fn): SiLUActivation()
206
+ )
207
+ )
208
+ (input_layernorm): Glm4vMoeTextRMSNorm((8,), eps=1e-05)
209
+ (post_attention_layernorm): Glm4vMoeTextRMSNorm((8,), eps=1e-05)
210
+ )
211
+ )
212
+ (norm): Glm4vMoeRMSNorm((8,), eps=1e-05)
213
+ (rotary_emb): Glm4vMoeTextRotaryEmbedding()
214
+ )
215
+ )
216
+ (lm_head): Linear(in_features=8, out_features=151552, bias=False)
217
+ )
218
+ ```
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,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Glm4vMoeForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "image_end_token_id": 151340,
7
+ "image_start_token_id": 151339,
8
+ "image_token_id": 151363,
9
+ "model_type": "glm4v_moe",
10
+ "text_config": {
11
+ "attention_bias": true,
12
+ "attention_dropout": 0.0,
13
+ "dtype": "bfloat16",
14
+ "eos_token_id": [
15
+ 151329,
16
+ 151336,
17
+ 151338
18
+ ],
19
+ "first_k_dense_replace": 1,
20
+ "head_dim": 32,
21
+ "hidden_act": "silu",
22
+ "hidden_size": 8,
23
+ "initializer_range": 0.02,
24
+ "intermediate_size": 64,
25
+ "max_position_embeddings": 131072,
26
+ "model_type": "glm4v_moe_text",
27
+ "moe_intermediate_size": 64,
28
+ "n_group": 1,
29
+ "n_routed_experts": 128,
30
+ "n_shared_experts": 1,
31
+ "norm_topk_prob": true,
32
+ "num_attention_heads": 8,
33
+ "num_experts_per_tok": 8,
34
+ "num_hidden_layers": 2,
35
+ "num_key_value_heads": 4,
36
+ "num_nextn_predict_layers": 0,
37
+ "pad_token_id": 151329,
38
+ "partial_rotary_factor": 0.5,
39
+ "qk_layernorm": false,
40
+ "rms_norm_eps": 1e-05,
41
+ "rope_parameters": {
42
+ "mrope_section": [
43
+ 2,
44
+ 2,
45
+ 4
46
+ ],
47
+ "partial_rotary_factor": 0.5,
48
+ "rope_theta": 500000,
49
+ "rope_type": "default"
50
+ },
51
+ "routed_scaling_factor": 1.0,
52
+ "router_aux_loss_coef": 0.0001,
53
+ "tie_word_embeddings": true,
54
+ "topk_group": 1,
55
+ "use_cache": true,
56
+ "use_qk_norm": false,
57
+ "vocab_size": 151552
58
+ },
59
+ "tie_word_embeddings": false,
60
+ "transformers_version": "5.0.0.dev0",
61
+ "video_end_token_id": 151342,
62
+ "video_start_token_id": 151341,
63
+ "video_token_id": 151364,
64
+ "vision_config": {
65
+ "attention_bias": false,
66
+ "attention_dropout": 0.0,
67
+ "depth": 2,
68
+ "hidden_act": "silu",
69
+ "hidden_dropout_prob": 0.0,
70
+ "hidden_size": 64,
71
+ "image_size": 336,
72
+ "in_channels": 3,
73
+ "initializer_range": 0.02,
74
+ "intermediate_size": 64,
75
+ "model_type": "glm4v_moe_vision",
76
+ "num_heads": 2,
77
+ "out_hidden_size": 8,
78
+ "patch_size": 14,
79
+ "rms_norm_eps": 1e-05,
80
+ "spatial_merge_size": 2,
81
+ "temporal_patch_size": 2
82
+ }
83
+ }
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
+ "temperature": 0.8,
11
+ "top_k": 2,
12
+ "top_p": 0.6,
13
+ "transformers_version": "5.0.0.dev0"
14
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fefa25d61aa3f60b1b8eaa12846aade6e76617882a01ff40e44dda955ac775a0
3
+ size 5638128
processor_config.json ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_processor": {
3
+ "do_convert_rgb": true,
4
+ "do_normalize": true,
5
+ "do_rescale": true,
6
+ "do_resize": true,
7
+ "image_mean": [
8
+ 0.48145466,
9
+ 0.4578275,
10
+ 0.40821073
11
+ ],
12
+ "image_processor_type": "Glm46VImageProcessor",
13
+ "image_std": [
14
+ 0.26862954,
15
+ 0.26130258,
16
+ 0.27577711
17
+ ],
18
+ "merge_size": 2,
19
+ "patch_size": 14,
20
+ "processor_class": "Glm46VProcessor",
21
+ "resample": 3,
22
+ "rescale_factor": 0.00392156862745098,
23
+ "size": {
24
+ "longest_edge": 9633792,
25
+ "shortest_edge": 12544
26
+ },
27
+ "temporal_patch_size": 2
28
+ },
29
+ "processor_class": "Glm46VProcessor",
30
+ "video_processor": {
31
+ "data_format": "channels_first",
32
+ "default_to_square": true,
33
+ "do_convert_rgb": true,
34
+ "do_normalize": true,
35
+ "do_rescale": true,
36
+ "do_resize": true,
37
+ "do_sample_frames": true,
38
+ "fps": 2,
39
+ "image_mean": [
40
+ 0.48145466,
41
+ 0.4578275,
42
+ 0.40821073
43
+ ],
44
+ "image_std": [
45
+ 0.26862954,
46
+ 0.26130258,
47
+ 0.27577711
48
+ ],
49
+ "max_duration": 300,
50
+ "max_image_size": {
51
+ "longest_edge": 47040000
52
+ },
53
+ "merge_size": 2,
54
+ "num_frames": 16,
55
+ "patch_size": 14,
56
+ "processor_class": "Glm46VProcessor",
57
+ "resample": 3,
58
+ "rescale_factor": 0.00392156862745098,
59
+ "return_metadata": false,
60
+ "size": {
61
+ "longest_edge": 47040000,
62
+ "shortest_edge": 12544
63
+ },
64
+ "temporal_patch_size": 2,
65
+ "video_processor_type": "Glm46VVideoProcessor"
66
+ }
67
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f0ccf2252fe9cd23ada23a829ec409aab397dbd2ac4f372d3a1a23d1f7c72d6b
3
+ size 19970686
tokenizer_config.json ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "<|endoftext|>",
4
+ "[MASK]",
5
+ "[gMASK]",
6
+ "[sMASK]",
7
+ "<sop>",
8
+ "<eop>",
9
+ "<|system|>",
10
+ "<|user|>",
11
+ "<|assistant|>",
12
+ "<|observation|>",
13
+ "<|begin_of_image|>",
14
+ "<|end_of_image|>",
15
+ "<|begin_of_video|>",
16
+ "<|end_of_video|>",
17
+ "<|begin_of_audio|>",
18
+ "<|end_of_audio|>",
19
+ "<|image|>",
20
+ "<|video|>",
21
+ "<|begin_of_transcription|>",
22
+ "<|end_of_transcription|>",
23
+ "<|code_prefix|>",
24
+ "<|code_middle|>",
25
+ "<|code_suffix|>",
26
+ "/nothink"
27
+ ],
28
+ "backend": "tokenizers",
29
+ "clean_up_tokenization_spaces": false,
30
+ "do_lower_case": false,
31
+ "eos_token": "<|endoftext|>",
32
+ "extra_special_tokens": [
33
+ "<|endoftext|>",
34
+ "[MASK]",
35
+ "[gMASK]",
36
+ "[sMASK]",
37
+ "<sop>",
38
+ "<eop>",
39
+ "<|system|>",
40
+ "<|user|>",
41
+ "<|assistant|>",
42
+ "<|observation|>",
43
+ "<|begin_of_image|>",
44
+ "<|end_of_image|>",
45
+ "<|begin_of_video|>",
46
+ "<|end_of_video|>",
47
+ "<|begin_of_audio|>",
48
+ "<|end_of_audio|>",
49
+ "<|image|>",
50
+ "<|video|>",
51
+ "<|begin_of_transcription|>",
52
+ "<|end_of_transcription|>",
53
+ "<|code_prefix|>",
54
+ "<|code_middle|>",
55
+ "<|code_suffix|>",
56
+ "/nothink"
57
+ ],
58
+ "is_local": false,
59
+ "model_max_length": 128000,
60
+ "model_specific_special_tokens": {},
61
+ "pad_token": "<|endoftext|>",
62
+ "padding_side": "left",
63
+ "processor_class": "Glm46VProcessor",
64
+ "remove_space": false,
65
+ "tokenizer_class": "TokenizersBackend"
66
+ }