vitoplantamura / OnnxStream

Lightweight inference library for ONNX files, written in C++. It can run Stable Diffusion XL 1.0 on a RPI Zero 2 (or in 298MB of RAM) but also Mistral 7B on desktops and servers. ARM, x86, WASM, RISC-V supported. Accelerated by XNNPACK.
https://yolo.vitoplantamura.com/
Other
1.86k stars 84 forks source link

UnsupportedOperatorError: Exporting the operator ::_transformer_encoder_layer_fwd to ONNX opset #59

Open Peterzzz-hub opened 9 months ago

Peterzzz-hub commented 9 months ago

when i try to export onnx model from fairseq, i encountered this error. plz help support this operator

Traceback (most recent call last):
  File "/home/workspace/terminal_launching/pt2onnx.py", line 92, in <module>
    torch.onnx.export(model.encoder, sample_input['net_input'], onnx_file_path, input_names=input_names, output_names=output_names, verbose=True, opset_version=14)
  File "/opt/conda/envs/train-test/lib/python3.8/site-packages/torch/onnx/__init__.py", line 350, in export
    return utils.export(
  File "/opt/conda/envs/train-test/lib/python3.8/site-packages/torch/onnx/utils.py", line 163, in export
    _export(
  File "/opt/conda/envs/train-test/lib/python3.8/site-packages/torch/onnx/utils.py", line 1074, in _export
    graph, params_dict, torch_out = _model_to_graph(
  File "/opt/conda/envs/train-test/lib/python3.8/site-packages/torch/onnx/utils.py", line 731, in _model_to_graph
    graph = _optimize_graph(
  File "/opt/conda/envs/train-test/lib/python3.8/site-packages/torch/onnx/utils.py", line 308, in _optimize_graph
    graph = _C._jit_pass_onnx(graph, operator_export_type)
  File "/opt/conda/envs/train-test/lib/python3.8/site-packages/torch/onnx/__init__.py", line 416, in _run_symbolic_function
    return utils._run_symbolic_function(*args, **kwargs)
  File "/opt/conda/envs/train-test/lib/python3.8/site-packages/torch/onnx/utils.py", line 1421, in _run_symbolic_function
    raise symbolic_registry.UnsupportedOperatorError(
torch.onnx.symbolic_registry.UnsupportedOperatorError: Exporting the operator ::_transformer_encoder_layer_fwd to ONNX opset version 14 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub.
vitoplantamura commented 8 months ago

you should post this in the pytorch repo :-)

In the past, I had a similar error, and I solved it by installing the most recent Pytorch nightly build.

Vito

Peterzzz-hub commented 8 months ago

you should post this in the pytorch repo :-) In the past, I had a similar error, and I solved it by installing the most recent Pytorch nightly build. Vito sry, i opend too many windows, i post by mistake. thx 4 ur reply