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
Clipoperation with dynamicminandmaxvalues. (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
@gary920209 Hi Gary, I'm having the same issue convert a yolo8 onnx model to pt. Did you manage to find a solution?
Any update?
I had the same issue with a quantized Mask-RCNN:
NotImplementedError: Dynamic value of min/max is not implemented
Env: onnx2torch version: 1.5.15 pytorch version: 2.8.0+cu128 Python version: 3.12.7
Great project btw, thank you!