onnx2torch
onnx2torch copied to clipboard
Dynamic min/max values in Clip operation not supported
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
-
Convert an ONNX model that includes a
Clip
operation with dynamicmin
andmax
values. (like CosyVoice speech tokenizer) -
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