cpatonn commited on
Commit
0e414fe
·
verified ·
1 Parent(s): 75a93e3

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ 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
+ Apriel-1.5-Thinker.pdf filter=lfs diff=lfs merge=lfs -text
37
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
Apriel-1.5-Thinker.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8f38a1b75f8714198ca728a60563f34122f5b2c9fd207055d47de12f7bf055da
3
+ size 3388802
README.md ADDED
@@ -0,0 +1,313 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ pipeline_tag: text-generation
4
+ library_name: transformers
5
+ base_model: ServiceNow-AI/Apriel-1.5-15b-Thinker
6
+ ---
7
+
8
+ # Apriel-1.5-15b-Thinker - Mid training is all you need!
9
+
10
+ <img src="https://cdn-uploads.huggingface.co/production/uploads/63d3095c2727d7888cbb54e2/Lt1t0tOO5emz1X23Azg-E.png" width="120" alt="thumbnail"/> `/ˈɑː.pri.əl/`
11
+
12
+ ---
13
+
14
+ # Table of Contents
15
+
16
+ 1. [Summary](#summary)
17
+ 2. [Evaluation](#evaluation)
18
+ 3. [Training Details](#training-details)
19
+ 4. [How to Use](#how-to-use)
20
+ 5. [Intended Use](#intended-use)
21
+ 6. [Limitations](#limitations)
22
+ 7. [Security and Responsible Use](#security-and-responsible-use)
23
+ 8. [Software](#software)
24
+ 9. [License](#license)
25
+ 10. [Acknowledgements](#acknowledgements)
26
+ 11. [Citation](#citation)
27
+
28
+
29
+ ---
30
+
31
+ **Click here to skip to the technical report** -> https://huggingface.co/ServiceNow-AI/Apriel-1.5-15b-Thinker/blob/main/Apriel-1.5-Thinker.pdf
32
+
33
+ ---
34
+
35
+ # Summary
36
+
37
+ **Apriel-1.5-15b-Thinker** is a multimodal reasoning model in ServiceNow’s Apriel SLM series which achieves competitive performance against models 10 times it's size. Apriel-1.5 is the second model in the reasoning series. It introduces enhanced textual reasoning capabilities and adds image reasoning support to the previous text model. It has undergone extensive continual pretraining across both text and image domains. In terms of post-training this model has **undergone text-SFT only**. Our research demonstrates that with a strong mid-training regimen, we are able to achive SOTA performance on text and image reasoning tasks without having any image SFT training or RL.
38
+
39
+ **Highlights**
40
+ - Achieves a score of **52** on the Artificial Analysis index and is competitive with Deepseek R1 0528, Gemini-Flash etc.
41
+ - It is **AT LEAST 1 / 10** the size of any other model that scores > 50 on the Artificial Analysis index.
42
+ - Scores **68** on Tau2 Bench Telecom and **62** on IFBench, which are key benchmarks for the enterprise domain.
43
+ - At 15B parameters, the model fits on a single GPU, making it highly memory-efficient.
44
+
45
+ ---
46
+
47
+ # Evaluation
48
+
49
+ - For text benchmarks, we report evaluations perforomed by a third party - **Artificial Analysis**.
50
+ - For image benchmarks, we report evaluations obtained by https://github.com/open-compass/VLMEvalKit
51
+
52
+ ---
53
+
54
+ # Results reported by Artificial Analysis
55
+
56
+ <!-- ![image](https://cdn-uploads.huggingface.co/production/uploads/63d3095c2727d7888cbb54e2/if7y-zjJbzHNYgc4agl7X.png)
57
+
58
+ ![image](https://cdn-uploads.huggingface.co/production/uploads/63d3095c2727d7888cbb54e2/Ds-VYH--MbLRH7GrhWnF0.png) -->
59
+
60
+
61
+ ![index - latest 2](https://cdn-uploads.huggingface.co/production/uploads/66a41f3c1d52bffc13c285a5/pdSRgotQw00XKB04bmJg3.png)
62
+
63
+ ![index vs size fixed 3](https://cdn-uploads.huggingface.co/production/uploads/66a41f3c1d52bffc13c285a5/ewXvkN75gfyplJpWEJLyP.png)
64
+
65
+ ---
66
+
67
+
68
+ # Training Details
69
+
70
+ **Mid training / Continual Pre‑training**
71
+ In this stage, the model is trained on billions of tokens of carefully curated textual samples drawn from mathematical reasoning, coding challenges, scientific discourse, logical puzzles, and diverse knowledge-rich texts along with multimodal samples covering image understanding and reasoning, captioning, and interleaved image-text data. The objective is to strengthen foundational reasoning capabilities of the model. This stage is critical for the model to function as a reasoner and provides significant lifts in reasoning benchmarks.
72
+
73
+ **Supervised Fine‑Tuning (SFT)**
74
+ The model is fine-tuned on over 2M high-quality text samples spanning mathematical and scientific problem-solving, coding tasks, instruction-following, API/function invocation, and conversational use cases. This results in superior text performance comparable to models such as Deepseek R1 0528 and Gemini-Flash. Although no image-specific fine-tuning is performed, the model’s inherent multimodal capabilities and cross-modal transfer of reasoning behavior from the text SFT yield competitive image performance relative to other leading open-source VL models.
75
+
76
+ ---
77
+
78
+ # Running Apriel-1.5-15B-Thinker with vLLM
79
+
80
+ As the upstream PR is not yet merged, you can use this custom image as an alternate way to run the model with tool and reasoning parsers enabled.
81
+
82
+ ### Docker Image
83
+
84
+ ```
85
+ docker.io/amant555/vllm_apriel:latest
86
+ ```
87
+
88
+ ### Start Command
89
+
90
+ Run the container with the following command:
91
+
92
+ ```bash
93
+ python3 -m vllm.entrypoints.openai.api_server \
94
+ --model ServiceNow-AI/Apriel-1.5-15b-Thinker \
95
+ --served-model-name Apriel-1p5-15B-Thinker \
96
+ --trust_remote_code \
97
+ --max-model-len 131072 \
98
+ --enable-auto-tool-choice \
99
+ --tool-call-parser apriel \
100
+ --reasoning-parser apriel
101
+ ```
102
+
103
+ This will start the vLLM OpenAI-compatible API server serving the **Apriel-1.5-15B-Thinker** model with Apriel’s custom tool parser and reasoning parser.
104
+
105
+
106
+
107
+ # How to Use
108
+
109
+ ```bash
110
+ pip install transformers
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Running the Reasoning model
116
+
117
+
118
+ Here is a code snippet demonstrating the model's usage with the transformers library's generate function:
119
+
120
+ ```python
121
+ # Tested with transformers==4.48
122
+
123
+ import re
124
+ import requests
125
+ import torch
126
+ from PIL import Image
127
+ from transformers import AutoProcessor, AutoModelForImageTextToText
128
+
129
+ # Load model
130
+ model_id = "ServiceNow-AI/Apriel-1.5-15b-Thinker"
131
+ model = AutoModelForImageTextToText.from_pretrained(
132
+ model_id,
133
+ torch_dtype=torch.bfloat16,
134
+ device_map="auto"
135
+ )
136
+ processor = AutoProcessor.from_pretrained(model_id)
137
+
138
+ # Example 1: Text-only prompt
139
+ chat = [
140
+ {
141
+ "role": "user",
142
+ "content": [
143
+ {"type": "text", "text": "What is the capital for France?"},
144
+ ],
145
+ }
146
+ ]
147
+
148
+ inputs = processor.apply_chat_template(chat, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt")
149
+ inputs = {k: v.to(model.device) if isinstance(v, torch.Tensor) else v for k, v in inputs.items()}
150
+ inputs.pop("token_type_ids", None)
151
+
152
+ with torch.no_grad():
153
+ output_ids = model.generate(**inputs, max_new_tokens=1024, do_sample=True, temperature=0.6)
154
+
155
+ generated_ids = output_ids[:, inputs['input_ids'].shape[1]:]
156
+ output = processor.decode(generated_ids[0], skip_special_tokens=True)
157
+ response = re.findall(r"\[BEGIN FINAL RESPONSE\](.*?)\[END FINAL RESPONSE\]", output, re.DOTALL)[0].strip()
158
+
159
+ print("Text-only Response:", response)
160
+
161
+ # Example 2: Image understanding
162
+ url = "https://picsum.photos/id/237/200/300"
163
+ image = Image.open(requests.get(url, stream=True).raw).convert("RGB")
164
+
165
+ chat = [
166
+ {
167
+ "role": "user",
168
+ "content": [
169
+ {"type": "text", "text": "Which animal is this?"},
170
+ {"type": "image"},
171
+ ],
172
+ }
173
+ ]
174
+
175
+ prompt = processor.apply_chat_template(chat, add_generation_prompt=True, tokenize=False)
176
+ inputs = processor(text=prompt, images=[image], return_tensors="pt").to(model.device)
177
+ inputs.pop("token_type_ids", None)
178
+
179
+ with torch.no_grad():
180
+ output_ids = model.generate(**inputs, max_new_tokens=1024, do_sample=True, temperature=0.6)
181
+
182
+ generated_ids = output_ids[:, inputs['input_ids'].shape[1]:]
183
+ output = processor.decode(generated_ids[0], skip_special_tokens=True)
184
+ response = re.findall(r"\[BEGIN FINAL RESPONSE\](.*?)\[END FINAL RESPONSE\]", output, re.DOTALL)[0].strip()
185
+
186
+ print("Image Response:", response)
187
+
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Chat Template
193
+
194
+
195
+ ```
196
+ <|system|>
197
+ You are a thoughtful and systematic AI assistant built by ServiceNow Language Models (SLAM) lab. Before providing an answer, analyze the problem carefully and present your reasoning step by step. After explaining your thought process, provide the final solution in the following format: [BEGIN FINAL RESPONSE] ... [END FINAL RESPONSE].
198
+ <|end|>
199
+ <|user|>
200
+ # user message here
201
+ <|end|>
202
+ <|assistant|>
203
+ Here are my reasoning steps:
204
+ # thoughts here
205
+ [BEGIN FINAL RESPONSE]
206
+ # assistant response here
207
+ [END FINAL RESPONSE]
208
+ <|end|>
209
+ ```
210
+ The model will first generate its thinking process and then generate its final response between `[BEGIN FINAL RESPONSE]` and `[END FINAL RESPONSE]`. Here is a code snippet demonstrating the application of the chat template:
211
+
212
+
213
+
214
+ ```python
215
+ from transformers import AutoTokenizer
216
+ model_name = "ServiceNow-AI/Apriel-1.5-15b-Thinker"
217
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
218
+
219
+ # prepare the model input
220
+ custom_system_prompt = "Answer like a pirate."
221
+ prompt = "You are an expert assistant in the implementation of customer experience management aspect of retail applications \n \nYou will be using Python as the programming language. \n \nYou will utilize a factory design pattern for the implementation and following the dependency inversion principle \n \nYou will modify the implementation based on user requirements. \n \nUpon user request, you will add, update, and remove the features & enhancements in the implementation provided by you. \n \nYou will ask whether the user wants to refactor the provided code or needs a sample implementation for reference. Upon user confirmation, I will proceed accordingly. \n \n**Guidelines:** \n 1. **User Requirements:** \n - You have to ask users about their requirements, clarify the user expectations, and suggest the best possible solution by providing examples of Python code snippets. \n - Ask users about which type of reports they need to assess the AI model's performance, accuracy, and reliability. \n - After providing the solution, you have to ask the user about the trial of the solution and modify the solution based on the user feedback. \n \n 2. **Libraries/Frameworks:** \n - You will be utilizing Python as a programming language. \n - You will be using Flask framework for REST APIS implementation \n \n 3. **Communication Gesture:** \n - Your conversation with the user should be interactive, supportive, courageous, and professional. \n - You have to break down the complex concepts into sub-concepts and try to explain them to the user. \n - You have to ask the user for the required parameters. If the user refuses to provide in 2 attempts, politely exit the conversation. \n - You have to provide your supported parameters to the user, if the user refuses to accept them then you have to put an apology note and exit the conversation. \n - You have to track the conversation about unasked questions by the user. If some/one of the questions remain then you have to remind the user about these questions and proceed to answer them based on the user's confirmation \n \n 4. **Implementation:** \n - Your code/implementations should be reliable, scaleable, modular, and reusable. \n - You will be providing unit tests for the implementation upon user request. \n - You will be following MVC architecture for the applications \n - Your implementations must be well-commented and readable \n \n \n- Today's date is 23rd August 2024. \n- The default sender email is [email protected].\nHi, I am conducting research on retail customer feedback systems and I need assistance with designing and implementing them. Could you kindly provide me with a list of general customer feedback system modules?"
222
+ messages = [
223
+ {"role": "user", "content": custom_system_prompt + "\n\n" + prompt}
224
+ ]
225
+ # example tools
226
+ tools = [{"type": "function", "function": {"name": "getRetailFeedbackModules", "description": "Returns the list of modules usually present in the retail industry", "parameters": {"type": "object", "properties": {"page": {"type": "integer", "description": "The current page number.", "default": 1}, "page_size": {"type": "integer", "description": "The number of items per page.", "default": 3}}}}}, {"type": "function", "function": {"name": "verifyImplementation", "description": "Returns the list of modules usually present in the retail industry", "parameters": {"type": "object", "properties": {"coding_language": {"type": "string", "description": "The supported languages for verification of implementation.", "default": "python", "enum": ["python", "java", "php"]}, "code": {"type": "string", "description": "The code which needs verification"}, "design_pattern": {"type": "string", "description": "The design pattern to verify in the implementation", "enum": ["factory", "strategy", "singleton"]}, "verify_best_practices": {"type": "boolean", "description": "The verification of the coding style based on the language selected", "default": true}}}}}]
227
+ text = tokenizer.apply_chat_template(
228
+ messages,
229
+ tokenize=False,
230
+ add_generation_prompt=True,
231
+ tools=tools
232
+ )
233
+ model_inputs = tokenizer([text], return_tensors="pt")
234
+ ```
235
+
236
+ ## Usage Guidelines
237
+ 1. Use the model’s default chat template, which already includes a system prompt. We recommend adding all other instructions within the user message.
238
+ 2. We recommend setting temperature to `0.6`.
239
+ 3. We ensure the model starts with `Here are my reasoning steps:\n` during all our evaluations. This is implemented in the default chat template.
240
+
241
+ ---
242
+
243
+
244
+ # Intended Use
245
+
246
+ The Apriel family of models are designed for a variety of general-purpose instruction tasks, including:
247
+
248
+ - Code assistance and generation
249
+ - Logical reasoning and multi-step tasks
250
+ - Question answering and information retrieval
251
+ - Function calling, complex instruction following and agent use cases
252
+
253
+ They are **not intended** for use in safety-critical applications without human oversight or in scenarios requiring guaranteed factual accuracy.
254
+
255
+ ---
256
+
257
+ # Limitations
258
+
259
+ - **Factual accuracy:** May produce incorrect, misleading, or outdated content. Outputs should be verified before use in critical contexts.
260
+ - **Bias:** May reflect societal, cultural, or systemic biases present in training data.
261
+ - **Ethics:** Do not use the model to produce harmful, unlawful, or unethical content.
262
+ - **Language:** Strongest performance is in English. Output quality may degrade in underrepresented languages.
263
+ - **Critical use:** Not suitable for medical, legal, financial, or other high-risk applications without safeguards.
264
+
265
+ ---
266
+
267
+ # Security and Responsible Use
268
+
269
+ **Security Responsibilities:**
270
+ Deployers and users are strongly encouraged to align their security practices with established frameworks and regulatory guidelines such as the EU AI Act and the NIST AI Risk Management Framework (RMF).
271
+
272
+ **Guidelines for Deployers:**
273
+
274
+ - Regularly conduct robustness assessments to identify and mitigate adversarial inputs.
275
+ - Implement validation and filtering processes to prevent harmful or biased outputs.
276
+ - Continuously perform data privacy checks to guard against unintended data leaks.
277
+ - Document and communicate the model's limitations, intended usage, and known security risks to all end-users.
278
+ - Schedule periodic security reviews and updates to address emerging threats and vulnerabilities.
279
+
280
+ **Guidelines for Users:**
281
+
282
+ - Follow established security policies and usage guidelines provided by deployers.
283
+ - Protect and manage sensitive information when interacting with the model.
284
+ - Report anomalies, suspicious behavior, or unsafe outputs to deployers or developers.
285
+ - Maintain human oversight and apply judgment to mitigate potential security or ethical risks during interactions.
286
+
287
+ **Disclaimer:**
288
+ Users accept responsibility for securely deploying, managing, and using this open-source LLM. The model is provided "as-is," without explicit or implied warranty regarding security or fitness for any specific application or environment.
289
+
290
+ ---
291
+
292
+ # Software
293
+
294
+ - **Training stack:** [Fast-LLM](https://github.com/ServiceNow/Fast-LLM)
295
+
296
+ ---
297
+
298
+ # License
299
+
300
+ MIT
301
+
302
+ ---
303
+
304
+ # Citation
305
+
306
+ ```bibtex
307
+ @article{radhakrishna2025apriel,
308
+ title={Apriel-Nemotron-15B-Thinker},
309
+ author={Radhakrishna, Shruthan and Parikh, Soham and Sarda, Gopal and Turkkan, Anil and Vohra, Quaizar and Li, Raymond and Jhamb, Dhruv and Ogueji, Kelechi and Shukla, Aanjaneya and Bamgbose, Oluwanifemi and others},
310
+ journal={arXiv preprint arXiv:2508.10948},
311
+ year={2025}
312
+ }
313
+ ```
chat_template.jinja ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {%- set available_tools_string, thought_instructions, add_tool_id, tool_output_format = '', '', true, "default" -%}
2
+
3
+ {%- if tools is not none and tools|length > 0 -%}
4
+ {%- set available_tools_string -%}
5
+ You are provided with function signatures within <available_tools></available_tools> XML tags. You may call one or more functions to assist with the user query. Don't make assumptions about the arguments. You should infer the argument values from previous user responses and the system message. Here are the available tools:
6
+ <available_tools>
7
+ {% for tool in tools %}
8
+ {{ tool|string }}
9
+ {% endfor %}
10
+ </available_tools>
11
+ {%- endset -%}
12
+ {%- endif -%}
13
+ {%- if tool_output_format is none or tool_output_format == "default" -%}
14
+ {%- set tool_output_instructions -%}
15
+ Return all function calls as a list of json objects within <tool_call></tool_call> XML tags. Each json object should contain a function name and arguments as follows:
16
+ <tool_calls>[{"name": <function-name-1>, "arguments": <args-dict-1>}, {"name": <function-name-2>, "arguments": <args-dict-2>},...]</tool_calls>
17
+ {%- endset -%}
18
+ {%- elif tool_output_format == "yaml" -%}
19
+ {%- set tool_output_instructions -%}
20
+ Return all function calls as a list of yaml objects within <tool_call></tool_call> XML tags. Each yaml object should contain a function name and arguments as follows:
21
+ <tool_calls>
22
+ - name: <function-name-1>
23
+ arguments: <args-dict-1>
24
+ - name: <function-name-2>
25
+ arguments: <args-dict-2>
26
+ ...
27
+ </tool_calls>
28
+ {%- endset -%}
29
+ {%- endif -%}
30
+ {%- if add_thoughts -%}
31
+ {%- set thought_instructions -%}
32
+ Prior to generating the function calls, you should generate the reasoning for why you're calling the function. Please generate these reasoning thoughts between <thinking> and </thinking> XML tags.
33
+ {%- endset -%}
34
+ {%- endif -%}
35
+ {{- bos_token -}}
36
+ {%- set reasoning_prompt='You are a thoughtful and systematic AI assistant built by ServiceNow Language Models (SLAM) lab. Before providing an answer, analyze the problem carefully and present your reasoning step by step. After explaining your thought process, provide the final solution in the following format: [BEGIN FINAL RESPONSE] ... [END FINAL RESPONSE].' -%}
37
+ {%- if messages[0]['role'] != 'system' and tools is not none and tools|length > 0 -%}
38
+ {{- '<|system|>\n' + reasoning_prompt + available_tools_string + "\n" + tool_output_instructions + '\n<|end|>\n' -}}
39
+ {%- endif -%}
40
+ {%- if messages|selectattr('role', 'equalto', 'system')|list|length == 0 -%}
41
+ {{- '<|system|>\n' + reasoning_prompt + '\n<|end|>\n' -}}
42
+ {%- endif -%}
43
+ {%- for message in messages -%}
44
+ {%- if message['role'] == 'user' -%}
45
+ {{- '<|user|>\n' }}
46
+ {%- if message['content'] is not string %}
47
+ {%- for chunk in message['content'] %}
48
+ {%- if chunk['type'] == 'text' %}
49
+ {{- chunk['text'] }}
50
+ {%- elif chunk['type'] == 'image' or chunk['type'] == 'image_url'%}
51
+ {{- '[IMG]' }}
52
+ {%- else %}
53
+ {{- raise_exception('Unrecognized content type!') }}
54
+ {%- endif %}
55
+ {%- endfor %}
56
+ {%- else %}
57
+ {{- message['content'] }}
58
+ {%- endif %}
59
+ {{- '\n<|end|>\n' }}
60
+ {%- elif message['role'] == 'content' -%}
61
+ {%- if message['content'] is not string %}
62
+ {{- '<|content|>\n' + message['content'][0]['text'] + '\n<|end|>\n' -}}
63
+ {%- else %}
64
+ {{- '<|content|>\n' + message['content'] + '\n<|end|>\n' -}}
65
+ {%- endif -%}
66
+ {%- elif message['role'] == 'system' -%}
67
+ {%- if message['content'] is not none and message['content']|length > 0 %}
68
+ {%- if message['content'] is string %}
69
+ {%- set system_message = message['content'] %}
70
+ {%- else %}
71
+ {%- set system_message = message['content'][0]['text'] %}
72
+ {%- endif %}
73
+ {%- else %}
74
+ {%- set system_message = '' %}
75
+ {%- endif %}
76
+ {%- if tools is not none and tools|length > 0 -%}
77
+ {{- '<|system|>\n' + reasoning_prompt + system_message + '\n' + available_tools_string + '\n<|end|>\n' -}}
78
+ {%- else -%}
79
+ {{- '<|system|>\n' + reasoning_prompt + system_message + '\n<|end|>\n' -}}
80
+ {%- endif -%}
81
+ {%- elif message['role'] == 'assistant' -%}
82
+ {%- if loop.last -%}
83
+ {%- set add_tool_id = false -%}
84
+ {%- endif -%}
85
+ {{- '<|assistant|>\n' -}}
86
+ {%- if message['content'] is not none and message['content']|length > 0 -%}
87
+ {%- if message['content'] is not string and message['content'][0]['text'] is not none %}
88
+ {{- message['content'][0]['text'] }}
89
+ {%- else %}
90
+ {{- message['content'] -}}
91
+ {%- endif -%}
92
+ {%- elif message['chosen'] is not none and message['chosen']|length > 0 -%}
93
+ {{- message['chosen'][0] -}}
94
+ {%- endif -%}
95
+ {%- if add_thoughts and 'thought' in message and message['thought'] is not none -%}
96
+ {{- '<thinking>' + message['thought'] + '</thinking>' -}}
97
+ {%- endif -%}
98
+ {%- if message['tool_calls'] is not none and message['tool_calls']|length > 0 -%}
99
+ {{- '\n<tool_calls>[' -}}
100
+ {%- for tool_call in message["tool_calls"] -%}
101
+ {{- '{"name": "' + tool_call['function']['name'] + '", "arguments": ' + tool_call['function']['arguments']|string -}}
102
+ {%- if add_tool_id == true -%}
103
+ {{- ', "id": "' + tool_call['id'] + '"' -}}
104
+ {%- endif -%}
105
+ {{- '}' -}}
106
+ {%- if not loop.last -%}{{- ', ' -}}{%- endif -%}
107
+ {%- endfor -%}
108
+ {{- ']</tool_calls>' -}}
109
+ {%- endif -%}
110
+ {{- '\n<|end|>\n' + eos_token -}}
111
+ {%- elif message['role'] == 'tool' -%}
112
+ {%- if message['content'] is string %}
113
+ {%- set tool_message = message['content'] %}
114
+ {%- else %}
115
+ {%- set tool_message = message['content'][0]['text'] %}
116
+ {%- endif -%}
117
+ {{- '<|tool_result|>\n' + tool_message|string + '\n<|end|>\n' -}}
118
+ {%- endif -%}
119
+ {%- if loop.last and add_generation_prompt and message['role'] != 'assistant' -%}
120
+ {{- '<|assistant|>\n' -}}
121
+ {%- endif -%}
122
+ {%- endfor -%}
config.json ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "LlavaForConditionalGeneration"
4
+ ],
5
+ "dtype": "float32",
6
+ "ignore_index": -100,
7
+ "image_seq_length": 1,
8
+ "image_token_index": 10,
9
+ "model_type": "llava",
10
+ "multimodal_projector_bias": true,
11
+ "projector_hidden_act": "gelu",
12
+ "quantization_config": {
13
+ "config_groups": {
14
+ "group_0": {
15
+ "format": "pack-quantized",
16
+ "input_activations": null,
17
+ "output_activations": null,
18
+ "targets": [
19
+ "Linear"
20
+ ],
21
+ "weights": {
22
+ "actorder": null,
23
+ "block_structure": null,
24
+ "dynamic": false,
25
+ "group_size": 32,
26
+ "num_bits": 4,
27
+ "observer": "mse",
28
+ "observer_kwargs": {},
29
+ "strategy": "group",
30
+ "symmetric": true,
31
+ "type": "int"
32
+ }
33
+ }
34
+ },
35
+ "format": "pack-quantized",
36
+ "global_compression_ratio": null,
37
+ "ignore": [
38
+ "model.multi_modal_projector.linear_1",
39
+ "model.multi_modal_projector.linear_2",
40
+ "lm_head"
41
+ ],
42
+ "kv_cache_scheme": null,
43
+ "quant_method": "compressed-tensors",
44
+ "quantization_status": "compressed",
45
+ "sparsity_config": {},
46
+ "transform_config": {},
47
+ "version": "0.12.1.dev0"
48
+ },
49
+ "text_config": {
50
+ "_attn_implementation_autoset": false,
51
+ "attention_dropout": 0.0,
52
+ "dtype": "float32",
53
+ "head_dim": 128,
54
+ "hidden_act": "silu",
55
+ "hidden_size": 5120,
56
+ "initializer_range": 0.02,
57
+ "intermediate_size": 14336,
58
+ "max_position_embeddings": 262400,
59
+ "model_type": "mistral",
60
+ "num_attention_heads": 32,
61
+ "num_hidden_layers": 48,
62
+ "num_key_value_heads": 8,
63
+ "rms_norm_eps": 1e-05,
64
+ "rope_theta": 1000000000.0,
65
+ "sliding_window": null,
66
+ "tf_legacy_loss": false,
67
+ "use_bfloat16": false,
68
+ "use_cache": true,
69
+ "vocab_size": 131072
70
+ },
71
+ "tie_word_embeddings": false,
72
+ "transformers_version": "4.57.0.dev0",
73
+ "vision_config": {
74
+ "_attn_implementation_autoset": false,
75
+ "attention_dropout": 0.0,
76
+ "dtype": "float32",
77
+ "head_dim": 64,
78
+ "hidden_act": "silu",
79
+ "hidden_size": 1024,
80
+ "image_size": 1024,
81
+ "initializer_range": 0.02,
82
+ "intermediate_size": 4096,
83
+ "model_type": "pixtral",
84
+ "num_attention_heads": 16,
85
+ "num_channels": 3,
86
+ "num_hidden_layers": 24,
87
+ "patch_size": 16,
88
+ "rope_theta": 10000.0,
89
+ "tf_legacy_loss": false,
90
+ "use_bfloat16": false
91
+ },
92
+ "vision_feature_layer": -1,
93
+ "vision_feature_select_strategy": "full"
94
+ }
generation_config.json ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "transformers_version": "4.57.0.dev0"
6
+ }
model-00001-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6dba6b2b4a4ddd8f98b4cca62130ea84458d2923891646b2d951337f36b42405
3
+ size 4972891296
model-00002-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74d44552c452154b1e10d30055486251dade7dd7889b14acaa5b6a8db5eeec4f
3
+ size 4988566944
model-00003-of-00003.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1cce1efdba8a1b92a0a772e0cf28131c408cd1653df48bd402b7ff1a19ad5f79
3
+ size 3969231056
model.safetensors.index.json ADDED
The diff for this file is too large to render. See raw diff
 
preprocessor_config.json ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_convert_rgb": true,
3
+ "do_normalize": true,
4
+ "do_rescale": true,
5
+ "do_resize": true,
6
+ "image_mean": [
7
+ 0.48145466,
8
+ 0.4578275,
9
+ 0.40821073
10
+ ],
11
+ "image_processor_type": "PixtralImageProcessor",
12
+ "image_std": [
13
+ 0.26862954,
14
+ 0.26130258,
15
+ 0.27577711
16
+ ],
17
+ "patch_size": {
18
+ "height": 16,
19
+ "width": 16
20
+ },
21
+ "processor_class": "PixtralProcessor",
22
+ "resample": 3,
23
+ "rescale_factor": 0.00392156862745098,
24
+ "size": {
25
+ "longest_edge": 1024
26
+ }
27
+ }
processor_config.json ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "image_break_token": "[IMG_BREAK]",
3
+ "image_end_token": "[IMG_END]",
4
+ "image_token": "[IMG]",
5
+ "patch_size": 16,
6
+ "processor_class": "PixtralProcessor",
7
+ "spatial_merge_size": 1
8
+ }
recipe.yaml ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ default_stage:
2
+ default_modifiers:
3
+ AWQModifier:
4
+ config_groups:
5
+ group_0:
6
+ targets: [Linear]
7
+ weights:
8
+ num_bits: 4
9
+ type: int
10
+ symmetric: true
11
+ group_size: 32
12
+ strategy: group
13
+ block_structure: null
14
+ dynamic: false
15
+ actorder: null
16
+ observer: mse
17
+ observer_kwargs: {}
18
+ input_activations: null
19
+ output_activations: null
20
+ format: null
21
+ targets: [Linear]
22
+ ignore: ['re:.*embed_tokens', 're:.*input_layernorm$', 're:.*post_attention_layernorm$',
23
+ 're:.*model.norm', 're:.*lm_head', 're:.*multi_modal_projector.*', 're:.*multi_modal_projector.linear_.*re:.*vision_tower.*']
24
+ mappings:
25
+ - smooth_layer: re:.*input_layernorm$
26
+ balance_layers: ['re:.*q_proj$', 're:.*k_proj$', 're:.*v_proj$']
27
+ - smooth_layer: re:.*v_proj$
28
+ balance_layers: ['re:.*o_proj$']
29
+ - smooth_layer: re:.*post_attention_layernorm$
30
+ balance_layers: ['re:.*gate_proj$', 're:.*up_proj$']
31
+ - smooth_layer: re:.*up_proj$
32
+ balance_layers: ['re:.*down_proj$']
33
+ offload_device: !!python/object/apply:torch.device [cpu]
34
+ duo_scaling: true
special_tokens_map.json ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "bos_token": {
3
+ "content": "<s>",
4
+ "lstrip": false,
5
+ "normalized": false,
6
+ "rstrip": false,
7
+ "single_word": false
8
+ },
9
+ "eos_token": {
10
+ "content": "</s>",
11
+ "lstrip": false,
12
+ "normalized": false,
13
+ "rstrip": false,
14
+ "single_word": false
15
+ },
16
+ "pad_token": {
17
+ "content": "<pad>",
18
+ "lstrip": false,
19
+ "normalized": false,
20
+ "rstrip": false,
21
+ "single_word": false
22
+ },
23
+ "unk_token": {
24
+ "content": "<unk>",
25
+ "lstrip": false,
26
+ "normalized": false,
27
+ "rstrip": false,
28
+ "single_word": false
29
+ }
30
+ }
tokenizer.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84f33e6f52b2833e8cc17229af8eea363f640a898f19a48184a2c7f6f5a88337
3
+ size 17077329
tokenizer_config.json ADDED
The diff for this file is too large to render. See raw diff