shimmyshimmer commited on
Commit
7eb6327
·
verified ·
1 Parent(s): 570c85e

Create README.md

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