AlphaOxO commited on
Commit
cb0d4f6
·
verified ·
1 Parent(s): 490c0df

Upload folder using huggingface_hub

Browse files
chat_template.jinja ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ {%- elif m.role == 'system' -%}
133
+ <|system|>
134
+ {{ visible_text(m.content) }}
135
+ {%- endif -%}
136
+ {%- endfor -%}
137
+ {%- if add_generation_prompt -%}
138
+ <|assistant|>
139
+ {{'<think></think>\n' if (enable_thinking is defined and not enable_thinking) else ''}}
140
+ {%- endif -%}
config.json ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "GlmOcrForConditionalGeneration"
4
+ ],
5
+ "dtype": "bfloat16",
6
+ "image_end_token_id": 59257,
7
+ "image_start_token_id": 59256,
8
+ "image_token_id": 59280,
9
+ "model_type": "glm_ocr",
10
+ "quantization_config": {
11
+ "config_groups": {
12
+ "group_0": {
13
+ "format": "nvfp4-pack-quantized",
14
+ "input_activations": null,
15
+ "output_activations": null,
16
+ "targets": [
17
+ "re:.*mlp.(gate_up_proj|down_proj)*$",
18
+ "re:.*self_attn.(k_proj|o_proj|q_proj|v_proj)*$"
19
+ ],
20
+ "weights": {
21
+ "actorder": null,
22
+ "block_structure": null,
23
+ "dynamic": false,
24
+ "group_size": 16,
25
+ "num_bits": 4,
26
+ "observer": "memoryless_minmax",
27
+ "observer_kwargs": {},
28
+ "scale_dtype": "torch.float8_e4m3fn",
29
+ "strategy": "tensor_group",
30
+ "symmetric": true,
31
+ "type": "float",
32
+ "zp_dtype": null
33
+ }
34
+ }
35
+ },
36
+ "format": "nvfp4-pack-quantized",
37
+ "global_compression_ratio": null,
38
+ "ignore": [
39
+ "model.visual.blocks.0.attn.qkv",
40
+ "model.visual.blocks.0.attn.proj",
41
+ "model.visual.blocks.0.mlp.gate_proj",
42
+ "model.visual.blocks.0.mlp.up_proj",
43
+ "model.visual.blocks.1.attn.qkv",
44
+ "model.visual.blocks.1.attn.proj",
45
+ "model.visual.blocks.1.mlp.gate_proj",
46
+ "model.visual.blocks.1.mlp.up_proj",
47
+ "model.visual.blocks.2.attn.qkv",
48
+ "model.visual.blocks.2.attn.proj",
49
+ "model.visual.blocks.2.mlp.gate_proj",
50
+ "model.visual.blocks.2.mlp.up_proj",
51
+ "model.visual.blocks.3.attn.qkv",
52
+ "model.visual.blocks.3.attn.proj",
53
+ "model.visual.blocks.3.mlp.gate_proj",
54
+ "model.visual.blocks.3.mlp.up_proj",
55
+ "model.visual.blocks.4.attn.qkv",
56
+ "model.visual.blocks.4.attn.proj",
57
+ "model.visual.blocks.4.mlp.gate_proj",
58
+ "model.visual.blocks.4.mlp.up_proj",
59
+ "model.visual.blocks.5.attn.qkv",
60
+ "model.visual.blocks.5.attn.proj",
61
+ "model.visual.blocks.5.mlp.gate_proj",
62
+ "model.visual.blocks.5.mlp.up_proj",
63
+ "model.visual.blocks.6.attn.qkv",
64
+ "model.visual.blocks.6.attn.proj",
65
+ "model.visual.blocks.6.mlp.gate_proj",
66
+ "model.visual.blocks.6.mlp.up_proj",
67
+ "model.visual.blocks.7.attn.qkv",
68
+ "model.visual.blocks.7.attn.proj",
69
+ "model.visual.blocks.7.mlp.gate_proj",
70
+ "model.visual.blocks.7.mlp.up_proj",
71
+ "model.visual.blocks.8.attn.qkv",
72
+ "model.visual.blocks.8.attn.proj",
73
+ "model.visual.blocks.8.mlp.gate_proj",
74
+ "model.visual.blocks.8.mlp.up_proj",
75
+ "model.visual.blocks.9.attn.qkv",
76
+ "model.visual.blocks.9.attn.proj",
77
+ "model.visual.blocks.9.mlp.gate_proj",
78
+ "model.visual.blocks.9.mlp.up_proj",
79
+ "model.visual.blocks.10.attn.qkv",
80
+ "model.visual.blocks.10.attn.proj",
81
+ "model.visual.blocks.10.mlp.gate_proj",
82
+ "model.visual.blocks.10.mlp.up_proj",
83
+ "model.visual.blocks.11.attn.qkv",
84
+ "model.visual.blocks.11.attn.proj",
85
+ "model.visual.blocks.11.mlp.gate_proj",
86
+ "model.visual.blocks.11.mlp.up_proj",
87
+ "model.visual.blocks.12.attn.qkv",
88
+ "model.visual.blocks.12.attn.proj",
89
+ "model.visual.blocks.12.mlp.gate_proj",
90
+ "model.visual.blocks.12.mlp.up_proj",
91
+ "model.visual.blocks.13.attn.qkv",
92
+ "model.visual.blocks.13.attn.proj",
93
+ "model.visual.blocks.13.mlp.gate_proj",
94
+ "model.visual.blocks.13.mlp.up_proj",
95
+ "model.visual.blocks.14.attn.qkv",
96
+ "model.visual.blocks.14.attn.proj",
97
+ "model.visual.blocks.14.mlp.gate_proj",
98
+ "model.visual.blocks.14.mlp.up_proj",
99
+ "model.visual.blocks.15.attn.qkv",
100
+ "model.visual.blocks.15.attn.proj",
101
+ "model.visual.blocks.15.mlp.gate_proj",
102
+ "model.visual.blocks.15.mlp.up_proj",
103
+ "model.visual.blocks.16.attn.qkv",
104
+ "model.visual.blocks.16.attn.proj",
105
+ "model.visual.blocks.16.mlp.gate_proj",
106
+ "model.visual.blocks.16.mlp.up_proj",
107
+ "model.visual.blocks.17.attn.qkv",
108
+ "model.visual.blocks.17.attn.proj",
109
+ "model.visual.blocks.17.mlp.gate_proj",
110
+ "model.visual.blocks.17.mlp.up_proj",
111
+ "model.visual.blocks.18.attn.qkv",
112
+ "model.visual.blocks.18.attn.proj",
113
+ "model.visual.blocks.18.mlp.gate_proj",
114
+ "model.visual.blocks.18.mlp.up_proj",
115
+ "model.visual.blocks.19.attn.qkv",
116
+ "model.visual.blocks.19.attn.proj",
117
+ "model.visual.blocks.19.mlp.gate_proj",
118
+ "model.visual.blocks.19.mlp.up_proj",
119
+ "model.visual.blocks.20.attn.qkv",
120
+ "model.visual.blocks.20.attn.proj",
121
+ "model.visual.blocks.20.mlp.gate_proj",
122
+ "model.visual.blocks.20.mlp.up_proj",
123
+ "model.visual.blocks.21.attn.qkv",
124
+ "model.visual.blocks.21.attn.proj",
125
+ "model.visual.blocks.21.mlp.gate_proj",
126
+ "model.visual.blocks.21.mlp.up_proj",
127
+ "model.visual.blocks.22.attn.qkv",
128
+ "model.visual.blocks.22.attn.proj",
129
+ "model.visual.blocks.22.mlp.gate_proj",
130
+ "model.visual.blocks.22.mlp.up_proj",
131
+ "model.visual.blocks.23.attn.qkv",
132
+ "model.visual.blocks.23.attn.proj",
133
+ "model.visual.blocks.23.mlp.gate_proj",
134
+ "model.visual.blocks.23.mlp.up_proj",
135
+ "model.visual.merger.proj",
136
+ "model.visual.merger.gate_proj",
137
+ "model.visual.merger.up_proj",
138
+ "model.visual.merger.down_proj",
139
+ "lm_head"
140
+ ],
141
+ "kv_cache_scheme": null,
142
+ "quant_method": "compressed-tensors",
143
+ "quantization_status": "compressed",
144
+ "sparsity_config": {},
145
+ "transform_config": {},
146
+ "version": "0.17.1"
147
+ },
148
+ "text_config": {
149
+ "attention_bias": false,
150
+ "attention_dropout": 0.0,
151
+ "dtype": "bfloat16",
152
+ "eos_token_id": [
153
+ 59246,
154
+ 59253
155
+ ],
156
+ "head_dim": 128,
157
+ "hidden_act": "silu",
158
+ "hidden_size": 1536,
159
+ "initializer_range": 0.02,
160
+ "intermediate_size": 4608,
161
+ "max_position_embeddings": 131072,
162
+ "model_type": "glm_ocr_text",
163
+ "num_attention_heads": 16,
164
+ "num_hidden_layers": 16,
165
+ "num_key_value_heads": 8,
166
+ "num_nextn_predict_layers": 1,
167
+ "pad_token_id": 59246,
168
+ "rms_norm_eps": 1e-05,
169
+ "rope_parameters": {
170
+ "mrope_section": [
171
+ 16,
172
+ 24,
173
+ 24
174
+ ],
175
+ "partial_rotary_factor": 1.0,
176
+ "rope_theta": 10000,
177
+ "rope_type": "default"
178
+ },
179
+ "tie_word_embeddings": false,
180
+ "use_cache": true,
181
+ "vocab_size": 59392
182
+ },
183
+ "tie_word_embeddings": false,
184
+ "transformers_version": "5.10.1",
185
+ "video_end_token_id": 59259,
186
+ "video_start_token_id": 59258,
187
+ "video_token_id": 59281,
188
+ "vision_config": {
189
+ "attention_bias": true,
190
+ "attention_dropout": 0.0,
191
+ "depth": 24,
192
+ "dtype": "bfloat16",
193
+ "hidden_act": "silu",
194
+ "hidden_dropout_prob": 0.0,
195
+ "hidden_size": 1024,
196
+ "image_size": 336,
197
+ "in_channels": 3,
198
+ "initializer_range": 0.02,
199
+ "intermediate_size": 4096,
200
+ "model_type": "glm_ocr_vision",
201
+ "num_heads": 16,
202
+ "out_hidden_size": 1536,
203
+ "patch_size": 14,
204
+ "rms_norm_eps": 1e-05,
205
+ "spatial_merge_size": 2,
206
+ "temporal_patch_size": 2
207
+ }
208
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "do_sample": false,
4
+ "eos_token_id": [
5
+ 59246,
6
+ 59253
7
+ ],
8
+ "pad_token_id": 59246,
9
+ "transformers_version": "5.10.1"
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3cabb087d4118d96c595c96b58b5bc414872b27bc3b6f7b92a3e81a993f0eb17
3
+ size 1364770816
processor_config.json ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ "resample": 3,
21
+ "rescale_factor": 0.00392156862745098,
22
+ "size": {
23
+ "longest_edge": 9633792,
24
+ "shortest_edge": 12544
25
+ },
26
+ "temporal_patch_size": 2
27
+ },
28
+ "processor_class": "Glm46VProcessor",
29
+ "video_processor": {
30
+ "do_convert_rgb": true,
31
+ "do_normalize": true,
32
+ "do_rescale": true,
33
+ "do_resize": true,
34
+ "do_sample_frames": true,
35
+ "fps": 2,
36
+ "image_mean": [
37
+ 0.48145466,
38
+ 0.4578275,
39
+ 0.40821073
40
+ ],
41
+ "image_std": [
42
+ 0.26862954,
43
+ 0.26130258,
44
+ 0.27577711
45
+ ],
46
+ "max_duration": 300,
47
+ "max_image_size": {
48
+ "longest_edge": 47040000
49
+ },
50
+ "merge_size": 2,
51
+ "num_frames": 16,
52
+ "patch_size": 14,
53
+ "resample": 3,
54
+ "rescale_factor": 0.00392156862745098,
55
+ "return_metadata": false,
56
+ "size": {
57
+ "longest_edge": 9633792,
58
+ "shortest_edge": 12544
59
+ },
60
+ "temporal_patch_size": 2,
61
+ "video_processor_type": "Glm46VVideoProcessor"
62
+ }
63
+ }
recipe.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ default_stage:
2
+ default_modifiers:
3
+ QuantizationModifier:
4
+ targets: ['re:.*mlp.(gate_up_proj|down_proj)*$', 're:.*self_attn.(k_proj|o_proj|q_proj|v_proj)*$']
5
+ ignore: [lm_head]
6
+ scheme: NVFP4A16
7
+ bypass_divisibility_checks: false
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "backend": "tokenizers",
3
+ "clean_up_tokenization_spaces": false,
4
+ "eos_token": "<|endoftext|>",
5
+ "extra_special_tokens": [
6
+ "<|endoftext|>",
7
+ "[MASK]",
8
+ "[gMASK]",
9
+ "[sMASK]",
10
+ "<sop>",
11
+ "<eop>",
12
+ "<|system|>",
13
+ "<|user|>",
14
+ "<|assistant|>",
15
+ "<|observation|>",
16
+ "<|begin_of_image|>",
17
+ "<|end_of_image|>",
18
+ "<|begin_of_video|>",
19
+ "<|end_of_video|>",
20
+ "<|begin_of_audio|>",
21
+ "<|end_of_audio|>",
22
+ "<|begin_of_transcription|>",
23
+ "<|end_of_transcription|>",
24
+ "<|code_prefix|>",
25
+ "<|code_middle|>",
26
+ "<|code_suffix|>",
27
+ "<think>",
28
+ "</think>",
29
+ "<tool_call>",
30
+ "</tool_call>",
31
+ "<tool_response>",
32
+ "</tool_response>",
33
+ "<arg_key>",
34
+ "</arg_key>",
35
+ "<arg_value>",
36
+ "</arg_value>",
37
+ "/nothink",
38
+ "<|begin_of_box|>",
39
+ "<|end_of_box|>",
40
+ "<|image|>",
41
+ "<|video|>"
42
+ ],
43
+ "is_local": true,
44
+ "local_files_only": false,
45
+ "model_max_length": 655380,
46
+ "pad_token": "<|endoftext|>",
47
+ "padding_side": "left",
48
+ "processor_class": "Glm46VProcessor",
49
+ "tokenizer_class": "TokenizersBackend"
50
+ }