参考 pytorch update to 2.0.0, coremltools: RuntimeError: PyTorch convert function for op 'scaled_dot_product_attention' not implemented. · Issue #1823 · apple/coremltools · GitHub 将PyTorch由2.0将会1.31.1即可 pip show torch # 查看torch版本 pip uninstall torch # 卸载torch版本 pip install torch==1.13.1 # 安装指定版本