文档首页> AI开发平台ModelArts> 故障排除> 训练作业> 云上迁移适配故障> 训练作业日志中提示 “AttributeError: module '***' has no attribute '***'”
更新时间:2023-01-29 GMT+08:00
分享

训练作业日志中提示 “AttributeError: module '***' has no attribute '***'”

问题现象

训练日志中出现AttributeError: module '***' has no attribute '***'错误。如:AttributeError: module 'torch' has no attribute 'concat'。

原因分析

出现该问题的可能原因如下:

  • 对应python包使用错误,该python包确实没有对应的变量或者方法
  • 第三方pip源中的python包版本更新,导致在训练作业中安装的python包的版本可能也会发生变化。如训练作业之前无此问题,后面一直有此问题,则考虑是此原因。

处理方法

  • 通过Notebook调试。
  • 安装时指定版本。如:pip install xxx==1.x.x
  • 第三方pip源可能随时更新,可通过制作自定义镜像,来避免该影响。可参见文档训练管理中使用自定义镜像介绍

建议与总结

在创建训练作业前,推荐您先使用ModelArts开发环境调试训练代码,避免代码迁移过程中的错误。
分享:

    相关文档

    相关产品