Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Squeeze node fails when axes is "" #21661

Open
justinchuby opened this issue Aug 7, 2024 · 4 comments
Open

Squeeze node fails when axes is "" #21661

justinchuby opened this issue Aug 7, 2024 · 4 comments
Labels
converter:dynamo issues related supporting the PyTorch Dynamo exporter

Comments

@justinchuby
Copy link
Contributor

Error [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Non-zero status code returned while running Squeeze node. Name:'node_Squeeze_141' Status Message: /onnxruntime_src/onnxruntime/core/providers/cuda/tensor/squeeze.cc:50 virtual onnxruntime::common::Status onnxruntime::cuda::Squeeze::ComputeInternal(onnxruntime::OpKernelContext*) const axes_tensor != nullptr was false. Axes input is null_ is raise when Squeeze node has a single input. According to the spec https://onnx.ai/onnx/operators/onnx__Squeeze.html, If axes is not provided, all the single dimensions will be removed from the shape. If an axis is selected with shape entry not equal to one, an error is raised.

cc @xadupre @gramalingam

@github-actions github-actions bot added the ep:CUDA issues related to the CUDA execution provider label Aug 7, 2024
@justinchuby justinchuby added the converter:dynamo issues related supporting the PyTorch Dynamo exporter label Aug 7, 2024
justinchuby added a commit to microsoft/onnxscript that referenced this issue Aug 7, 2024
Specify the squeeze axis explicitly to improve compatibility with ORT: microsoft/onnxruntime#21661
justinchuby added a commit to microsoft/onnxscript that referenced this issue Aug 8, 2024
Fix _log_softmax by moving the IsScalar call to the top so it can be
eagerly evaluated.

Also specify the squeeze axis explicitly to improve compatibility with
ORT: microsoft/onnxruntime#21661



This should fix a runtime error in XGLMForCausalLM
Copy link
Contributor

github-actions bot commented Sep 7, 2024

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.

@github-actions github-actions bot added the stale issues that have not been addressed in a while; categorized by a bot label Sep 7, 2024
@justinchuby
Copy link
Contributor Author

cc @shubhambhokare1 this is a similar issue

@justinchuby justinchuby removed the stale issues that have not been addressed in a while; categorized by a bot label Sep 7, 2024
@titaiwangms
Copy link
Contributor

Who would be the right contact for this op? @gramalingam

@gramalingam gramalingam removed the ep:CUDA issues related to the CUDA execution provider label Oct 17, 2024
@gramalingam gramalingam changed the title [cuda ep] Squeeze node fails when axes is not provided Squeeze node fails when axes is not provided Oct 17, 2024
@gramalingam gramalingam changed the title Squeeze node fails when axes is not provided Squeeze node fails when axes is "" Oct 17, 2024
@gramalingam
Copy link
Contributor

Hi, I updated the title and label based on my recollection. I believe that this is a corner case where onnxruntime does not fully support the onnx spec concerning optional trailing inputs. The ONNX spec says that for an optional trailing input like axes (for the Squeeze op): the input can be omitted completely (number of inputs will be 1 in the node), or an empty string can be used to indicate a missing input (the node will have 2 inputs, where the second input is the empty string). The latter format is necessary when we have non-trailing optional inputs, but is allowed even for trailing optional inputs.

I think onnxruntime doesn't handle the second kind of input correctly. But, for now, the converter will avoid generating trailing inputs that are an empty string. So, it is not critical. But it would be helpful if onnxruntime fixes it (in case of models coming from other sources).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
converter:dynamo issues related supporting the PyTorch Dynamo exporter
Projects
None yet
Development

No branches or pull requests

3 participants