Speech2Text transformer to ONNX conversion

Hi,
While converting Speech2Text transformer type to onnx format I am running into this error:

RuntimeError: Cannot insert a Tensor that requires grad as a constant. Consider making it a parameter or input, or detaching the gradient

Since onnx requires forward method to be defined , I defined forward method and calling model.generate in that method to make it use generate instead. May be this is not the right way to convert. I am not sure. Can some one shed the light on how to go about converting Speech2Text transformer model into ONNX format. I tried setting grad to false. But that didn’t help.

1 Like