Downloads · 30 days
98
9% of all-time downloads
onnxruntime/gpt-oss-20b-onnx
gpt-oss-20b-onnx is a machine learning model from onnxruntime. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
This repository hosts the optimized versions of gpt-oss-20b to accelerate inference with ONNX Runtime. Model optimizations refer to techniques and methods used to improve the run time performance, efficiency, and reso…
Downloads · 30 days
98
9% of all-time downloads
All-time downloads
1.1K
Public
Repo size
50.7 GB
Likes
12
Public
Click a slice to open those files.
.data26.2 GB · 67%
From the Hugging Face model README
This repository hosts the optimized versions of gpt-oss-20b to accelerate inference with ONNX Runtime. Model optimizations refer to techniques and methods used to improve the run time performance, efficiency, and resource utilization of machine learning models.
Optimized models are published here in ONNX format to run with ONNX Runtime with the precision best suited to this target.
To easily get started with the model, you can use Foundry Local. See instructions here.
Here are some of the optimized configurations we have added:
ONNX model for CPU and mobile using int4 quantization via RTN and block size 32.
ONNX model for CUDA GPU using int4 quantization via k-quant mixed precision and block size 32.
ONNX model for WebGPU using int4 quantization via RTN and block size 32.
You can also install ONNX Runtime GenAI to run the model. You can then run the inference example here.
For CPU:
# Download the model directly using the Hugging Face CLI
huggingface-cli download onnxruntime/gpt-oss-20b-onnx --include cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4/* --local-dir .
# Install the CPU package of ONNX Runtime GenAI
pip install onnxruntime-genai
# Please adjust the model directory (-m) accordingly
curl https://raw.githubusercontent.com/microsoft/onnxruntime-genai/main/examples/python/common.py -o common.py
curl https://raw.githubusercontent.com/microsoft/onnxruntime-genai/main/examples/python/model-chat.py -o model-chat.py
python model-chat.py -m cpu_and_mobile/cpu-int4-rtn-block-32-acc-level-4 -e follow_config
For CUDA:
# Download the model directly using the Hugging Face CLI
huggingface-cli download onnxruntime/gpt-oss-20b-onnx --include cuda/cuda-int4-kquant-block-32-mixed/* --local-dir .
# Install the CUDA package of ONNX Runtime GenAI
pip install onnxruntime-genai-cuda
# Please adjust the model directory (-m) accordingly
curl https://raw.githubusercontent.com/microsoft/onnxruntime-genai/main/examples/python/common.py -o common.py
curl https://raw.githubusercontent.com/microsoft/onnxruntime-genai/main/examples/python/model-chat.py -o model-chat.py
python model-chat.py -m cuda/cuda-int4-kquant-block-32-mixed -e follow_config
For WebGPU:
# Download the model directly using the Hugging Face CLI
huggingface-cli download onnxruntime/gpt-oss-20b-onnx --include webgpu/webgpu-int4-rtn-block-32/* --local-dir .
# Install the WebGPU packages of ONNX Runtime and ONNX Runtime GenAI
pip install onnxruntime-webgpu
pip install onnxruntime-genai --no-deps
# Please adjust the model directory (-m) accordingly
curl https://raw.githubusercontent.com/microsoft/onnxruntime-genai/main/examples/python/common.py -o common.py
curl https://raw.githubusercontent.com/microsoft/onnxruntime-genai/main/examples/python/model-chat.py -o model-chat.py
python model-chat.py -m webgpu/webgpu-int4-rtn-block-32 -e follow_config
See HF link gpt-oss-20b for details.