onnx2pytorch icon indicating copy to clipboard operation
onnx2pytorch copied to clipboard

Some of the tox tests are failing

Open calvinmccarter-at-lightmatter opened this issue 4 years ago • 1 comments

When I run tox on the current tests and models, I get some errors.

  • yolo_v4.onnx gives me rather substantial mismatch with ONNXruntime on test_onnx2pytorch2onnx (Mismatched elements: 659440 / 689520 (95.6%) -- Max absolute difference: 1.4529846 -- Max relative difference: 98651.)

  • fast_neural_style.onnx gives me an error via F.interpolate in the Resize operator:

    result = self.forward(*input, **kwargs)
onnx2pytorch/operations/resize.py:61: in forward
    return super().forward(inp, torch.tensor([]), scales, torch.tensor([]))
onnx2pytorch/operations/resize.py:48: in forward
    return F.interpolate(
...
        if input.dim() == 3 and mode == "nearest":
            return torch._C._nn.upsample_nearest1d(input, output_size, scale_factors)
        if input.dim() == 4 and mode == "nearest":
>           return torch._C._nn.upsample_nearest2d(input, output_size, scale_factors)
E           TypeError: upsample_nearest2d() received an invalid combination of arguments - got (Tensor, NoneType, list), but expected one of:
E            * (Tensor input, tuple of ints output_size, tuple of floats scale_factors)
E                 didn't match because some of the arguments have invalid types: (Tensor, !NoneType!, !list!)
E            * (Tensor input, tuple of ints output_size, float scales_h, float scales_w, *, Tensor out)
.tox/py38/lib/python3.8/site-packages/torch/nn/functional.py:3535: TypeError

In terms of my environment, I get the following from pip freeze:

attrs==20.3.0
certifi==2020.12.5
distlib==0.3.1
filelock==3.0.12
iniconfig==1.1.1
numpy==1.20.2
onnx==1.9.0
onnxruntime==1.7.0
packaging==20.9
pluggy==0.13.1
protobuf==4.0.0rc2
py==1.10.0
pyparsing==2.4.7
pytest==6.2.3
six==1.15.0
toml==0.10.2
torch==1.4.0
tox==3.23.0
typing-extensions==3.7.4.3
virtualenv==20.4.4```

Thanks for reporting the issue.

  • Regarding yolo_v4, I've mentioned in the README that the nearest neighbour interpolation used in onnx does not exists in pytorch. Right now it is falling back on "most similar" interpolation.
  • Regarding fast_neural_style, I don't get this error.

I've marked the issue with "help wanted" for now.

Talmaj avatar May 03 '21 16:05 Talmaj