Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some problems from exporting onnx #23

Open
kasim0226 opened this issue Aug 13, 2021 · 1 comment
Open

Some problems from exporting onnx #23

kasim0226 opened this issue Aug 13, 2021 · 1 comment

Comments

@kasim0226
Copy link

kasim0226 commented Aug 13, 2021

Thank you for your great work. The code is easy to read.
I try to convert model to onnx format, but I am facing some errors.
Could you help me?

  1. if I just comment the parts of torch.float32 in lerp function, would it causing problems?

def lerp(a, b, beta): if isinstance(beta, numbers.Number): if beta == 1: return b elif beta == 0: return a #if torch.is_tensor(a) and a.dtype == torch.float32: # torch lerp only available for fp32 # return torch.lerp(a, b, beta) # More numerically stable than a + beta * (b - a) return (1 - beta) * a + beta * b

  1. I got this error (RuntimeError: Unsupported: ONNX export of convolution for kernel of unknown shape.), but I don't have any ideas
@adriansahlman
Copy link
Owner

Hey, sorry for late reply.

It was a long time since I wrote this code so its difficult figuring out why the onnx export is failing.

  1. You can replace all the code in utils.lerp with return (1 - beta) * a + beta * b. It should not affect performance too much (I think torch.lerp is faster because it is implemented in C++ directly). No idea how this would affect the export to onnx.
  2. There are a lot of unconventional uses of convolutions in stylegan2, such as the blur filter and rescaling of weights before performing the convolution. Maybe these are not supported by onnx? Can you see which convolutional operation caused the error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants