n00mkrad / text2image-gui

Somewhat modular text2image GUI, initially just for Stable Diffusion
GNU General Public License v3.0
921 stars 93 forks source link

Converting models to ONNX doesn't work #120

Closed JarekDerp closed 8 months ago

JarekDerp commented 8 months ago

Hi,

Problem:

When converting the model (any model really, I tried CKPT and safetensor and it didn't work. On version 1.11 I was getting these errors: convert 1.11 version.txt But on version 1.12 I got these instead: convert 1.12 version.txt

In the case of 1.12 version I got the message in the log saying:

Converting model 'deliberate_v2.safetensors' - This could take a few minutes... Done. Saved converted model to: E:\SDGUI\Models\Checkpoints\deliberate_v2.safetensors.onnx

But when I look into the folder, it just creates "E:\SDGUI\Models\Checkpoints\deliberate_v2.safetensors.onnx\text_encoder\model.onnx" file that weights 469MB and nothing more. All 4 models I tested ended up the same.

Solution:

I found info here https://github.com/pytorch/pytorch/pull/99658 that it's fixed in pytorch 2.1 so I clicked "Developer Tools - > Open CMD in Python Environment" and run: pip3 install --upgrade pytorch I also run pip3 install --upgrade torch torchvision torchaudio so I'm not sure which one of those two fixed it. But try the first one first as I'm not sure if torchvision and torchaudio are even needed and might just waste your disk space.

And that seems to have fixed the problem with converting the models! It converted a 2GB safetensors model into a 5.1GB folder with 13 files inside, and the gui now recognizes and allows me to pick the model on the list, and I can generate pictures using the model. I was able to generate 2 512x512 simple images with 30 steps in 1minute and 3 seconds on my 6700XT. Which would mean I got about 1it/s. Not the best as I got 2.2it/s in easy-diffusion with some console tweaking (so about 220% faster) but I love the UI of this GUI, and I often get some bugs in easy-diffusion so I'll probably start using this one. Thanks!