Text Generation
Transformers
Safetensors
gpt_oss
vllm
conversational
Eval Results
8-bit precision
mxfp4
Instructions to use openai/gpt-oss-120b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use openai/gpt-oss-120b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="openai/gpt-oss-120b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("openai/gpt-oss-120b") model = AutoModelForCausalLM.from_pretrained("openai/gpt-oss-120b") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use openai/gpt-oss-120b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "openai/gpt-oss-120b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openai/gpt-oss-120b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/openai/gpt-oss-120b
- SGLang
How to use openai/gpt-oss-120b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "openai/gpt-oss-120b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openai/gpt-oss-120b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "openai/gpt-oss-120b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "openai/gpt-oss-120b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use openai/gpt-oss-120b with Docker Model Runner:
docker model run hf.co/openai/gpt-oss-120b
Delete config.json
Browse files- config.json +0 -88
config.json
DELETED
|
@@ -1,88 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"architectures": [
|
| 3 |
-
"GptOssForCausalLM"
|
| 4 |
-
],
|
| 5 |
-
"attention_bias": true,
|
| 6 |
-
"attention_dropout": 0.0,
|
| 7 |
-
"eos_token_id": 200002,
|
| 8 |
-
"experts_per_token": 4,
|
| 9 |
-
"head_dim": 64,
|
| 10 |
-
"hidden_act": "silu",
|
| 11 |
-
"hidden_size": 2880,
|
| 12 |
-
"initial_context_length": 4096,
|
| 13 |
-
"initializer_range": 0.02,
|
| 14 |
-
"intermediate_size": 2880,
|
| 15 |
-
"layer_types": [
|
| 16 |
-
"sliding_attention",
|
| 17 |
-
"full_attention",
|
| 18 |
-
"sliding_attention",
|
| 19 |
-
"full_attention",
|
| 20 |
-
"sliding_attention",
|
| 21 |
-
"full_attention",
|
| 22 |
-
"sliding_attention",
|
| 23 |
-
"full_attention",
|
| 24 |
-
"sliding_attention",
|
| 25 |
-
"full_attention",
|
| 26 |
-
"sliding_attention",
|
| 27 |
-
"full_attention",
|
| 28 |
-
"sliding_attention",
|
| 29 |
-
"full_attention",
|
| 30 |
-
"sliding_attention",
|
| 31 |
-
"full_attention",
|
| 32 |
-
"sliding_attention",
|
| 33 |
-
"full_attention",
|
| 34 |
-
"sliding_attention",
|
| 35 |
-
"full_attention",
|
| 36 |
-
"sliding_attention",
|
| 37 |
-
"full_attention",
|
| 38 |
-
"sliding_attention",
|
| 39 |
-
"full_attention",
|
| 40 |
-
"sliding_attention",
|
| 41 |
-
"full_attention",
|
| 42 |
-
"sliding_attention",
|
| 43 |
-
"full_attention",
|
| 44 |
-
"sliding_attention",
|
| 45 |
-
"full_attention",
|
| 46 |
-
"sliding_attention",
|
| 47 |
-
"full_attention",
|
| 48 |
-
"sliding_attention",
|
| 49 |
-
"full_attention",
|
| 50 |
-
"sliding_attention",
|
| 51 |
-
"full_attention"
|
| 52 |
-
],
|
| 53 |
-
"max_position_embeddings": 131072,
|
| 54 |
-
"model_type": "gpt_oss",
|
| 55 |
-
"num_attention_heads": 64,
|
| 56 |
-
"num_experts_per_tok": 4,
|
| 57 |
-
"num_hidden_layers": 36,
|
| 58 |
-
"num_key_value_heads": 8,
|
| 59 |
-
"num_local_experts": 128,
|
| 60 |
-
"output_router_logits": false,
|
| 61 |
-
"pad_token_id": 199999,
|
| 62 |
-
"quantization_config": {
|
| 63 |
-
"modules_to_not_convert": [
|
| 64 |
-
"model.layers.*.self_attn",
|
| 65 |
-
"model.layers.*.mlp.router",
|
| 66 |
-
"model.embed_tokens",
|
| 67 |
-
"lm_head"
|
| 68 |
-
],
|
| 69 |
-
"quant_method": "mxfp4"
|
| 70 |
-
},
|
| 71 |
-
"rms_norm_eps": 1e-05,
|
| 72 |
-
"rope_scaling": {
|
| 73 |
-
"beta_fast": 32.0,
|
| 74 |
-
"beta_slow": 1.0,
|
| 75 |
-
"factor": 32.0,
|
| 76 |
-
"original_max_position_embeddings": 4096,
|
| 77 |
-
"rope_type": "yarn",
|
| 78 |
-
"truncate": false
|
| 79 |
-
},
|
| 80 |
-
"rope_theta": 150000,
|
| 81 |
-
"router_aux_loss_coef": 0.9,
|
| 82 |
-
"sliding_window": 128,
|
| 83 |
-
"swiglu_limit": 7.0,
|
| 84 |
-
"tie_word_embeddings": false,
|
| 85 |
-
"transformers_version": "4.55.0.dev0",
|
| 86 |
-
"use_cache": true,
|
| 87 |
-
"vocab_size": 201088
|
| 88 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|