报错
我在进行导出onnx的时候,遇到如下的报错:
torch.onnx.errors.UnsupportedOperatorError: Exporting the operator 'aten::scaled_dot_product_attention' to ONNX opset version 14 is not supported. Please feel free to request support or submit a pull request on PyTorch GitHub: https://github.com/pytorch/pytorch/issues.
更换版本也未能解决,正要写算子进行替换时,不小心重装了另一个版本的pytorch。
解决方法
我将 pytorch从2.0 版本降至 pytorch1.13 版本之后,就可以运行了。