opened
mfuntowicz
username_0
Warning: ATen was a removed experimental ops. In the future, we may directly reject this operator. Please update your model as soon as possible.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Workspace\Miniconda3\envs\huggingface\lib\site-packages\onnxruntime\capi\session.py", line 25, in __init__
    self._load_model(providers)
  File "D:\Workspace\Miniconda3\envs\huggingface\lib\site-packages\onnxruntime\capi\session.py", line 43, in _load_model
    self._sess.load_model(providers)
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Fatal error: ATen is not a registered function/op
```

![image](https://user-images.githubusercontent.com/2241520/81675663-76855c00-944f-11ea-8c95-c970af608a30.png)

Platform: Windows 10 (_but tested also on Ubuntu 18.10_)
[ONNX] CumSum exported as Aten.CumSum instead of onnx.CumSum
issue
created
spandantiwari
username_1
@username_0 - can you share the repro. Specifically, which exact model are you exporting and your export code.
comment
created
mfuntowicz
username_0
Sure, I'm observing this behavior on a PR I'm currently working on https://github.com/huggingface/transformers/pull/4253

The file involved: 
https://github.com/huggingface/transformers/blob/onnx-export/src/transformers/convert_graph_to_onnx.py

I tried with different opsets (11, 12) but results were pretty similar, at least for `roberta-base` which is essentially `bert-base` without the `token type ids`.

If you want to reproduce easily and you can git clone the specific **transformers** onnx-export branch, then: 

`python convert_graph_to_onnx.py --model roberta-base --framework pt onnx/roberta-base.onnx`
comment
created
neginraoof
username_2
Hi @username_0 
Could you please verify the opset version for export one more time?

I have pytorch 1.5 installed, and I'm running the code from onnx-export branch with the following command:
python convert_graph_to_onnx.py --model roberta-base --framework pt onnx/roberta-base.onnx --check-loading

This command seems to succeed to export and run model with ORT, with following output:

Setting ONNX opset version to: 12
Loading pipeline (model: roberta-base, tokenizer: roberta-base)
Downloading: 100%|███████ 230/230 [00:00<00:00, 281kB/s]
PyTorch: 1.5.0
Checking ONNX model loading from: pytorch-transformers/src/transformers/onnx/roberta-base.onnx
Model correctly loaded

I also do get the same results with opset 11.
(Using opset 9 throws the same error you mentioned.)
comment
created
mfuntowicz
username_0
Hum interesting ... 

Here is the output I have after reinstalling my dev environment: 

```
root@ee14c90078d2:/dev/transformers/src/transformers# python3 convert_graph_to_onnx.py --model roberta-base --framework pt onnx/roberta-base.onnx --check-loading
Setting ONNX opset version to: 12
Loading pipeline (model: roberta-base, tokenizer: roberta-base)
Downloading: 100%|##########################################################################################| 230/230 [00:00<00:00, 298kB/s]
Creating folder /dev/transformers/src/transformers/onnx
PyTorch: 1.5.0+cu101
Checking ONNX model loading from: /dev/transformers/src/transformers/onnx/roberta-base.onnx
Error while converting the model: [ONNXRuntimeError] : 10 : INVALID_GRAPH : This is an invalid model. Error in Node:Shape_0 : No Op registered for Shape with domain_version of 12
```
comment
created
mfuntowicz
username_0
I'm installing from pypi through: 

`pip install torch==1.5.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html`
comment
created
neginraoof
username_2
Thanks, this error is from onnxruntime. 
If you specify --opset 11, you should be able to run the model successfully with onnxruntime 1.2.

For opset 12, onnxruntime has recently added support for these ops in master. So, it could be that the onnxruntime version you have is not supporting all opset 12 ops.
I'm running this model with latest ort-nigthly build (from pip install -i https://test.pypi.org/simple/ ort-nightly) with no issues.
comment