justinchuby / torch-onnx

A standalone version of the next PyTorch ONNX exporter
MIT License
2 stars 1 forks source link

Output 0 is out of bounds #63

Closed justinchuby closed 2 months ago

justinchuby commented 3 months ago

PyTorch ONNX Conversion Error Report

✅ Obtain model graph with `torch.export.export`
✅ Translate the graph into ONNX
❌ Run `onnx.checker` on the ONNX model
⚪ Execute the model with ONNX Runtime
⚪ Validate model output accuracy

Error message:

Traceback (most recent call last):

  File "/Users/justinc/Documents/GitHub/torch-onnx/src/torch_onnx/_core.py", line 911, in export
    onnx.checker.check_model(onnx_program.model_proto, full_check=True)

  File "/Users/justinc/Documents/GitHub/torch-onnx/venv/lib/python3.11/site-packages/onnx/checker.py", line 179, in check_model
    C.check_model(

onnx.onnx_cpp2py_export.shape_inference.InferenceError: [ShapeInferenceError] (op_type:aten_zeros, node name: node_aten_zeros_1): Output 0 is out of bounds.

Analysis

PyTorch ONNX Conversion Analysis

Model Information

The model has 2176 parameters and 0 buffers (non-trainable parameters). Number of parameters per dtype:

defaultdict(<class 'int'>, {torch.float32: 2176})

Number of buffers per dtype:

defaultdict(<class 'int'>, {})

Inputs:

Outputs:

The FX graph has 224 nodes in total. Number of FX nodes per op:

Of the call_function nodes, the counts of operators used are:

ONNX Conversion Information

All operators in the model have registered ONNX decompositions.

justinchuby commented 3 months ago

This is because the torchlib functions do not have return types annotated correctly.