imdatta0 commited on
Commit
4b7553a
·
1 Parent(s): 9b14b73

Revert "Add files using upload-large-folder tool"

Browse files

This reverts commit 9b14b73d637406ecfff2a2aefded6f3a3a2f22a3.

README.md CHANGED
@@ -1,199 +1,200 @@
1
  ---
 
 
 
 
2
  library_name: transformers
3
- tags: []
 
 
4
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- # Model Card for Model ID
7
-
8
- <!-- Provide a quick summary of what the model is/does. -->
9
-
10
-
11
-
12
- ## Model Details
13
-
14
- ### Model Description
15
-
16
- <!-- Provide a longer summary of what this model is. -->
17
-
18
- This is the model card of a 🤗 transformers model that has been pushed on the Hub. This model card has been automatically generated.
19
-
20
- - **Developed by:** [More Information Needed]
21
- - **Funded by [optional]:** [More Information Needed]
22
- - **Shared by [optional]:** [More Information Needed]
23
- - **Model type:** [More Information Needed]
24
- - **Language(s) (NLP):** [More Information Needed]
25
- - **License:** [More Information Needed]
26
- - **Finetuned from model [optional]:** [More Information Needed]
27
-
28
- ### Model Sources [optional]
29
-
30
- <!-- Provide the basic links for the model. -->
31
-
32
- - **Repository:** [More Information Needed]
33
- - **Paper [optional]:** [More Information Needed]
34
- - **Demo [optional]:** [More Information Needed]
35
-
36
- ## Uses
37
-
38
- <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
39
-
40
- ### Direct Use
41
-
42
- <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
43
-
44
- [More Information Needed]
45
-
46
- ### Downstream Use [optional]
47
-
48
- <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
49
-
50
- [More Information Needed]
51
-
52
- ### Out-of-Scope Use
53
-
54
- <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
55
-
56
- [More Information Needed]
57
-
58
- ## Bias, Risks, and Limitations
59
-
60
- <!-- This section is meant to convey both technical and sociotechnical limitations. -->
61
-
62
- [More Information Needed]
63
-
64
- ### Recommendations
65
-
66
- <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
67
-
68
- Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
69
-
70
- ## How to Get Started with the Model
71
-
72
- Use the code below to get started with the model.
73
-
74
- [More Information Needed]
75
-
76
- ## Training Details
77
-
78
- ### Training Data
79
-
80
- <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
81
-
82
- [More Information Needed]
83
-
84
- ### Training Procedure
85
-
86
- <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
87
-
88
- #### Preprocessing [optional]
89
-
90
- [More Information Needed]
91
-
92
-
93
- #### Training Hyperparameters
94
-
95
- - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
96
-
97
- #### Speeds, Sizes, Times [optional]
98
-
99
- <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
100
-
101
- [More Information Needed]
102
-
103
- ## Evaluation
104
-
105
- <!-- This section describes the evaluation protocols and provides the results. -->
106
-
107
- ### Testing Data, Factors & Metrics
108
-
109
- #### Testing Data
110
-
111
- <!-- This should link to a Dataset Card if possible. -->
112
-
113
- [More Information Needed]
114
 
115
- #### Factors
116
 
117
- <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
118
 
119
- [More Information Needed]
120
 
121
- #### Metrics
122
 
123
- <!-- These are the evaluation metrics being used, ideally with a description of why. -->
 
 
124
 
125
- [More Information Needed]
126
 
127
- ### Results
 
 
128
 
129
- [More Information Needed]
130
 
131
- #### Summary
 
 
 
 
 
132
 
 
 
 
133
 
 
 
 
 
 
 
134
 
135
- ## Model Examination [optional]
136
 
137
- <!-- Relevant interpretability work for the model goes here -->
 
 
 
138
 
139
- [More Information Needed]
140
 
141
- ## Environmental Impact
142
 
143
- <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
144
 
145
- Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
 
 
 
 
146
 
147
- - **Hardware Type:** [More Information Needed]
148
- - **Hours used:** [More Information Needed]
149
- - **Cloud Provider:** [More Information Needed]
150
- - **Compute Region:** [More Information Needed]
151
- - **Carbon Emitted:** [More Information Needed]
152
 
153
- ## Technical Specifications [optional]
154
 
155
- ### Model Architecture and Objective
156
 
157
- [More Information Needed]
158
 
159
- ### Compute Infrastructure
160
 
161
- [More Information Needed]
162
 
163
- #### Hardware
 
 
 
 
164
 
165
- [More Information Needed]
166
 
167
- #### Software
168
 
169
- [More Information Needed]
170
 
171
- ## Citation [optional]
 
 
 
172
 
173
- <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
174
 
175
- **BibTeX:**
176
 
177
- [More Information Needed]
178
 
179
- **APA:**
180
 
181
- [More Information Needed]
 
 
 
 
 
182
 
183
- ## Glossary [optional]
184
 
185
- <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
186
 
187
- [More Information Needed]
 
 
188
 
189
- ## More Information [optional]
190
 
191
- [More Information Needed]
192
 
193
- ## Model Card Authors [optional]
 
 
 
194
 
195
- [More Information Needed]
196
 
197
- ## Model Card Contact
198
 
199
- [More Information Needed]
 
1
  ---
2
+ base_model:
3
+ - openai/gpt-oss-20b
4
+ license: apache-2.0
5
+ pipeline_tag: text-generation
6
  library_name: transformers
7
+ tags:
8
+ - openai
9
+ - unsloth
10
  ---
