Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Example code and documentation on how to get Stable Diffusion running with ONNX FP16 models on DirectML. Can run accelerated on all DirectML supported cards including AMD and Intel.
| Date | Stars |
|---|---|
| 2026-07-31 | 299 |
| 2026-08-05 | 299 |
| 2026-08-06 | 299 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
# Stable Diffusion using ONNX, FP16 and DirectML This repository contains a conversion tool, some examples, and instructions on how to set up Stable Diffusion with ONNX models. This was mainly intended for use with AMD GPUs but should work just as well with other DirectML devices (e.g. Intel Arc). I'd be very interested to hear of any results with Intel Arc. **MOST IMPORTANT RECENT UPDATES:** **- Pytorch 2.1 is out! We no longer need to rely on torch nightly package.** **- ONNX Runtime 1.16 has been released! Regression testing looks fine except for ControlNet. Looking into it.** **- I have enabled GitHub discussions: If you have a generic question rather than an issue, start a discussion!** This focuses specifically on making it easy to get FP16 models. When using FP16, the VRAM footprint is significantly reduced and speed goes up. It's all fairly straightforward, but It helps to be comfortable with command line. You can use these instructions to convert models to FP16 and then use them in any tool that allows you to load ONNX models. We'll demonstrate this by downloading and setting up ONNXDiffusersUI specifically for use with our installation (no need to follow the ONNXDiffusersUI setup). ## Set up First make sure you have Python 3.10 (or 3.11) installed. You can get it here: https://www.python.org/downloads/ **NOTE:** 3.10 is still the preferred version. Since the release of ONNX Runtime 1.15 all requirements now have proper Python 3.11 support but conversion is extremely slow on 3.11. If you don't have git, get it here: https://gitforwindows.org/ Pick a directory that can contain your Stable Diffusion installation (make sure you've the diskspace to store the models). Open the commandline (Powershell or Command Prompt) and change into the directory you will use. Start by cloning this repository: ``` git clone https://github.com/Amblyopius/Stable-Diffusion-ONNX-FP16 cd Stable-Diffusion-ONNX-FP16 ``` Do the following: ``` pip install virtualenv python -m venv sd_env sd_env\scripts\activate python -m pip install --upgrade pip pip install -r requirements.txt ``` Now first make sure you have an account on https://huggingface.co/ When you do make sure to create a token on https://huggingface.co/settings/tokens And then on the commandline login using following command ``` huggingface-cli login ``` Now you're ready to download and convert models. Before we explain this, just a pointer on future use. Whenever you want to make use of this post set up, open a command line, change into the directory and enable the environment. Say that you installed this on your D: drive in the root. You would open command line and then: ``` d: cd Stable-Diffusion-ONNX-FP16 sd_env\scripts\activate ``` Remember this for whenver you want to use your installation. Let's now get to the fun part and convert some models: ``` mkdir model python conv_sd_to_onnx.py --model_path "stabilityai/stable-diffusion-2-1-base" --output_path "./model/sd2_1base-fp32" python conv_sd_to_onnx.py --model_path "stabilityai/stable-diffusion-2-1-base" --output_path "./model/sd2_1base-fp16" --fp16 ``` You now have 2 models. These are geared towards creating 512x512 images. Now we'll run our test script twice: ``` python test-txt2img.py --model "model\sd2_1base-fp32" --size 512 --seed 0 python test-txt2img.py --model "model\sd2_1base-fp16" --size 512 --seed 0 ``` You should now have 2 similar pictures. Note that there'll be differences between FP32 and FP16. But FP16 should not be specifically worse than FP32. The accuracy just shifts things a bit, but it may just as well shift them for the better. Next let's do 768x768. This requires your card to have enough VRAM but we'll make a VRAM friendly version too. Here we aren't bothering with FP32 because it just requires too much VRAM. ``` python conv_sd_to_onnx.py --model_path "stabilityai/stable-diffusion-2-1" --output_path "./model/sd2_1-fp16" --fp16 python test-txt2img.py --model "model\sd2_1-fp1
Excerpt of 17,843 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:bd635b77d9634d81, topic:onnx
matched fp:bd635b77d9634d81, name:stable diffusion, desc:stable diffusion