Partha11 commited on
Commit
1dffcb7
·
verified ·
1 Parent(s): 2f98453

Upload model trained with Unsloth

Browse files

Upload model trained with Unsloth 2x faster

chat_template.jinja CHANGED
@@ -42,6 +42,19 @@
42
  {%- if not messages %}
43
  {{- raise_exception('No messages provided.') }}
44
  {%- endif %}
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  {%- if tools and tools is iterable and tools is not mapping %}
46
  {{- '<|im_start|>system\n' }}
47
  {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
@@ -51,17 +64,13 @@
51
  {%- endfor %}
52
  {{- "\n</tools>" }}
53
  {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
54
- {%- if messages[0].role == 'system' %}
55
- {%- set content = render_content(messages[0].content, false, true)|trim %}
56
- {%- if content %}
57
- {{- '\n\n' + content }}
58
- {%- endif %}
59
  {%- endif %}
60
  {{- '<|im_end|>\n' }}
61
  {%- else %}
62
- {%- if messages[0].role == 'system' %}
63
- {%- set content = render_content(messages[0].content, false, true)|trim %}
64
- {{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
65
  {%- endif %}
66
  {%- endif %}
67
  {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
@@ -75,16 +84,10 @@
75
  {%- endif %}
76
  {%- endif %}
77
  {%- endfor %}
78
- {%- if ns.multi_step_tool %}
79
- {{- raise_exception('No user query found in messages.') }}
80
- {%- endif %}
81
  {%- for message in messages %}
 
82
  {%- set content = render_content(message.content, true)|trim %}
83
- {%- if message.role == "system" %}
84
- {%- if not loop.first %}
85
- {{- raise_exception('System message must be at the beginning.') }}
86
- {%- endif %}
87
- {%- elif message.role == "user" %}
88
  {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
89
  {%- elif message.role == "assistant" %}
90
  {%- set reasoning_content = '' %}
@@ -116,8 +119,9 @@
116
  {%- else %}
117
  {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
118
  {%- endif %}
119
- {%- if tool_call.arguments is defined %}
120
- {%- for args_name, args_value in tool_call.arguments|items %}
 
121
  {{- '<parameter=' + args_name + '>\n' }}
122
  {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
123
  {{- args_value }}
@@ -140,8 +144,7 @@
140
  {%- elif loop.last %}
141
  {{- '<|im_end|>\n' }}
142
  {%- endif %}
143
- {%- else %}
144
- {{- raise_exception('Unexpected message role.') }}
145
  {%- endif %}
146
  {%- endfor %}
147
  {%- if add_generation_prompt %}
@@ -151,4 +154,5 @@
151
  {%- else %}
152
  {{- '<think>\n' }}
153
  {%- endif %}
154
- {%- endif %}
 
 
42
  {%- if not messages %}
43
  {{- raise_exception('No messages provided.') }}
44
  {%- endif %}
45
+ {%- set num_sys = 0 %}
46
+ {%- set merged_system = '' %}
47
+ {%- if messages[0].role == 'system' or messages[0].role == 'developer' %}
48
+ {%- set first = render_content(messages[0].content, false, true)|trim %}
49
+ {%- if messages|length > 1 and (messages[1].role == 'system' or messages[1].role == 'developer') %}
50
+ {%- set second = render_content(messages[1].content, false, true)|trim %}
51
+ {%- set merged_system = first + '\n' + second %}
52
+ {%- set num_sys = 2 %}
53
+ {%- else %}
54
+ {%- set merged_system = first %}
55
+ {%- set num_sys = 1 %}
56
+ {%- endif %}
57
+ {%- endif %}
58
  {%- if tools and tools is iterable and tools is not mapping %}
59
  {{- '<|im_start|>system\n' }}
60
  {{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
 
64
  {%- endfor %}
65
  {{- "\n</tools>" }}
66
  {{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
67
+ {%- if merged_system %}
68
+ {{- '\n\n' + merged_system }}
 
 
 
69
  {%- endif %}
70
  {{- '<|im_end|>\n' }}
71
  {%- else %}
72
+ {%- if merged_system %}
73
+ {{- '<|im_start|>system\n' + merged_system + '<|im_end|>\n' }}
 
74
  {%- endif %}
75
  {%- endif %}
76
  {%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
 
84
  {%- endif %}
85
  {%- endif %}
86
  {%- endfor %}
 
 
 
87
  {%- for message in messages %}
88
+ {%- if loop.index0 >= num_sys and message.role != "system" and message.role != "developer" %}
89
  {%- set content = render_content(message.content, true)|trim %}
90
+ {%- if message.role == "user" %}
 
 
 
 
91
  {{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
92
  {%- elif message.role == "assistant" %}
93
  {%- set reasoning_content = '' %}
 
119
  {%- else %}
120
  {{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
121
  {%- endif %}
122
+ {%- if tool_call.arguments is mapping %}
123
+ {%- for args_name in tool_call.arguments %}
124
+ {%- set args_value = tool_call.arguments[args_name] %}
125
  {{- '<parameter=' + args_name + '>\n' }}
126
  {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
127
  {{- args_value }}
 
144
  {%- elif loop.last %}
145
  {{- '<|im_end|>\n' }}
146
  {%- endif %}
147
+ {%- endif %}
 
148
  {%- endif %}
149
  {%- endfor %}
150
  {%- if add_generation_prompt %}
 
154
  {%- else %}
155
  {{- '<think>\n' }}
156
  {%- endif %}
157
+ {%- endif %}
158
+ {#- Unsloth fixes - developer role, tool calling #}
processor_config.json CHANGED
@@ -1,5 +1,6 @@
1
  {
2
  "image_processor": {
 
3
  "do_convert_rgb": true,
4
  "do_normalize": true,
5
  "do_rescale": true,
@@ -27,6 +28,8 @@
27
  },
28
  "processor_class": "Qwen3VLProcessor",
29
  "video_processor": {
 
 
30
  "do_convert_rgb": true,
31
  "do_normalize": true,
32
  "do_rescale": true,
 
1
  {
2
  "image_processor": {
3
+ "data_format": "channels_first",
4
  "do_convert_rgb": true,
5
  "do_normalize": true,
6
  "do_rescale": true,
 
28
  },
29
  "processor_class": "Qwen3VLProcessor",
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,
tokenizer_config.json CHANGED
@@ -20,8 +20,8 @@
20
  "vision_bos_token": "<|vision_start|>",
21
  "vision_eos_token": "<|vision_end|>"
22
  },
23
- "pad_token": "<|endoftext|>",
24
- "padding_side": "left",
25
  "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
26
  "processor_class": "Qwen3VLProcessor",
27
  "split_special_tokens": false,
 
20
  "vision_bos_token": "<|vision_start|>",
21
  "vision_eos_token": "<|vision_end|>"
22
  },
23
+ "pad_token": "<|vision_pad|>",
24
+ "padding_side": "right",
25
  "pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
26
  "processor_class": "Qwen3VLProcessor",
27
  "split_special_tokens": false,