11
+ <div>
12
+ <p style="margin-bottom: 0; margin-top: 0;">
13
+ <strong>See <a href="https://huggingface.co/collections/unsloth/gpt-oss-6892433695ce0dee42f31681">our collection</a> for all versions of gpt-oss including GGUF, 4-bit & 16-bit formats.</strong>
14
+ </p>
15
+ <p style="margin-bottom: 0;">
16
+ <em>Learn to run gpt-oss correctly - <a href="https://docs.unsloth.ai/basics/gpt-oss">Read our Guide</a>.</em>
17
+ </p>
18
+ <p style="margin-top: 0;margin-bottom: 0;">
19
+ <em>See <a href="https://docs.unsloth.ai/basics/unsloth-dynamic-v2.0-gguf">Unsloth Dynamic 2.0 GGUFs</a> for our quantization benchmarks.</em>
20
+ </p>
21
+ <div style="display: flex; gap: 5px; align-items: center; ">
22
+ <a href="https://github.com/unslothai/unsloth/">
23
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/unsloth%20new%20logo.png" width="133">
24
+ </a>
25
+ <a href="https://discord.gg/unsloth">
26
+ <img src="https://github.com/unslothai/unsloth/raw/main/images/Discord%20button.png" width="173">
27
+ </a>
28
+ <a href="https://docs.unsloth.ai/basics/gpt-oss">
29
+ <img src="https://raw.githubusercontent.com/unslothai/unsloth/refs/heads/main/images/documentation%20green%20button.png" width="143">
30
+ </a>
31
+ </div>
32
+ <h1 style="margin-top: 0rem;">✨ Read our gpt-oss Guide <a href="https://docs.unsloth.ai/basics/gpt-oss">here</a>!</h1>
33
+ </div>
34
+
35
+ - Read our Blog about gpt-oss support: [unsloth.ai/blog/gpt-oss](https://unsloth.ai/blog/gpt-oss)
36
+ - View the rest of our notebooks in our [docs here](https://docs.unsloth.ai/get-started/unsloth-notebooks).
37
+ - Thank you to the [llama.cpp](https://github.com/ggml-org/llama.cpp) team for their work on supporting this model. We wouldn't be able to release quants without them!
38
+
39
+ # gpt-oss-20b Details
40
+
41
+ <p align="center">
42
+ <img alt="gpt-oss-20b" src="https://raw.githubusercontent.com/openai/gpt-oss/main/docs/gpt-oss-20b.svg">
43
+ </p>
44
+
45
+ <p align="center">
46
+ <a href="https://gpt-oss.com"><strong>Try gpt-oss</strong></a> ·
47
+ <a href="https://cookbook.openai.com/topic/gpt-oss"><strong>Guides</strong></a> ·
48
+ <a href="https://openai.com/index/gpt-oss-model-card"><strong>System card</strong></a> ·
49
+ <a href="https://openai.com/index/introducing-gpt-oss/"><strong>OpenAI blog</strong></a>
50
+ </p>
51
+
52
+ <br>
53
+
54
+ Welcome to the gpt-oss series, [OpenAI’s open-weight models](https://openai.com/open-models) designed for powerful reasoning, agentic tasks, and versatile developer use cases.
55
+
56
+ We’re releasing two flavors of the open models:
57
+ - `gpt-oss-120b` — for production, general purpose, high reasoning use cases that fits into a single H100 GPU (117B parameters with 5.1B active parameters)
58
+ - `gpt-oss-20b` — for lower latency, and local or specialized use cases (21B parameters with 3.6B active parameters)
59
+
60
+ Both models were trained on our [harmony response format](https://github.com/openai/harmony) and should only be used with the harmony format as it will not work correctly otherwise.
61
+
62
+
63
+ > [!NOTE]
64
+ > This model card is dedicated to the smaller `gpt-oss-20b` model. Check out [`gpt-oss-120b`](https://huggingface.co/openai/gpt-oss-120b) for the larger model.
65
+
66
+ # Highlights
67
+
68
+ * **Permissive Apache 2.0 license:** Build freely without copyleft restrictions or patent risk—ideal for experimentation, customization, and commercial deployment.
69
+ * **Configurable reasoning effort:** Easily adjust the reasoning effort (low, medium, high) based on your specific use case and latency needs.
70
+ * **Full chain-of-thought:** Gain complete access to the model’s reasoning process, facilitating easier debugging and increased trust in outputs. It’s not intended to be shown to end users.
71
+ * **Fine-tunable:** Fully customize models to your specific use case through parameter fine-tuning.
72
+ * **Agentic capabilities:** Use the models’ native capabilities for function calling, [web browsing](https://github.com/openai/gpt-oss/tree/main?tab=readme-ov-file#browser), [Python code execution](https://github.com/openai/gpt-oss/tree/main?tab=readme-ov-file#python), and Structured Outputs.
73
+ * **Native MXFP4 quantization:** The models are trained with native MXFP4 precision for the MoE layer, making `gpt-oss-120b` run on a single H100 GPU and the `gpt-oss-20b` model run within 16GB of memory.
74
 
75
+ ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
+ # Inference examples
78
 
79
+ ## Transformers
80
 
81
+ You can use `gpt-oss-120b` and `gpt-oss-20b` with Transformers. If you use the Transformers chat template, it will automatically apply the [harmony response format](https://github.com/openai/harmony). If you use `model.generate` directly, you need to apply the harmony format manually using the chat template or use our [openai-harmony](https://github.com/openai/harmony) package.
82
 
83
+ To get started, install the necessary dependencies to setup your environment:
84
 
85
+ ```
86
+ pip install -U transformers kernels torch
87
+ ```
88
 
89
+ Once, setup you can proceed to run the model by running the snippet below:
90
 
91
+ ```py
92
+ from transformers import pipeline
93
+ import torch
94
 
95
+ model_id = "openai/gpt-oss-20b"
96
 
97
+ pipe = pipeline(
98
+ "text-generation",
99
+ model=model_id,
100
+ torch_dtype="auto",
101
+ device_map="auto",
102
+ )
103
 
104
+ messages = [
105
+ {"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
106
+ ]
107
 
108
+ outputs = pipe(
109
+ messages,
110
+ max_new_tokens=256,
111
+ )
112
+ print(outputs[0]["generated_text"][-1])
113
+ ```
114
 
115
+ Alternatively, you can run the model via [`Transformers Serve`](https://huggingface.co/docs/transformers/main/serving) to spin up a OpenAI-compatible webserver:
116
 
117
+ ```
118
+ transformers serve
119
+ transformers chat localhost:8000 --model-name-or-path openai/gpt-oss-20b
120
+ ```
121
 
122
+ [Learn more about how to use gpt-oss with Transformers.](https://cookbook.openai.com/articles/gpt-oss/run-transformers)
123
 
124
+ ## vLLM
125
 
126
+ vLLM recommends using [uv](https://docs.astral.sh/uv/) for Python dependency management. You can use vLLM to spin up an OpenAI-compatible webserver. The following command will automatically download the model and start the server.
127
 
128
+ ```bash
129
+ uv pip install --pre vllm==0.10.1+gptoss \
130
+ --extra-index-url https://wheels.vllm.ai/gpt-oss/ \
131
+ --extra-index-url https://download.pytorch.org/whl/nightly/cu128 \
132
+ --index-strategy unsafe-best-match
133
 
134
+ vllm serve openai/gpt-oss-20b
135
+ ```
 
 
 
136
 
137
+ [Learn more about how to use gpt-oss with vLLM.](https://cookbook.openai.com/articles/gpt-oss/run-vllm)
138
 
139
+ ## PyTorch / Triton
140
 
141
+ To learn about how to use this model with PyTorch and Triton, check out our [reference implementations in the gpt-oss repository](https://github.com/openai/gpt-oss?tab=readme-ov-file#reference-pytorch-implementation).
142
 
143
+ ## Ollama
144
 
145
+ If you are trying to run gpt-oss on consumer hardware, you can use Ollama by running the following commands after [installing Ollama](https://ollama.com/download).
146
 
147
+ ```bash
148
+ # gpt-oss-20b
149
+ ollama pull gpt-oss:20b
150
+ ollama run gpt-oss:20b
151
+ ```
152
 
153
+ [Learn more about how to use gpt-oss with Ollama.](https://cookbook.openai.com/articles/gpt-oss/run-locally-ollama)
154
 
155
+ #### LM Studio
156
 
157
+ If you are using [LM Studio](https://lmstudio.ai/) you can use the following commands to download.
158
 
159
+ ```bash
160
+ # gpt-oss-20b
161
+ lms get openai/gpt-oss-20b
162
+ ```
163
 
164
+ Check out our [awesome list](https://github.com/openai/gpt-oss/blob/main/awesome-gpt-oss.md) for a broader collection of gpt-oss resources and inference partners.
165
 
166
+ ---
167
 
168
+ # Download the model
169
 
170
+ You can download the model weights from the [Hugging Face Hub](https://huggingface.co/collections/openai/gpt-oss-68911959590a1634ba11c7a4) directly from Hugging Face CLI:
171
 
172
+ ```shell
173
+ # gpt-oss-20b
174
+ huggingface-cli download openai/gpt-oss-20b --include "original/*" --local-dir gpt-oss-20b/
175
+ pip install gpt-oss
176
+ python -m gpt_oss.chat model/
177
+ ```
178
 
179
+ # Reasoning levels
180
 
181
+ You can adjust the reasoning level that suits your task across three levels:
182
 
183
+ * **Low:** Fast responses for general dialogue.
184
+ * **Medium:** Balanced speed and detail.
185
+ * **High:** Deep and detailed analysis.
186
 
187
+ The reasoning level can be set in the system prompts, e.g., "Reasoning: high".
188
 
189
+ # Tool use
190
 
191
+ The gpt-oss models are excellent for:
192
+ * Web browsing (using built-in browsing tools)
193
+ * Function calling with defined schemas
194
+ * Agentic operations like browser tasks
195
 
196
+ # Fine-tuning
197
 
198
+ Both gpt-oss models can be fine-tuned for a variety of specialized use cases.
199
 
200
+ This smaller model `gpt-oss-20b` can be fine-tuned on consumer hardware, whereas the larger [`gpt-oss-120b`](https://huggingface.co/openai/gpt-oss-120b) can be fine-tuned on a single H100 node.
chat_template.jinja CHANGED
@@ -84,8 +84,7 @@
84
 
85
  {%- elif param_spec.type == "object" -%}
86
  {%- if param_spec.properties -%}
87
- {{- "{
88
- " }}
89
  {%- for prop_name, prop_spec in param_spec.properties.items() -%}
90
  {{- prop_name -}}
91
  {%- if prop_name not in (param_spec.required or []) -%}
@@ -107,25 +106,17 @@
107
  {%- endmacro -%}
108
 
109
  {%- macro render_tool_namespace(namespace_name, tools) -%}
110
- {{- "## " + namespace_name + "
111
-
112
- " }}
113
- {{- "namespace " + namespace_name + " {
114
-
115
- " }}
116
  {%- for tool in tools %}
117
  {%- set tool = tool.function %}
118
- {{- "// " + tool.description + "
119
- " }}
120
- {{- "type "+ tool.name + " = " }}
121
- {%- if tool.parameters and tool.parameters.properties %}
122
- {{- "(_: {
123
- " }}
124
  {%- for param_name, param_spec in tool.parameters.properties.items() %}
125
- {%- if param_spec.description %}
126
- {{- "// " + param_spec.description + "
127
- " }}
128
- {%- endif %}
129
  {{- param_name }}
130
  {%- if param_name not in (tool.parameters.required or []) -%}
131
  {{- "?" }}
@@ -133,147 +124,84 @@
133
  {{- ": " }}
134
  {{- render_typescript_type(param_spec, tool.parameters.required or []) }}
135
  {%- if param_spec.default is defined -%}
136
- {%- if param_spec.enum %}
137
- {{- ", // default: " + param_spec.default }}
138
- {%- elif param_spec.oneOf %}
139
  {{- "// default: " + param_spec.default }}
140
  {%- else %}
141
  {{- ", // default: " + param_spec.default|tojson }}
142
  {%- endif -%}
143
  {%- endif -%}
144
  {%- if not loop.last %}
145
- {{- ",
146
- " }}
147
- {%- else %}
148
- {{- "
149
- " }}
150
  {%- endif -%}
151
  {%- endfor %}
152
- {{- "}) => any;
153
-
154
- " }}
155
  {%- else -%}
156
- {{- "() => any;
157
-
158
- " }}
159
  {%- endif -%}
160
  {%- endfor %}
161
- {{- "} // namespace " + namespace_name }}
162
  {%- endmacro -%}
163
 
164
  {%- macro render_builtin_tools(browser_tool, python_tool) -%}
165
  {%- if browser_tool %}
166
- {{- "## browser
167
-
168
- " }}
169
- {{- "// Tool for browsing.
170
- " }}
171
- {{- "// The `cursor` appears in brackets before each browsing display: `[{cursor}]`.
172
- " }}
173
- {{- "// Cite information from the tool using the following format:
174
- " }}
175
- {{- "// `【{cursor}†L{line_start}(-L{line_end})?】`, for example: `【6†L9-L11】` or `【8†L3】`.
176
- " }}
177
- {{- "// Do not quote more than 10 words directly from the tool output.
178
- " }}
179
- {{- "// sources=web (default: web)
180
- " }}
181
- {{- "namespace browser {
182
-
183
- " }}
184
- {{- "// Searches for information related to `query` and displays `topn` results.
185
- " }}
186
- {{- "type search = (_: {
187
- " }}
188
- {{- "query: string,
189
- " }}
190
- {{- "topn?: number, // default: 10
191
- " }}
192
- {{- "source?: string,
193
- " }}
194
- {{- "}) => any;
195
-
196
- " }}
197
- {{- "// Opens the link `id` from the page indicated by `cursor` starting at line number `loc`, showing `num_lines` lines.
198
- " }}
199
- {{- "// Valid link ids are displayed with the formatting: `【{id}†.*】`.
200
- " }}
201
- {{- "// If `cursor` is not provided, the most recent page is implied.
202
- " }}
203
- {{- "// If `id` is a string, it is treated as a fully qualified URL associated with `source`.
204
- " }}
205
- {{- "// If `loc` is not provided, the viewport will be positioned at the beginning of the document or centered on the most relevant passage, if available.
206
- " }}
207
- {{- "// Use this function without `id` to scroll to a new location of an opened page.
208
- " }}
209
- {{- "type open = (_: {
210
- " }}
211
- {{- "id?: number | string, // default: -1
212
- " }}
213
- {{- "cursor?: number, // default: -1
214
- " }}
215
- {{- "loc?: number, // default: -1
216
- " }}
217
- {{- "num_lines?: number, // default: -1
218
- " }}
219
- {{- "view_source?: boolean, // default: false
220
- " }}
221
- {{- "source?: string,
222
- " }}
223
- {{- "}) => any;
224
-
225
- " }}
226
- {{- "// Finds exact matches of `pattern` in the current page, or the page given by `cursor`.
227
- " }}
228
- {{- "type find = (_: {
229
- " }}
230
- {{- "pattern: string,
231
- " }}
232
- {{- "cursor?: number, // default: -1
233
- " }}
234
- {{- "}) => any;
235
-
236
- " }}
237
- {{- "} // namespace browser
238
-
239
- " }}
240
  {%- endif -%}
241
 
242
  {%- if python_tool %}
243
- {{- "## python
244
-
245
- " }}
246
- {{- "Use this tool to execute Python code in your chain of thought. The code will not be shown to the user. This tool should be used for internal reasoning, but not for code that is intended to be visible to the user (e.g. when creating plots, tables, or files).
247
-
248
- " }}
249
- {{- "When you send a message containing Python code to python, it will be executed in a stateful Jupyter notebook environment. python will respond with the output of the execution or time out after 120.0 seconds. The drive at '/mnt/data' can be used to save and persist user files. Internet access for this session is UNKNOWN. Depends on the cluster.
250
-
251
- " }}
252
  {%- endif -%}
253
  {%- endmacro -%}
254
 
255
  {#- System Message Construction ============================================ #}
256
  {%- macro build_system_message() -%}
257
  {%- if model_identity is not defined %}
258
- {%- set model_identity = "You are ChatGPT, a large language model trained by OpenAI." %}
 
 
259
  {%- endif %}
260
- {{- model_identity + "
261
- " }}
262
- {{- "Knowledge cutoff: 2024-06
263
- " }}
264
- {{- "Current date: " + strftime_now("%Y-%m-%d") + "
265
-
266
- " }}
267
  {%- if reasoning_effort is not defined %}
268
  {%- set reasoning_effort = "medium" %}
269
  {%- endif %}
270
- {{- "Reasoning: " + reasoning_effort + "
271
-
272
- " }}
273
- {%- if builtin_tools %}
274
- {{- "# Tools
275
-
276
- " }}
277
  {%- set available_builtin_tools = namespace(browser=false, python=false) %}
278
  {%- for tool in builtin_tools %}
279
  {%- if tool == "browser" %}
@@ -284,11 +212,8 @@
284
  {%- endfor %}
285
  {{- render_builtin_tools(available_builtin_tools.browser, available_builtin_tools.python) }}
286
  {%- endif -%}
287
- {{- "# Valid channels: analysis, commentary, final. Channel must be included for every message." }}
288
- {%- if tools -%}
289
- {{- "
290
- Calls to these tools must go to the commentary channel: 'functions'." }}
291
- {%- endif -%}
292
  {%- endmacro -%}
293
 
294
  {#- Main Template Logic ================================================= #}
@@ -312,18 +237,12 @@ Calls to these tools must go to the commentary channel: 'functions'." }}
312
  {%- if developer_message or tools %}
313
  {{- "<|start|>developer<|message|>" }}
314
  {%- if developer_message %}
315
- {{- "# Instructions
316
-
317
- " }}
318
  {{- developer_message }}
319
  {%- endif %}
320
  {%- if tools -%}
321
- {{- "
322
-
323
- " }}
324
- {{- "# Tools
325
-
326
- " }}
327
  {{- render_tool_namespace("functions", tools) }}
328
  {%- endif -%}
329
  {{- "<|end|>" }}
@@ -334,17 +253,6 @@ Calls to these tools must go to the commentary channel: 'functions'." }}
334
  {%- for message in loop_messages -%}
335
  {#- At this point only assistant/user/tool messages should remain #}
336
  {%- if message.role == 'assistant' -%}
337
- {#- Checks to ensure the messages are being passed in the format we expect #}
338
- {%- if "content" in message %}
339
- {%- if "<|channel|>analysis<|message|>" in message.content or "<|channel|>final<|message|>" in message.content %}
340
- {{- raise_exception("You have passed a message containing <|channel|> tags in the content field. Instead of doing this, you should pass analysis messages (the string between '<|message|>' and '<|end|>') in the 'thinking' field, and final messages (the string between '<|message|>' and '<|end|>') in the 'content' field.") }}
341
- {%- endif %}
342
- {%- endif %}
343
- {%- if "thinking" in message %}
344
- {%- if "<|channel|>analysis<|message|>" in message.thinking or "<|channel|>final<|message|>" in message.thinking %}
345
- {{- raise_exception("You have passed a message containing <|channel|> tags in the thinking field. Instead of doing this, you should pass analysis messages (the string between '<|message|>' and '<|end|>') in the 'thinking' field, and final messages (the string between '<|message|>' and '<|end|>') in the 'content' field.") }}
346
- {%- endif %}
347
- {%- endif %}
348
  {%- if "tool_calls" in message %}
349
  {#- We assume max 1 tool call per message, and so we infer the tool call name #}
350
  {#- in "tool" messages from the most recent assistant tool call name #}
@@ -352,33 +260,35 @@ Calls to these tools must go to the commentary channel: 'functions'." }}
352
  {%- if tool_call.function %}
353
  {%- set tool_call = tool_call.function %}
354
  {%- endif %}
355
- {%- if message.content and message.thinking %}
356
- {{- raise_exception("Cannot pass both content and thinking in an assistant message with tool calls! Put the analysis message in one or the other, but not both.") }}
357
- {%- elif message.content %}
358
  {{- "<|start|>assistant<|channel|>analysis<|message|>" + message.content + "<|end|>" }}
359
- {%- elif message.thinking %}
360
- {{- "<|start|>assistant<|channel|>analysis<|message|>" + message.thinking + "<|end|>" }}
361
  {%- endif %}
362
  {{- "<|start|>assistant to=" }}
363
- {{- "functions." + tool_call.name + "<|channel|>commentary " }}
364
- {{- (tool_call.content_type if tool_call.content_type is defined else "json") + "<|message|>" }}
365
  {{- tool_call.arguments|tojson }}
366
- {{- "<|call|>" }}
367
  {%- set last_tool_call.name = tool_call.name %}
368
- {%- elif loop.last and not add_generation_prompt %}
369
  {#- Only render the CoT if the final turn is an assistant turn and add_generation_prompt is false #}
370
  {#- This is a situation that should only occur in training, never in inference. #}
371
- {%- if "thinking" in message %}
372
- {{- "<|start|>assistant<|channel|>analysis<|message|>" + message.thinking + "<|end|>" }}
373
- {%- endif %}
374
  {#- <|return|> indicates the end of generation, but <|end|> does not #}
375
  {#- <|return|> should never be an input to the model, but we include it as the final token #}
376
  {#- when training, so the model learns to emit it. #}
377
  {{- "<|start|>assistant<|channel|>final<|message|>" + message.content + "<|return|>" }}
378
- {%- else %}
 
379
  {#- CoT is dropped during all previous turns, so we never render it for inference #}
380
  {{- "<|start|>assistant<|channel|>final<|message|>" + message.content + "<|end|>" }}
381
  {%- set last_tool_call.name = none %}
 
 
 
 
 
 
 
 
382
  {%- endif %}
383
  {%- elif message.role == 'tool' -%}
384
  {%- if last_tool_call.name is none %}
@@ -386,7 +296,7 @@ Calls to these tools must go to the commentary channel: 'functions'." }}
386
  {%- endif %}
387
  {{- "<|start|>functions." + last_tool_call.name }}
388
  {{- " to=assistant<|channel|>commentary<|message|>" + message.content|tojson + "<|end|>" }}
389
- {%- elif message.role == 'user' -%}
390
  {{- "<|start|>user<|message|>" + message.content + "<|end|>" }}
391
  {%- endif -%}
392
  {%- endfor -%}
@@ -394,4 +304,4 @@ Calls to these tools must go to the commentary channel: 'functions'." }}
394
  {#- Generation prompt #}
395
  {%- if add_generation_prompt -%}
396
  <|start|>assistant
397
- {%- endif -%}
 
84
 
85
  {%- elif param_spec.type == "object" -%}
86
  {%- if param_spec.properties -%}
87
+ {{- "{\n" }}
 
88
  {%- for prop_name, prop_spec in param_spec.properties.items() -%}
89
  {{- prop_name -}}
90
  {%- if prop_name not in (param_spec.required or []) -%}
 
106
  {%- endmacro -%}
107
 
108
  {%- macro render_tool_namespace(namespace_name, tools) -%}
109
+ {{- "## " + namespace_name + "\n\n" }}
110
+ {{- "namespace " + namespace_name + " {\n\n" }}
 
 
 
 
111
  {%- for tool in tools %}
112
  {%- set tool = tool.function %}
113
+ {{- "// " + tool.description + "\n" }}
114
+ {{- "type "+ tool.name + " = (" }}
115
+ {%- if tool.parameters and tool.parameters.properties -%}
116
+ {{- "_: " }}
117
+ {{- "{\n" }}
 
118
  {%- for param_name, param_spec in tool.parameters.properties.items() %}
119
+ {{- "// " + param_spec.description + "\n" }}
 
 
 
120
  {{- param_name }}
121
  {%- if param_name not in (tool.parameters.required or []) -%}
122
  {{- "?" }}
 
124
  {{- ": " }}
125
  {{- render_typescript_type(param_spec, tool.parameters.required or []) }}
126
  {%- if param_spec.default is defined -%}
127
+ {%- if param_spec.oneOf %}
 
 
128
  {{- "// default: " + param_spec.default }}
129
  {%- else %}
130
  {{- ", // default: " + param_spec.default|tojson }}
131
  {%- endif -%}
132
  {%- endif -%}
133
  {%- if not loop.last %}
134
+ {{- ",\n" }}
 
 
 
 
135
  {%- endif -%}
136
  {%- endfor %}
137
+ {{- ",\n}) => any;\n" }}
 
 
138
  {%- else -%}
139
+ {{- "\n}) => any;\n" }}
 
 
140
  {%- endif -%}
141
  {%- endfor %}
142
+ {{- "\n} // namespace " + namespace_name }}
143
  {%- endmacro -%}
144
 
145
  {%- macro render_builtin_tools(browser_tool, python_tool) -%}
146
  {%- if browser_tool %}
147
+ {{- "## browser\n\n" }}
148
+ {{- "// Tool for browsing.\n" }}
149
+ {{- "// The `cursor` appears in brackets before each browsing display: `[{cursor}]`.\n" }}
150
+ {{- "// Cite information from the tool using the following format:\n" }}
151
+ {{- "// `【{cursor}†L{line_start}(-L{line_end})?】`, for example: `【6†L9-L11】` or `【8†L3】`.\n" }}
152
+ {{- "// Do not quote more than 10 words directly from the tool output.\n" }}
153
+ {{- "// sources=web (default: web)\n" }}
154
+ {{- "namespace browser {\n\n" }}
155
+ {{- "// Searches for information related to `query` and displays `topn` results.\n" }}
156
+ {{- "type search = (_: {\n" }}
157
+ {{- "query: string,\n" }}
158
+ {{- "topn?: number, // default: 10\n" }}
159
+ {{- "source?: string,\n" }}
160
+ {{- "}) => any;\n\n" }}
161
+ {{- "// Opens the link `id` from the page indicated by `cursor` starting at line number `loc`, showing `num_lines` lines.\n" }}
162
+ {{- "// Valid link ids are displayed with the formatting: `【{id}†.*】`.\n" }}
163
+ {{- "// If `cursor` is not provided, the most recent page is implied.\n" }}
164
+ {{- "// If `id` is a string, it is treated as a fully qualified URL associated with `source`.\n" }}
165
+ {{- "// If `loc` is not provided, the viewport will be positioned at the beginning of the document or centered on the most relevant passage, if available.\n" }}
166
+ {{- "// Use this function without `id` to scroll to a new location of an opened page.\n" }}
167
+ {{- "type open = (_: {\n" }}
168
+ {{- "id?: number | string, // default: -1\n" }}
169
+ {{- "cursor?: number, // default: -1\n" }}
170
+ {{- "loc?: number, // default: -1\n" }}
171
+ {{- "num_lines?: number, // default: -1\n" }}
172
+ {{- "view_source?: boolean, // default: false\n" }}
173
+ {{- "source?: string,\n" }}
174
+ {{- "}) => any;\n\n" }}
175
+ {{- "// Finds exact matches of `pattern` in the current page, or the page given by `cursor`.\n" }}
176
+ {{- "type find = (_: {\n" }}
177
+ {{- "pattern: string,\n" }}
178
+ {{- "cursor?: number, // default: -1\n" }}
179
+ {{- "}) => any;\n\n" }}
180
+ {{- "} // namespace browser\n\n" }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  {%- endif -%}
182
 
183
  {%- if python_tool %}
184
+ {{- "## python\n\n" }}
185
+ {{- "Use this tool to execute Python code in your chain of thought. The code will not be shown to the user. This tool should be used for internal reasoning, but not for code that is intended to be visible to the user (e.g. when creating plots, tables, or files).\n\n" }}
186
+ {{- "When you send a message containing Python code to python, it will be executed in a stateful Jupyter notebook environment. python will respond with the output of the execution or time out after 120.0 seconds. The drive at '/mnt/data' can be used to save and persist user files. Internet access for this session is UNKNOWN. Depends on the cluster.\n\n" }}
 
 
 
 
 
 
187
  {%- endif -%}
188
  {%- endmacro -%}
189
 
190
  {#- System Message Construction ============================================ #}
191
  {%- macro build_system_message() -%}
192
  {%- if model_identity is not defined %}
193
+ {{- "You are ChatGPT, a large language model trained by OpenAI.\n" -}}
194
+ {%- else %}
195
+ {{- model_identity }}
196
  {%- endif %}
197
+ {{- "Knowledge cutoff: 2024-06\n" }}
198
+ {{- "Current date: " + strftime_now("%Y-%m-%d") + "\n\n" }}
 
 
 
 
 
199
  {%- if reasoning_effort is not defined %}
200
  {%- set reasoning_effort = "medium" %}
201
  {%- endif %}
202
+ {{- "Reasoning: " + reasoning_effort + "\n\n" }}
203
+ {%- if builtin_tools is defined %}
204
+ {{- "# Tools\n\n" }}
 
 
 
 
205
  {%- set available_builtin_tools = namespace(browser=false, python=false) %}
206
  {%- for tool in builtin_tools %}
207
  {%- if tool == "browser" %}
 
212
  {%- endfor %}
213
  {{- render_builtin_tools(available_builtin_tools.browser, available_builtin_tools.python) }}
214
  {%- endif -%}
215
+ {{- "# Valid channels: analysis, commentary, final. Channel must be included for every message.\n" }}
216
+ {{- "Calls to these tools must go to the commentary channel: 'functions'." }}
 
 
 
217
  {%- endmacro -%}
218
 
219
  {#- Main Template Logic ================================================= #}
 
237
  {%- if developer_message or tools %}
238
  {{- "<|start|>developer<|message|>" }}
239
  {%- if developer_message %}
240
+ {{- "# Instructions\n\n" }}
 
 
241
  {{- developer_message }}
242
  {%- endif %}
243
  {%- if tools -%}
244
+ {{- "\n\n" }}
245
+ {{- "# Tools\n\n" }}
 
 
 
 
246
  {{- render_tool_namespace("functions", tools) }}
247
  {%- endif -%}
248
  {{- "<|end|>" }}
 
253
  {%- for message in loop_messages -%}
254
  {#- At this point only assistant/user/tool messages should remain #}
255
  {%- if message.role == 'assistant' -%}
 
 
 
 
 
 
 
 
 
 
 
256
  {%- if "tool_calls" in message %}
257
  {#- We assume max 1 tool call per message, and so we infer the tool call name #}
258
  {#- in "tool" messages from the most recent assistant tool call name #}
 
260
  {%- if tool_call.function %}
261
  {%- set tool_call = tool_call.function %}
262
  {%- endif %}
263
+ {%- if message.content %}
 
 
264
  {{- "<|start|>assistant<|channel|>analysis<|message|>" + message.content + "<|end|>" }}
 
 
265
  {%- endif %}
266
  {{- "<|start|>assistant to=" }}
267
+ {{- "functions." + tool_call.name + "<|channel|>commentary json<|message|>" }}
 
268
  {{- tool_call.arguments|tojson }}
269
+ {{- "<|end|>" }}
270
  {%- set last_tool_call.name = tool_call.name %}
271
+ {%- elif "thinking" in message and loop.last and not add_generation_prompt %}
272
  {#- Only render the CoT if the final turn is an assistant turn and add_generation_prompt is false #}
273
  {#- This is a situation that should only occur in training, never in inference. #}
274
+ {{- "<|start|>assistant<|channel|>analysis<|message|>" + message.thinking + "<|end|>" }}
 
 
275
  {#- <|return|> indicates the end of generation, but <|end|> does not #}
276
  {#- <|return|> should never be an input to the model, but we include it as the final token #}
277
  {#- when training, so the model learns to emit it. #}
278
  {{- "<|start|>assistant<|channel|>final<|message|>" + message.content + "<|return|>" }}
279
+ {%- set last_tool_call.name = none %}
280
+ {%- elif "thinking" in message %}
281
  {#- CoT is dropped during all previous turns, so we never render it for inference #}
282
  {{- "<|start|>assistant<|channel|>final<|message|>" + message.content + "<|end|>" }}
283
  {%- set last_tool_call.name = none %}
284
+ {%- elif loop.last and not add_generation_prompt %}
285
+ {#- <|return|> indicates the end of generation, but <|end|> does not #}
286
+ {#- <|return|> should never be an input to the model, but we include it as the final token #}
287
+ {#- when training, so the model learns to emit it. #}
288
+ {{- "<|start|>assistant<|message|>" + message.content + "<|return|>" }}
289
+ {%- else %}
290
+ {{- "<|start|>assistant<|message|>" + message.content + "<|end|>" }}
291
+ {%- set last_tool_call.name = none %}
292
  {%- endif %}
293
  {%- elif message.role == 'tool' -%}
294
  {%- if last_tool_call.name is none %}
 
296
  {%- endif %}
297
  {{- "<|start|>functions." + last_tool_call.name }}
298
  {{- " to=assistant<|channel|>commentary<|message|>" + message.content|tojson + "<|end|>" }}
299
+ {%- else -%}
300
  {{- "<|start|>user<|message|>" + message.content + "<|end|>" }}
301
  {%- endif -%}
302
  {%- endfor -%}
 
304
  {#- Generation prompt #}
305
  {%- if add_generation_prompt -%}
306
  <|start|>assistant
307
+ {%- endif -%}
config.json CHANGED
@@ -50,10 +50,10 @@
50
  "quantization_config": {
51
  "_load_in_4bit": true,
52
  "_load_in_8bit": false,
53
- "bnb_4bit_compute_dtype": "float32",
54
  "bnb_4bit_quant_storage": "uint8",
55
- "bnb_4bit_quant_type": "fp4",
56
- "bnb_4bit_use_double_quant": false,
57
  "llm_int8_enable_fp32_cpu_offload": false,
58
  "llm_int8_has_fp16_weight": false,
59
  "llm_int8_skip_modules": null,
 
50
  "quantization_config": {
51
  "_load_in_4bit": true,
52
  "_load_in_8bit": false,
53
+ "bnb_4bit_compute_dtype": "bfloat16",
54
  "bnb_4bit_quant_storage": "uint8",
55
+ "bnb_4bit_quant_type": "nf4",
56
+ "bnb_4bit_use_double_quant": true,
57
  "llm_int8_enable_fp32_cpu_offload": false,
58
  "llm_int8_has_fp16_weight": false,
59
  "llm_int8_skip_modules": null,
model-00001-of-00003.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6144f0b8c6c68fbe771ce0bee1a45484ddcfa0cf8eefd1c2535462b8f3df7af6
3
- size 4993602118
 
 
 
 
model-00001-of-00009.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7405ebb3dba293e987385b856dc066e0f54864ada27c6c9dedde82cc8052e9ab
3
- size 4968986592
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a4a3c327aefba36ec6e7e22410120535a8ff66e839ac4f6a66a6bb79d3b422a9
3
+ size 4386174152
model-00002-of-00003.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:a9ed0071303019e5eebfd4734019ac63492a1340f90e6df45e35451a85be5ee9
3
- size 4996013148
 
 
 
 
model-00002-of-00009.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b502e596b87ca4b0b863803100aad4daad937d58b968260c7b0683fe03952703
3
- size 4972362912
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:16bb10d8bdb8e7b52b6745db906fbbc3dca863ef4944da0ae15f414417e7845a
3
+ size 4821008665
model-00003-of-00003.safetensors DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:5215bfd3dc6194ca0849064560167581cfda2fcbb4fbb72c01bcd20dace90b2f
3
- size 3451566750
 
 
 
 
model-00003-of-00009.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:bace628356d060992f000fef2d19e6ce79e25fb61cd5b37a65443a1a5f9a975c
3
- size 4972362912
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a1dc0f607c8afd3887bd61bc30412c88e241a247357ff709a711ecc7706f3b11
3
+ size 4821008667
model-00004-of-00009.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d0c19d33dabbf18a9cead94d4591cafde66159fbc2a9b3c537841cf0b2ba06fe
3
- size 4972363096
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:207aada8f2b464e4dfacf47ba36ef0d7f57720c5138dfd85fb822d031758e292
3
+ size 4821008730
model-00005-of-00009.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:eb1ed1de1be0829515b135010615bd5d7f619cd63a9414b9b6195911012a799a
3
- size 4972363336
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19f80924359b0719fdc8cfc2973a7c936df599a3d8dc2bc4b5ffebaf3f9e77d4
3
+ size 4821008772
model-00006-of-00009.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:839812f041f34cb0e9e7b2d997da1bdd7831fe62b9ccbea33176d5847b3a232e
3
- size 4972363336
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:38b2c63b7bbb4f7ac0d65e70ffca664aeb497628b32228ce56759ed63328556f
3
+ size 4821008771
model-00007-of-00009.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7f184d228be8d23bb21749021752120c04308a306e54660435454325567cd422
3
- size 4972363328
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9bcb7e82f4c27ecf2aa5696353a024b4ce2bcceb084f960fa0ef2b23e624676b
3
+ size 4821008768
model-00008-of-00009.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:9887e040dd583f8f78ff2e0e7ad238b8bb36c1f80633bb09e15d12ea37e0c2a2
3
- size 4972363328
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ee7b22d6f350b79f68c2933e0f488a8306b700744c7aeb64e2b2da963ea1b50c
3
+ size 4821008765
model-00009-of-00009.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:84c9fb49919ef10b593f36c577c6d806e5212f9178b0ae85da859dfca1c7ce86
3
- size 2054401520
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:553c0c6694a970661d23edc3c6d4bf1a5856dc0312ddbcdfcb853637e8eea182
3
+ size 2751380104
model.safetensors.index.json CHANGED
The diff for this file is too large to render. See raw diff
 
special_tokens_map.json CHANGED
@@ -14,7 +14,7 @@
14
  "single_word": false
15
  },
16
  "pad_token": {
17
- "content": "<|endoftext|>",
18
  "lstrip": false,
19
  "normalized": false,
20
  "rstrip": false,
 
14
  "single_word": false
15
  },
16
  "pad_token": {
17
+ "content": "<|reserved_200017|>",
18
  "lstrip": false,
19
  "normalized": false,
20
  "rstrip": false,
tokenizer_config.json CHANGED
@@ -177,7 +177,9 @@
177
  "input_ids",
178
  "attention_mask"
179
  ],
180
- "model_max_length": 1000000000000000019884624838656,
181
- "pad_token": "<|endoftext|>",
182
- "tokenizer_class": "PreTrainedTokenizerFast"
 
 
183
  }
 
177
  "input_ids",
178
  "attention_mask"
179
  ],
180
+ "model_max_length": 131072,
181
+ "pad_token": "<|reserved_200017|>",
182
+ "padding_side": "left",
183
+ "tokenizer_class": "PreTrainedTokenizerFast",
184
+ "unk_token": null
185
  }