jp1924 commited on
Commit
975dd62
·
verified ·
1 Parent(s): 542ff11

Update tiny models for HyperCLOVAXVisionV2ForConditionalGeneration

Browse files
chat_template.jinja ADDED
@@ -0,0 +1,164 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set ns_img = namespace(count=0) %}
2
+ {%- set ns_vid = namespace(count=0) %}
3
+ {%- if tools %}
4
+ {{- '<|im_start|>system\n' }}
5
+ {%- if messages[0].role == 'system' %}
6
+ {%- if messages[0].content is string %}
7
+ {%- if messages[0].content %}
8
+ {{- messages[0].content + '\n\n' }}
9
+ {%- endif %}
10
+ {%- elif messages[0].content is sequence %}
11
+ {%- for content_part in messages[0].content %}
12
+ {%- if content_part.type == 'text' %}
13
+ {{- content_part.text + '\n\n' }}
14
+ {%- endif %}
15
+ {%- endfor %}
16
+ {%- endif %}
17
+ {%- endif %}
18
+ {{- '# Tools\n\n' }}
19
+ {{- 'You may call one or more functions to assist with the user query.\n\n' }}
20
+ {{- 'You are provided with function signatures within <tools></tools> XML tags:\n' }}
21
+ {{- '<tools>\n' }}
22
+ {%- for tool in tools %}
23
+ {{- tool | tojson(ensure_ascii=False) }}
24
+ {%- endfor %}
25
+ {{- '\n</tools>\n\n' }}
26
+ {{- 'For each function call, output the function name and arguments within the following XML format:\n' }}
27
+ {{- '<tool_call>{function-name}\n' }}
28
+ {{- '<arg_key>{arg-key-1}</arg_key>\n' }}
29
+ {{- '<arg_value>{arg-value-1}</arg_value>\n' }}
30
+ {{- '<arg_key>{arg-key-2}</arg_key>\n' }}
31
+ {{- '<arg_value>{arg-value-2}</arg_value>\n' }}
32
+ {{- '...\n' }}
33
+ {{- '</tool_call><|im_end|>\n' }}
34
+ {%- else %}
35
+ {%- if messages[0].role == 'system' %}
36
+ {{- '<|im_start|>system\n' }}
37
+ {%- if messages[0].content is string %}
38
+ {{- messages[0].content }}
39
+ {%- elif messages[0].content is sequence %}
40
+ {%- for content_part in messages[0].content %}
41
+ {%- if content_part.type == 'text' %}
42
+ {{- content_part.text }}
43
+ {%- endif %}
44
+ {%- endfor %}
45
+ {%- endif %}
46
+ {%- if messages[0].content %}
47
+ {{- '\n' }}
48
+ {%- endif %}
49
+ {{- '<|im_end|>\n' }}
50
+ {%- endif %}
51
+ {%- endif %}
52
+ {%- set ns = namespace(last_user_index=-1) %}
53
+ {%- for m in messages %}
54
+ {%- if m.role == 'user' %}
55
+ {%- set ns.last_user_index = loop.index0 %}
56
+ {%- endif %}
57
+ {%- endfor %}
58
+ {%- for message in messages %}
59
+ {%- set content = message.content %}
60
+ {%- if (message.role == 'system' and not loop.first) %}
61
+ {{- '<|im_start|>' + message.role + '\n' }}
62
+ {%- if content is string %}
63
+ {{- content }}
64
+ {%- elif content is sequence %}
65
+ {%- for content_part in content %}
66
+ {%- if content_part.type == 'text' %}
67
+ {{- content_part.text }}
68
+ {%- endif %}
69
+ {%- endfor %}
70
+ {%- endif %}
71
+ {{- '<|im_end|>' + '\n' }}
72
+ {%- elif message.role == 'user' %}
73
+ {{- '<|im_start|>user\n' }}
74
+ {%- if message['content'] is string %}
75
+ {{- message['content'] + '<|im_end|>\n' }}
76
+ {%- elif message['content'] is sequence %}
77
+ {%- for content in message['content'] %}
78
+ {%- if not loop.first %}
79
+ {{- '\n' }}
80
+ {%- endif %}
81
+ {%- if content['type'] == 'image' or 'image' in content or 'image_url' in content %}
82
+ {%- set image_id = 'image_%02d' % ns_img.count %}
83
+ {%- set ns_img.count = ns_img.count + 1 %}
84
+ {%- set mime_type = content.get('mime_type', 'image/jpeg') %}
85
+ {{- '<|mime_start|>{"id": "' + image_id + '", "type": "' + mime_type + '", "filename": "' + content.get('filename', "a.jpg") + '"}<|mime_end|>\n' }}
86
+ {{- '<|image_start|><|IMAGE_PAD|><|image_end|>' }}
87
+ {%- elif content['type'] == 'video' or 'video' in content or 'video_url' in content %}
88
+ {%- set video_id = 'video_%02d' % ns_vid.count %}
89
+ {%- set ns_vid.count = ns_vid.count + 1 %}
90
+ {%- set mime_type = content.get('mime_type', 'video/mp4') %}
91
+ {{- '<|mime_start|>{"id": "' + video_id + '", "type": "' + mime_type + '", "filename": "' + content.get('filename', "a.mp4") + '"}<|mime_end|>\n' }}
92
+ {{- '<|video_aux_start|>다음 중 video_duration은 비디오 길이 정보입니다. 참고하여 답변하세요. {"video_duration": ' + (content.get('video_duration') | tojson if content.get('video_duration') else '<|video_duration|>') + '}<|video_aux_end|>\n'}}
93
+ {{- '<|video_start|><|VIDEO_PAD|><|video_end|>'}}
94
+ {%- elif content['type'] == 'text' %}
95
+ {{- content['text'] }}
96
+ {%- endif %}
97
+ {%- endfor %}
98
+ {{- '<|im_end|>\n'}}
99
+ {%- endif %}
100
+ {%- elif message.role == 'assistant' %}
101
+ {{- '<|im_start|>assistant\n' }}
102
+ {%- if message.content is string %}
103
+ {%- set reasoning_content = '' %}
104
+ {%- if message.reasoning_content is string %}
105
+ {%- set reasoning_content = message.reasoning_content %}
106
+ {%- else %}
107
+ {%- if '</think>' in content %}
108
+ {%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
109
+ {%- set content = content.split('</think>')[-1].lstrip('\n') %}
110
+ {%- endif %}
111
+ {%- endif %}
112
+ {%- if loop.index0 > ns.last_user_index %}
113
+ {%- if (loop.index0 > 0 and messages[loop.index0 - 1].role == 'user') or reasoning_content %}
114
+ {{- '<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
115
+ {%- else %}
116
+ {{- content }}
117
+ {%- endif %}
118
+ {%- else %}
119
+ {{- content }}
120
+ {%- endif %}
121
+ {%- elif message.content is sequence %}
122
+ {%- for content_part in message.content %}
123
+ {%- if content_part.type == 'text' %}
124
+ {{- content_part.text }}
125
+ {{- '\n' if not loop.last else '' -}}
126
+ {%- endif %}
127
+ {%- endfor %}
128
+ {%- endif %}
129
+ {%- if message.tool_calls %}
130
+ {%- for tool_call in message.tool_calls %}
131
+ {%- if not loop.first or content %}
132
+ {{- '\n' }}
133
+ {%- endif %}
134
+ {%- if tool_call.function %}
135
+ {%- set tool_call = tool_call.function %}
136
+ {%- endif %}
137
+ {{- '<tool_call>' + tool_call.name + '\n' }}
138
+ {%- set _args = tool_call.arguments %}
139
+ {%- for k, v in _args.items() %}
140
+ {{- '<arg_key>' + k + '</arg_key>\n' }}
141
+ {{- '<arg_value>' + (v | tojson(ensure_ascii=False) if v is not string else v) + '</arg_value>\n' }}
142
+ {%- endfor %}
143
+ {{- '</tool_call>' }}
144
+ {%- endfor %}
145
+ {%- endif %}
146
+ {{- '<|im_end|>\n' }}
147
+ {%- elif message.role == 'tool' %}
148
+ {%- if loop.first or (messages[loop.index0 - 1].role != 'tool') %}
149
+ {{- '<|im_start|>tool' }}
150
+ {%- endif %}
151
+ {{- '\n<tool_response>' + message.get('name', '') + '\n' }}
152
+ {{- content }}
153
+ {{- '\n</tool_response>' }}
154
+ {%- if loop.last or (messages[loop.index0 + 1].role != 'tool') %}
155
+ {{- '<|im_end|>\n' }}
156
+ {%- endif %}
157
+ {%- endif %}
158
+ {%- endfor %}
159
+ {%- if add_generation_prompt %}
160
+ {{- '<|im_start|>assistant\n<think>\n' }}
161
+ {%- if skip_reasoning is defined and skip_reasoning is true %}
162
+ {{- '\n</think>\n\n' }}
163
+ {%- endif %}
164
+ {%- endif %}
config.json ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "HyperCLOVAXVisionV2ForConditionalGeneration"
4
+ ],
5
+ "dtype": "float32",
6
+ "image_token_id": 3,
7
+ "model_type": "hyperclovax_vision_v2",
8
+ "pad_token_id": 0,
9
+ "text_config": {
10
+ "attention_bias": false,
11
+ "attention_dropout": 0.0,
12
+ "attention_multiplier": 0.25,
13
+ "bos_token_id": 0,
14
+ "embedding_multiplier": 1.0,
15
+ "eos_token_id": 128001,
16
+ "head_dim": 16,
17
+ "hidden_act": "gelu",
18
+ "hidden_size": 32,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 32,
21
+ "logits_scaling": 1.0,
22
+ "max_position_embeddings": 512,
23
+ "mlp_bias": false,
24
+ "model_type": "hyperclovax",
25
+ "num_attention_heads": 2,
26
+ "num_hidden_layers": 2,
27
+ "num_key_value_heads": 2,
28
+ "pad_token_id": 0,
29
+ "residual_multiplier": 1.0,
30
+ "rms_norm_eps": 1e-06,
31
+ "rope_parameters": {
32
+ "rope_theta": 10000.0,
33
+ "rope_type": "default"
34
+ },
35
+ "tie_word_embeddings": false,
36
+ "use_cache": true,
37
+ "use_post_norm": true,
38
+ "vocab_size": 128256
39
+ },
40
+ "tie_word_embeddings": false,
41
+ "transformers_version": "5.18.0.dev0",
42
+ "video_token_id": 4,
43
+ "vision_config": {
44
+ "depth": 2,
45
+ "fullatt_block_indexes": [
46
+ 7,
47
+ 15,
48
+ 23,
49
+ 31
50
+ ],
51
+ "hidden_act": "gelu",
52
+ "hidden_size": 32,
53
+ "in_channels": 3,
54
+ "initializer_range": 0.02,
55
+ "intermediate_size": 32,
56
+ "model_type": "qwen2_5_vl_vision",
57
+ "num_heads": 4,
58
+ "out_hidden_size": 32,
59
+ "patch_size": 14,
60
+ "rope_parameters": {
61
+ "rope_theta": 10000.0,
62
+ "rope_type": "axial"
63
+ },
64
+ "spatial_merge_size": 1,
65
+ "temporal_patch_size": 2,
66
+ "tokens_per_second": 1,
67
+ "window_size": 112
68
+ }
69
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "eos_token_id": 128001,
5
+ "output_attentions": false,
6
+ "output_hidden_states": false,
7
+ "pad_token_id": 0,
8
+ "transformers_version": "5.18.0.dev0",
9
+ "use_cache": true
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c1adfaf1e9e589f2bce5b1ccc27e7dd6352de4ef07b898735ad1e0545ff1a335
3
+ size 33121552
preprocessor_config.json ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "discrete_image_end_token": "<|discrete_image_end|>",
3
+ "discrete_image_ratios": [
4
+ [
5
+ 1,
6
+ 1
7
+ ],
8
+ [
9
+ 1,
10
+ 2
11
+ ],
12
+ [
13
+ 2,
14
+ 1
15
+ ],
16
+ [
17
+ 3,
18
+ 4
19
+ ],
20
+ [
21
+ 4,
22
+ 3
23
+ ],
24
+ [
25
+ 9,
26
+ 16
27
+ ],
28
+ [
29
+ 16,
30
+ 9
31
+ ],
32
+ [
33
+ 1,
34
+ 3
35
+ ],
36
+ [
37
+ 3,
38
+ 1
39
+ ]
40
+ ],
41
+ "discrete_image_start_token": "<|discrete_image_start|>",
42
+ "discrete_image_token": "<|DISCRETE_IMAGE_PAD|>",
43
+ "discrete_token_size": 27,
44
+ "do_center_crop": false,
45
+ "do_convert_rgb": true,
46
+ "do_normalize": true,
47
+ "do_rescale": true,
48
+ "do_resize": true,
49
+ "image_end_token": "<|image_end|>",
50
+ "image_mean": [
51
+ 0.48145466,
52
+ 0.4578275,
53
+ 0.40821073
54
+ ],
55
+ "image_processor_type": "Qwen2VLImageProcessor",
56
+ "image_start_token": "<|image_start|>",
57
+ "image_std": [
58
+ 0.26862954,
59
+ 0.26130258,
60
+ 0.27577711
61
+ ],
62
+ "image_token": "<|IMAGE_PAD|>",
63
+ "merge_size": 2,
64
+ "patch_size": 14,
65
+ "resample": 3,
66
+ "rescale_factor": 0.00392156862745098,
67
+ "resize_mode": "smart_resize",
68
+ "size": {
69
+ "longest_edge": 2073600,
70
+ "shortest_edge": 3136
71
+ },
72
+ "temporal_patch_size": 2,
73
+ "use_discrete_token": false,
74
+ "vision_eof_token": "<|vision_eof|>",
75
+ "vision_eol_token": "<|vision_eol|>"
76
+ }
tokenizer.json ADDED
The diff for this file is too large to render. See raw diff
 
tokenizer_config.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "add_prefix_space": false,
3
+ "backend": "tokenizers",
4
+ "bos_token": "<|endoftext|>",
5
+ "clean_up_tokenization_spaces": true,
6
+ "eos_token": "<|im_end|>",
7
+ "errors": "replace",
8
+ "fix_mistral_regex": true,
9
+ "image_token": "<|IMAGE_PAD|>",
10
+ "is_local": true,
11
+ "local_files_only": false,
12
+ "model_max_length": 1000000000000000019884624838656,
13
+ "model_specific_special_tokens": {
14
+ "image_token": "<|IMAGE_PAD|>",
15
+ "video_token": "<|VIDEO_PAD|>"
16
+ },
17
+ "pad_token": "<|endoftext|>",
18
+ "processor_class": "Exaone4_5_Processor",
19
+ "sep_token": "<|endoftext|>",
20
+ "tokenizer_class": "GPT2Tokenizer",
21
+ "unk_token": "<|endoftext|>",
22
+ "video_token": "<|VIDEO_PAD|>"
23
+ }
video_preprocessor_config.json ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_convert_rgb": true,
3
+ "do_normalize": true,
4
+ "do_rescale": true,
5
+ "do_resize": true,
6
+ "do_sample_frames": false,
7
+ "image_mean": [
8
+ 0.48145466,
9
+ 0.4578275,
10
+ 0.40821073
11
+ ],
12
+ "image_std": [
13
+ 0.26862954,
14
+ 0.26130258,
15
+ 0.27577711
16
+ ],
17
+ "max_frames": 120,
18
+ "max_video_tokens": 128000,
19
+ "merge_size": 2,
20
+ "min_frames": 4,
21
+ "patch_size": 14,
22
+ "resample": 3,
23
+ "rescale_factor": 0.00392156862745098,
24
+ "return_metadata": false,
25
+ "size": {
26
+ "longest_edge": 285768,
27
+ "shortest_edge": 3136
28
+ },
29
+ "temporal_patch_size": 2,
30
+ "use_audio_in_video": false,
31
+ "use_discrete_token": false,
32
+ "video_audio_token": "<|VIDEO_AUDIO_PAD|>",
33
+ "video_end_token": "<|video_end|>",
34
+ "video_processor_type": "Qwen2VLVideoProcessor",
35
+ "video_start_token": "<|video_start|>",
36
+ "video_token": "<|VIDEO_PAD|>",
37
+ "vision_eof_token": "<|vision_eof|>",
38
+ "vision_eol_token": "<|vision_eol|>"
39
+ }