Update README.md
Browse files
README.md
CHANGED
@@ -1,199 +1,199 @@
|
|
1 |
---
|
|
|
|
|
|
|
|
|
2 |
library_name: transformers
|
3 |
-
tags:
|
|
|
|
|
4 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
|
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 |
-
|
116 |
|
117 |
-
|
118 |
|
119 |
-
[
|
120 |
|
121 |
-
|
122 |
|
123 |
-
|
|
|
|
|
124 |
|
125 |
-
|
126 |
|
127 |
-
|
|
|
|
|
128 |
|
129 |
-
|
130 |
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
132 |
|
|
|
|
|
|
|
133 |
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
|
135 |
-
|
136 |
|
137 |
-
|
|
|
|
|
|
|
138 |
|
139 |
-
[
|
140 |
|
141 |
-
##
|
142 |
|
143 |
-
|
144 |
|
145 |
-
|
|
|
|
|
|
|
|
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
|
153 |
-
|
154 |
|
155 |
-
|
156 |
|
157 |
-
[
|
158 |
|
159 |
-
|
160 |
|
161 |
-
[
|
162 |
|
163 |
-
|
|
|
|
|
|
|
|
|
164 |
|
165 |
-
[
|
166 |
|
167 |
-
####
|
168 |
|
169 |
-
[
|
170 |
|
171 |
-
|
|
|
|
|
|
|
172 |
|
173 |
-
|
174 |
|
175 |
-
|
176 |
|
177 |
-
|
178 |
|
179 |
-
|
180 |
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
-
|
184 |
|
185 |
-
|
186 |
|
187 |
-
|
|
|
|
|
188 |
|
189 |
-
|
190 |
|
191 |
-
|
192 |
|
193 |
-
|
|
|
|
|
|
|
194 |
|
195 |
-
|
196 |
|
197 |
-
|
198 |
|
199 |
-
[
|
|
|
1 |
---
|
2 |
+
base_model:
|
3 |
+
- openai/gpt-oss-120b
|
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-120b Details
|
40 |
+
<p align="center">
|
41 |
+
<img alt="gpt-oss-120b" src="https://raw.githubusercontent.com/openai/gpt-oss/main/docs/gpt-oss-120b.svg">
|
42 |
+
</p>
|
43 |
+
|
44 |
+
<p align="center">
|
45 |
+
<a href="https://gpt-oss.com"><strong>Try gpt-oss</strong></a> ·
|
46 |
+
<a href="https://cookbook.openai.com/topic/gpt-oss"><strong>Guides</strong></a> ·
|
47 |
+
<a href="https://openai.com/index/gpt-oss-model-card"><strong>System card</strong></a> ·
|
48 |
+
<a href="https://openai.com/index/introducing-gpt-oss/"><strong>OpenAI blog</strong></a>
|
49 |
+
</p>
|
50 |
+
|
51 |
+
<br>
|
52 |
+
|
53 |
+
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.
|
54 |
+
|
55 |
+
We’re releasing two flavors of the open models:
|
56 |
+
- `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)
|
57 |
+
- `gpt-oss-20b` — for lower latency, and local or specialized use cases (21B parameters with 3.6B active parameters)
|
58 |
+
|
59 |
+
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.
|
60 |
+
|
61 |
+
|
62 |
+
> [!NOTE]
|
63 |
+
> This model card is dedicated to the larger `gpt-oss-120b` model. Check out [`gpt-oss-20b`](https://huggingface.co/openai/gpt-oss-20b) for the smaller model.
|
64 |
+
|
65 |
+
# Highlights
|
66 |
+
|
67 |
+
* **Permissive Apache 2.0 license:** Build freely without copyleft restrictions or patent risk—ideal for experimentation, customization, and commercial deployment.
|
68 |
+
* **Configurable reasoning effort:** Easily adjust the reasoning effort (low, medium, high) based on your specific use case and latency needs.
|
69 |
+
* **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.
|
70 |
+
* **Fine-tunable:** Fully customize models to your specific use case through parameter fine-tuning.
|
71 |
+
* **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.
|
72 |
+
* **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.
|
73 |
|
74 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
|
76 |
+
# Inference examples
|
77 |
|
78 |
+
## Transformers
|
79 |
|
80 |
+
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.
|
81 |
|
82 |
+
To get started, install the necessary dependencies to setup your environment:
|
83 |
|
84 |
+
```
|
85 |
+
pip install -U transformers kernels torch
|
86 |
+
```
|
87 |
|
88 |
+
Once, setup you can proceed to run the model by running the snippet below:
|
89 |
|
90 |
+
```py
|
91 |
+
from transformers import pipeline
|
92 |
+
import torch
|
93 |
|
94 |
+
model_id = "openai/gpt-oss-120b"
|
95 |
|
96 |
+
pipe = pipeline(
|
97 |
+
"text-generation",
|
98 |
+
model=model_id,
|
99 |
+
torch_dtype="auto",
|
100 |
+
device_map="auto",
|
101 |
+
)
|
102 |
|
103 |
+
messages = [
|
104 |
+
{"role": "user", "content": "Explain quantum mechanics clearly and concisely."},
|
105 |
+
]
|
106 |
|
107 |
+
outputs = pipe(
|
108 |
+
messages,
|
109 |
+
max_new_tokens=256,
|
110 |
+
)
|
111 |
+
print(outputs[0]["generated_text"][-1])
|
112 |
+
```
|
113 |
|
114 |
+
Alternatively, you can run the model via [`Transformers Serve`](https://huggingface.co/docs/transformers/main/serving) to spin up a OpenAI-compatible webserver:
|
115 |
|
116 |
+
```
|
117 |
+
transformers serve
|
118 |
+
transformers chat localhost:8000 --model-name-or-path openai/gpt-oss-120b
|
119 |
+
```
|
120 |
|
121 |
+
[Learn more about how to use gpt-oss with Transformers.](https://cookbook.openai.com/articles/gpt-oss/run-transformers)
|
122 |
|
123 |
+
## vLLM
|
124 |
|
125 |
+
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.
|
126 |
|
127 |
+
```bash
|
128 |
+
uv pip install --pre vllm==0.10.1+gptoss \
|
129 |
+
--extra-index-url https://wheels.vllm.ai/gpt-oss/ \
|
130 |
+
--extra-index-url https://download.pytorch.org/whl/nightly/cu128 \
|
131 |
+
--index-strategy unsafe-best-match
|
132 |
|
133 |
+
vllm serve openai/gpt-oss-120b
|
134 |
+
```
|
|
|
|
|
|
|
135 |
|
136 |
+
[Learn more about how to use gpt-oss with vLLM.](https://cookbook.openai.com/articles/gpt-oss/run-vllm)
|
137 |
|
138 |
+
## PyTorch / Triton
|
139 |
|
140 |
+
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).
|
141 |
|
142 |
+
## Ollama
|
143 |
|
144 |
+
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).
|
145 |
|
146 |
+
```bash
|
147 |
+
# gpt-oss-120b
|
148 |
+
ollama pull gpt-oss:120b
|
149 |
+
ollama run gpt-oss:120b
|
150 |
+
```
|
151 |
|
152 |
+
[Learn more about how to use gpt-oss with Ollama.](https://cookbook.openai.com/articles/gpt-oss/run-locally-ollama)
|
153 |
|
154 |
+
#### LM Studio
|
155 |
|
156 |
+
If you are using [LM Studio](https://lmstudio.ai/) you can use the following commands to download.
|
157 |
|
158 |
+
```bash
|
159 |
+
# gpt-oss-120b
|
160 |
+
lms get openai/gpt-oss-120b
|
161 |
+
```
|
162 |
|
163 |
+
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.
|
164 |
|
165 |
+
---
|
166 |
|
167 |
+
# Download the model
|
168 |
|
169 |
+
You can download the model weights from the [Hugging Face Hub](https://huggingface.co/collections/openai/gpt-oss-68911959590a1634ba11c7a4) directly from Hugging Face CLI:
|
170 |
|
171 |
+
```shell
|
172 |
+
# gpt-oss-120b
|
173 |
+
huggingface-cli download openai/gpt-oss-120b --include "original/*" --local-dir gpt-oss-120b/
|
174 |
+
pip install gpt-oss
|
175 |
+
python -m gpt_oss.chat model/
|
176 |
+
```
|
177 |
|
178 |
+
# Reasoning levels
|
179 |
|
180 |
+
You can adjust the reasoning level that suits your task across three levels:
|
181 |
|
182 |
+
* **Low:** Fast responses for general dialogue.
|
183 |
+
* **Medium:** Balanced speed and detail.
|
184 |
+
* **High:** Deep and detailed analysis.
|
185 |
|
186 |
+
The reasoning level can be set in the system prompts, e.g., "Reasoning: high".
|
187 |
|
188 |
+
# Tool use
|
189 |
|
190 |
+
The gpt-oss models are excellent for:
|
191 |
+
* Web browsing (using built-in browsing tools)
|
192 |
+
* Function calling with defined schemas
|
193 |
+
* Agentic operations like browser tasks
|
194 |
|
195 |
+
# Fine-tuning
|
196 |
|
197 |
+
Both gpt-oss models can be fine-tuned for a variety of specialized use cases.
|
198 |
|
199 |
+
This larger model `gpt-oss-120b` can be fine-tuned on a single H100 node, whereas the smaller [`gpt-oss-20b`](https://huggingface.co/openai/gpt-oss-20b) can even be fine-tuned on consumer hardware.
|