Giter Club home page Giter Club logo

sd_pytorch2onnx's Introduction

SD_PyTorch2ONNX

Convert PyTorch Stable Diffusion models to ONNX format with flexible resolution.

sd_pytorch2onnx's People

Contributors

redandr avatar

Stargazers

lincent avatar  avatar  avatar  avatar

Watchers

 avatar Kostas Georgiou avatar  avatar

Forkers

gpu-net

sd_pytorch2onnx's Issues

Error Convert_Civitai_OpenVINO

I tried Convert_Civitai_OpenVINO.py and got many warnings and an error.

D:\Program Files\Python310\lib\site-packages\diffusers\models\unet_2d_condition.py:915: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if dim % default_overall_up_factor != 0:
D:\Program Files\Python310\lib\site-packages\diffusers\models\downsampling.py:135: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert hidden_states.shape[1] == self.channels
D:\Program Files\Python310\lib\site-packages\diffusers\models\downsampling.py:144: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert hidden_states.shape[1] == self.channels
D:\Program Files\Python310\lib\site-packages\diffusers\models\upsampling.py:149: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
assert hidden_states.shape[1] == self.channels
D:\Program Files\Python310\lib\site-packages\diffusers\models\upsampling.py:165: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if hidden_states.shape[0] >= 64:
D:\Program Files\Python310\lib\site-packages\diffusers\models\unet_2d_condition.py:1206: TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
if not return_dict:
Unet successfully converted to ONNX
Traceback (most recent call last):
File "D:\astable-diffusion\openvino_notebooks\notebooks\225-stable-diffusion-text-to-image\t5\civitai.py", line 87, in
model = mo.convert_model(UNET_ONNX_PATH, compress_to_fp16=True)
File "D:\Program Files\Python310\lib\site-packages\openvino\tools\mo\convert.py", line 364, in convert_model
ov_model, _ = _convert(cli_parser, framework, params, True)
File "D:\Program Files\Python310\lib\site-packages\openvino\tools\mo\convert_impl.py", line 957, in _convert
raise e.with_traceback(None)
RuntimeError: Check 'false' failed at src\frontends\common\src\frontend.cpp:54:
Converting input model
bad allocation

torch: 2.1.2+cpu
onnx: 1.15.0
onnxruntime: 1.16.3
tensorflow-intel: 2.14.0
Intel Core i5-6500 CPU

I found openvinotoolkit/openvino#12747 that tensorflow-intel >=2.8.0 will cause unexpected error.
I tried to downgrade tensorflow-intel to a version tensorflow-intel==2.8.0, but it asked me to downgrade other packages like
Other possible workarounds are:

  1. Downgrade the protobuf package to 3.20.x or lower.
  2. Set PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python (but this will use pure-Python parsing and will be much slower).

Since you made it working, could you create virtualenv with needed packages?

Conversion failed

error: torch.onnx.errors.UnsupportedOperatorError: Exporting the operator 'aten::scaled_dot_product_attention' to ONNX opset version 16 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub: https://github.com/pytorch/pytorch/issues.

torch:2.0.0
onnx:1.13.1
onnxruntime:1.14.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.