sdtblck commited on
Commit
326096b
·
verified ·
1 Parent(s): 6acb8b4

Upload folder using huggingface_hub

Browse files
.chat_template.jinja.swx ADDED
File without changes
added_tokens.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "<image_soft_token>": 262144
3
+ }
chat_template.jinja ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{ bos_token }}
2
+
3
+ {%- if messages[0]['role'] == 'system' -%}
4
+ {%- set sys_content = (messages[0]['content'] if messages[0]['content'] is string else messages[0]['content'][0]['text']) -%}
5
+ {%- if tools is defined and tools is not none -%}
6
+ {%- set sys_content = sys_content + '\n\nTools (functions) are available. Respond with a python list *inside* a ```tool_code``` block when you decide to call them.\nExample:\n```tool_code\n[func_name(arg="value")]\n```\n\nAvailable tools (Schemas):\n' + tools | tojson(indent=4) -%}
7
+ {%- endif -%}
8
+ {%- set first_user_prefix = sys_content + '\n\n' -%}
9
+ {%- set loop_messages = messages[1:] -%}
10
+ {%- else -%}
11
+ {%- set first_user_prefix = '' -%}
12
+ {%- set loop_messages = messages -%}
13
+ {%- endif -%}
14
+
15
+ {%- for m in loop_messages -%}
16
+ {%- if not loop.first -%}
17
+ {%- set prev_msg = loop_messages[loop.index0-1] -%}
18
+
19
+ {%- if prev_msg['role'] == 'user' -%}
20
+ {%- if m['role'] != 'assistant' -%}
21
+ {{ raise_exception('User message must be followed by assistant') }}
22
+ {%- endif -%}
23
+ {%- elif prev_msg['role'] == 'assistant' and 'tool_calls' in prev_msg -%}
24
+ {%- if m['role'] != 'tool' -%}
25
+ {{ raise_exception('Assistant with tool_calls must be followed by tool') }}
26
+ {%- endif -%}
27
+ {%- elif prev_msg['role'] == 'assistant' and 'tool_calls' not in prev_msg -%}
28
+ {%- if m['role'] not in ['user', 'tool'] -%}
29
+ {{ raise_exception('Assistant without tool_calls must be followed by user or tool') }}
30
+ {%- endif -%}
31
+ {%- elif prev_msg['role'] == 'tool' -%}
32
+ {%- if m['role'] not in ['assistant', 'user'] -%}
33
+ {{ raise_exception('Tool message must be followed by assistant or user') }}
34
+ {%- endif -%}
35
+ {%- endif -%}
36
+ {%- endif -%}
37
+ {%- endfor -%}
38
+
39
+ {%- for message in loop_messages -%}
40
+ {%- set role = 'model' if message['role'] == 'assistant' else ('user' if message['role']=='tool' else message['role']) -%}
41
+ {{ '<start_of_turn>' ~ role ~ '\n' }}
42
+
43
+ {%- if loop.first -%}
44
+ {{ first_user_prefix }}
45
+ {%- endif -%}
46
+
47
+ {%- if message['role'] in ['user','assistant'] and 'tool_calls' not in message -%}
48
+ {%- if message['content'] is string -%}
49
+ {{ message['content'] | trim }}
50
+ {%- elif message['content'] is iterable -%}
51
+ {%- for item in message['content'] -%}
52
+ {%- if item['type']=='image' -%}<start_of_image>{%- elif item['type']=='text' -%}{{ item['text'] | trim }}{%- endif -%}
53
+ {%- endfor -%}
54
+ {%- endif -%}
55
+ {%- endif -%}
56
+
57
+ {%- if message['role'] == 'tool' -%}
58
+ ```tool_response
59
+ {{ message['content'] | trim }}
60
+ ```
61
+ {%- endif -%}
62
+
63
+ {%- if 'tool_calls' in message -%}
64
+ ```tool_code
65
+ [
66
+ {%- for tc in message.tool_calls -%}
67
+ {%- set fc = tc.function if tc.function is defined else tc -%}
68
+ {{ fc.name }}(
69
+ {%- if fc.arguments is iterable and fc.arguments is mapping -%}
70
+ {%- set first=true -%}
71
+ {%- for k,v in fc.arguments.items() -%}
72
+ {%- if not first %}, {% endif -%}
73
+ {{ k }}={{ v | tojson }}{%- set first=false -%}
74
+ {%- endfor -%}
75
+ {%- elif fc.arguments is iterable -%}
76
+ {{ fc.arguments | map('tojson') | join(', ') }}
77
+ {%- else -%}
78
+ {{ fc.arguments | tojson }}
79
+ {%- endif -%}
80
+ )
81
+ {%- if not loop.last %},
82
+ {%- endif -%}
83
+ {%- endfor -%}
84
+ ]
85
+ ```
86
+ {%- endif -%}
87
+
88
+ {{ '<end_of_turn>\n' }}
89
+ {%- endfor -%}
90
+
91
+ {%- if add_generation_prompt -%}
92
+ <start_of_turn>model\n
93
+ {%- endif -%}
94
+
chat_template.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "chat_template": "{{ bos_token }}\n{%- if messages[0]['role'] == 'system' -%}\n {%- if messages[0]['content'] is string -%}\n {%- set first_user_prefix = messages[0]['content'] + '\n\n' -%}\n {%- else -%}\n {%- set first_user_prefix = messages[0]['content'][0]['text'] + '\n\n' -%}\n {%- endif -%}\n {%- set loop_messages = messages[1:] -%}\n{%- else -%}\n {%- set first_user_prefix = \"\" -%}\n {%- set loop_messages = messages -%}\n{%- endif -%}\n{%- for message in loop_messages -%}\n {%- if (message['role'] == 'user') != (loop.index0 % 2 == 0) -%}\n {{ raise_exception(\"Conversation roles must alternate user/assistant/user/assistant/...\") }}\n {%- endif -%}\n {%- if (message['role'] == 'assistant') -%}\n {%- set role = \"model\" -%}\n {%- else -%}\n {%- set role = message['role'] -%}\n {%- endif -%}\n {{ '<start_of_turn>' + role + '\n' + (first_user_prefix if loop.first else \"\") }}\n {%- if message['content'] is string -%}\n {{ message['content'] | trim }}\n {%- elif message['content'] is iterable -%}\n {%- for item in message['content'] -%}\n {%- if item['type'] == 'image' -%}\n {{ '<start_of_image>' }}\n {%- elif item['type'] == 'text' -%}\n {{ item['text'] | trim }}\n {%- endif -%}\n {%- endfor -%}\n {%- else -%}\n {{ raise_exception(\"Invalid content type\") }}\n {%- endif -%}\n {{ '<end_of_turn>\n' }}\n{%- endfor -%}\n{%- if add_generation_prompt -%}\n {{'<start_of_turn>model\n'}}\n{%- endif -%}\n"
3
+ }
config.json ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Gemma3ForConditionalGeneration"
4
+ ],
5
+ "boi_token_index": 255999,
6
+ "eoi_token_index": 256000,
7
+ "eos_token_id": [
8
+ 1,
9
+ 106
10
+ ],
11
+ "image_token_index": 262144,
12
+ "initializer_range": 0.02,
13
+ "mm_tokens_per_image": 256,
14
+ "model_type": "gemma3",
15
+ "text_config": {
16
+ "attention_bias": false,
17
+ "attention_dropout": 0.0,
18
+ "attn_logit_softcapping": null,
19
+ "cache_implementation": "hybrid",
20
+ "final_logit_softcapping": null,
21
+ "head_dim": 128,
22
+ "hidden_activation": "gelu_pytorch_tanh",
23
+ "hidden_size": 5376,
24
+ "initializer_range": 0.02,
25
+ "intermediate_size": 21504,
26
+ "max_position_embeddings": 131072,
27
+ "model_type": "gemma3_text",
28
+ "num_attention_heads": 32,
29
+ "num_hidden_layers": 62,
30
+ "num_key_value_heads": 16,
31
+ "query_pre_attn_scalar": 168,
32
+ "rms_norm_eps": 1e-06,
33
+ "rope_local_base_freq": 10000.0,
34
+ "rope_scaling": {
35
+ "factor": 8.0,
36
+ "rope_type": "linear"
37
+ },
38
+ "rope_theta": 1000000.0,
39
+ "sliding_window": 1024,
40
+ "sliding_window_pattern": 6,
41
+ "torch_dtype": "float16",
42
+ "use_cache": true,
43
+ "vocab_size": 262208
44
+ },
45
+ "torch_dtype": "float16",
46
+ "transformers_version": "4.51.3",
47
+ "vision_config": {
48
+ "attention_dropout": 0.0,
49
+ "hidden_act": "gelu_pytorch_tanh",
50
+ "hidden_size": 1152,
51
+ "image_size": 896,
52
+ "intermediate_size": 4304,
53
+ "layer_norm_eps": 1e-06,
54
+ "model_type": "siglip_vision_model",
55
+ "num_attention_heads": 16,
56
+ "num_channels": 3,
57
+ "num_hidden_layers": 27,
58
+ "patch_size": 14,
59
+ "torch_dtype": "float16",
60
+ "vision_use_head": false
61
+ }
62
+ }
generation_config.json ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token_id": 2,
3
+ "cache_implementation": "hybrid",
4
+ "do_sample": true,
5
+ "eos_token_id": [
6
+ 1,
7
+ 106
8
+ ],
9
+ "pad_token_id": 0,
10
+ "top_k": 64,
11
+ "top_p": 0.95,
12
+ "transformers_version": "4.51.3"
13
+ }