cpatonn commited on
Commit
286d42e
·
verified ·
1 Parent(s): 621fd96

Create README.md

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