onnx2torch icon indicating copy to clipboard operation
onnx2torch copied to clipboard

Dynamic min/max values in Clip operation not supported

Open gary920209 opened this issue 4 months ago • 0 comments

Bug Description

I encountered an issue while converting CosyVoice speech tokenizer ONNX model to PyTorch using onnx2torch. Specifically, the model contains a Clip operation where the min and max values are dynamic, and it appears that onnx2torch doesn't support dynamic min/max values in this operation.

Here is the error message I received:

KeyError: '' ... NotImplementedError: Dynamic value of min/max is not implemented

Expected Behavior

onnx2torch should support dynamic min and max values for the Clip operation. If dynamic values are not supported at the moment, it would be helpful to either handle this scenario gracefully or provide an alternative way to manage these cases.

Steps to Reproduce

  1. Convert an ONNX model that includes a Clip operation with dynamic min and max values. (like CosyVoice speech tokenizer)

  2. Use the following code to trigger the error:

   from onnx2torch import convert
   torch_model = convert("/path/to/model.onnx")

Environment Details

onnx2torch version: 1.5.15 Python version: 3.9.0 PyTorch version: 2.2.2

gary920209 avatar Oct 11 '24 05:10 gary920209