question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[torch-ort-infer] Aten fallback doesn't work

See original GitHub issue

Aten op doesn’t fallback to native pytorch runtime as expected.

Versions: Torch - 1.12.0 OnnxRuntime - 1.12.0 Torch-ort-infer - 1.12.0

Reproduction steps:

import torch
from torch_ort import ORTInferenceModule

def test_numpy_T(input_shape):
    class NeuralNet(torch.nn.Module):
        def __init__(self):
            super(NeuralNet, self).__init__()
        def forward(self, input):
            return input.T

    device = "cpu"
    ort_model = ORTInferenceModule(NeuralNet().to(device))

    def run_step(model, input):
        prediction = model(input)
        return prediction

    ort_input = torch.rand(input_shape, dtype=torch.float, device=device)
    ort_prediction = run_step(ort_model, ort_input)

if __name__ == "__main__":
    test_numpy_T([3, 2, 5])

Error log

Traceback (most recent call last): File “unit_test_atenop.py”, line 23, in <module> test_numpy_T([3, 2, 5]) File “unit_test_atenop.py”, line 20, in test_numpy_T ort_prediction = run_step(ort_model, ort_input) File “unit_test_atenop.py”, line 16, in run_step prediction = model(input) File “/ort_aten_fb/lib/python3.8/site-packages/torch/nn/modules/module.py”, line 1130, in _call_impl return forward_call(*input, **kwargs) File “/ort_aten_fb/lib/python3.8/site-packages/torch_ort/ortinferencemodule/_utils_infer.py”, line 98, in _forward return ortinferencemodule._forward_call(*inputs, **kwargs) File “/ort_aten_fb/lib/python3.8/site-packages/torch_ort/ortinferencemodule/ortinferencemodule.py”, line 107, in _forward_call self._inference_session = onnxruntime.InferenceSession( File “/ort_aten_fb/lib/python3.8/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py”, line 347, in init self._create_inference_session(providers, provider_options, disabled_optimizers) File “/ort_aten_fb/lib/python3.8/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py”, line 386, in create_inference_session sess = C.InferenceSession(session_options, self.model_bytes, False, self.read_config_from_model) onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Node (ATen_0) output arg (data) type inference failed.

Tested with symbolic shape inference call from ORTModule(ref: symbolic_shape). Fails with Exception(“Incomplete symbolic shape inference”).

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
natkecommented, Sep 12, 2022

@askhade Yes, sure

0reactions
askhadecommented, Sep 12, 2022

@natke : Can you add this example in this repo? Explaining how to set the type when type inference fails in ORT.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · pytorch/ort - GitHub
[torch-ort-infer] Aten fallback doesn't work. #139 opened on Aug 19 by saipj · 6. torch-ort cannot be installed on windows: onnxruntime-training not found....
Read more >
Torch.vmap: Batching rule not implemented for aten
And I'm getting this error: RuntimeError: Batching rule not implemented for aten::item. We could not generate a fallback. Is there a way of...
Read more >
PyTorch Model Export to ONNX Failed Due to ATen - Lei Mao
The conversion from TensorFlow to ONNX relies on unofficial third-party efforts and sometimes it does not work in many scenarios.
Read more >
PyTorch to ONNX export, ATen operators not supported ...
Or Caffe2 is the best choice here and onnxruntime will not do the inference? Update: I retrained the model on the basis of...
Read more >
Accelerate PyTorch models with ONNX Runtime - PythonDig
You need a machine with at least one NVIDIA or AMD GPU to run ONNX Runtime for PyTorch. ... [torch-ort-infer] Aten fallback doesn't...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found