-
Notifications
You must be signed in to change notification settings - Fork 291
Add a doc showing how to run GPT OSS 20B with WebGPU #1945
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+46
−0
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Run GPT OSS 20B with Web GPU (preview) | ||
|
|
||
| These instructions allow you to experiment with GPT OSS 20B on any GPU. | ||
|
|
||
| Note: once the model is officially supported by Foundry Local that will be the easiest way to run it. | ||
|
|
||
| ## Model | ||
|
|
||
| Download the model | ||
|
|
||
| ```bash | ||
| https://huggingface.co/onnx-community/gpt-oss-20b-ONNX | ||
| ``` | ||
|
|
||
| Copy the files in the onnx folder into the parent folder | ||
|
|
||
| Change the name of model_q4f16.onnx into model.onnx (as referenced in genai_config.json) | ||
|
|
||
| ## Runtime | ||
|
|
||
| ```bash | ||
| pip install onnxruntime-webgpu | ||
| pip install onnxruntime-genai --no-deps | ||
| ``` | ||
|
|
||
| ## Example script | ||
|
|
||
| ```bash | ||
| curl -O https://raw.githubusercontent.com/microsoft/onnxruntime-genai/refs/heads/main/examples/python/model-qa.py | ||
| ``` | ||
|
|
||
| ## Run the model | ||
|
|
||
| ```bash | ||
| python model-qa.py -m gpt-oss-20b-ONNX | ||
| ``` | ||
|
|
||
| Note that the reasoning tokens are not processed by this script and appear in the output. | ||
|
|
||
| ```bash | ||
| Prompt (Use quit() to exit): Hello | ||
|
|
||
| Output: <|channel|>analysis<|message|>We need to respond to "Hello". Simple greeting. Probably a short hello back and ask how can help.<|end|><|start|>assistant<|channel|>final<|message|>Hello! 👋 How can I help you today? | ||
|
|
||
| Prompt (Use quit() to exit): | ||
| ``` | ||
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.