justinpinkney / clip2latent

MIT License
151 stars 9 forks source link

To Pytorch ONNX raising type issue in padding function #11

Closed Litchilitchy closed 1 year ago

Litchilitchy commented 1 year ago

Hi, I used this clip2latent and its fast sampling performance is really impressive.

I wanted to transfer it by torch.onnx to get some further results but I met following issue

0INTERNAL ASSERT FAILED at "../torch/csrc/jit/ir/alias_analysis.cpp":607, please report a bug to PyTorch. We don't have an op for aten::constant_pad_nd but it isn't a special case.  Argument types: Tensor, int[], bool, 

Candidates:
    aten::constant_pad_nd(Tensor self, int[] pad, Scalar value=0) -> (Tensor)

This is actually an issue in TorchScript when Pytorch could support Bool value in Python but when it is traced by JIT it could not (as mentioned in https://github.com/pytorch/pytorch/issues/77167).

However I did some search in the project but could not find any clues about this issue, I even tried to replace the following but no luck

mask = F.pad(mask, (0, attend_padding), value = True) # replace True with 1.

Do you have any ideas about this?

Litchilitchy commented 1 year ago

According to my debug, this is actually because of the mentioned operation in DALLE2 model in dalle2_pytorch package, thus I would close this issue