Following the instructions to install onnx on Windows, I'm running into a python runtime error when running save_onnx.py
The script successfully fetches a bunch of models, then errors out with a runtime error (see log).
I initially ran into issue #14 but following the diffusers update hint in the last post there I got past that, however ran into this issue with no hint how to solve that.
Reproduction
Follow the instructions linked above, use Python 3.11 and the Python 3.11 onnx package. proceed to the last step of "Generating a onnx-based stable-diffusion v1.4 model"
Run pip install -U diffusers to work around #14
Run python ./save_onnx.py
Logs
Traceback (most recent call last):
File "E:\sdiff\diffusers\examples\inference\save_onnx.py", line 66, in <module>
convert_to_onnx(pipe.unet, pipe.vae.post_quant_conv, pipe.vae.decoder, text_encoder, height=512, width=512)
File "E:\sdiff\diffusers\examples\inference\save_onnx.py", line 41, in convert_to_onnx
traced_model = torch.jit.trace(unet, check_inputs[0], check_inputs=[check_inputs[1]], strict=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Moonchild\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\jit\_trace.py", line 798, in trace
return trace_module(
^^^^^^^^^^^^^
File "C:\Users\Moonchild\AppData\Local\Programs\Python\Python311\Lib\site-packages\torch\jit\_trace.py", line 1065, in trace_module
module._c._create_method_from_trace(
RuntimeError: Encountering a dict at the output of the tracer might cause the trace to be incorrect, this is only valid if the container structure does not change based on the module's inputs. Consider using a constant container instead (e.g. for `list`, use a `tuple` instead. for `dict`, use a `NamedTuple` instead). If you absolutely need this and know the side effects, pass strict=False to trace() to allow this behavior.
System Info
Python 3.11
updated diffusers to 0.23.1 after running into #14
Nuked the python env, installed 3.10; same error is thrown.
older python installers have been yanked and aren't available so I'm at a dead end here. Any help appreciated solving this problem.
Describe the bug
Following the instructions to install onnx on Windows, I'm running into a python runtime error when running
save_onnx.py
The script successfully fetches a bunch of models, then errors out with a runtime error (see log). I initially ran into issue #14 but following the diffusers update hint in the last post there I got past that, however ran into this issue with no hint how to solve that.Reproduction
pip install -U diffusers
to work around #14python ./save_onnx.py
Logs
System Info