Skip to content

ONNX compatibility issues #284

@harishanand95

Description

@harishanand95

Thanks for the great library!

I'm looking into generating ONNX version of the stable diffusion models.

I had to make few changes to unet_2d_condition.py to get it to work. You can find some of the changes here.. harishanand95@8dd4e82
Let me know if you prefer a PR for this and if there exist any implementations for return non dict that I can refer to. Thanks!

  1. reason for removing broadcast_to :
torch.onnx.symbolic_registry.UnsupportedOperatorError: Exporting the operator ::broadcast_to to ONNX opset version 16 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub.
  1. reason for dict changes:
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. 

I was able to generate images with onnxruntime and DirectML, there are some more issues to be fixed.

Let me know if you have further concerns or ideas, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions