Skip to content

Pangu net ONNX does not work #77

@Jostarndt

Description

@Jostarndt

Hi there,

I am trying to convert a model from this paper https://www.nature.com/articles/s41586-023-06185-3 downloaded from this GitHub https://github.com/198808xc/Pangu-Weather

First of all: thanks a lot for onnx2torch.

However, there are some issues.

First issue

First in

return torch.flip(data.__getitem__(selection), flip_dims)
:

return torch.flip(data.__getitem__(selection), flip_dims)

lead to the warning lib/python3.10/site-packages/onnx2pytorch/operations/slice.py:86: UserWarning: Using a non-tuple sequence for multidimensional indexing is deprecated and will be changed in pytorch 2.9; use x[tuple(seq)] instead of x[seq]. In pytorch 2.9 this will be interpreted as tensor index, x[torch.tensor(seq)], which will result either in an error or a different result (Triggered internally at /pytorch/torch/csrc/autograd/python_variable_indexing.cpp:309.) return torch.flip(data[selection], flip_dims)

Suggested Fix?

return torch.flip(data.__getitem__(tuple(selection)), flip_dims) fixed the issue. Also, even shorter

return torch.flip(data[selection], flip_dims). I hope these operations do what I think they are supposed to do.

Second issue

out = F.pad(input, list(pads), mode=self.mode, value=value)

out = F.pad(input, list(pads), mode=self.mode, value=value)

give me the error *** TypeError: pad(): argument 'value' (position 4) must be float, not Tensor

And indeed value seems to be a tensor (in my case of shape torch.Size([5, 13, 721, 1440]). Fixing this is beyond my understanding of this library unfortunately. I would appreciate any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions