
# 训练作业日志中提示 "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源可能随时更新，可通过制作自定义镜像，来避免该影响。可参见文档[模型训练中使用自定义镜像介绍](https://support.huaweicloud.com/docker-modelarts/docker-modelarts_0017.html)。
 
#### 建议与总结
在创建训练作业前，推荐您先使用ModelArts开发环境调试训练代码，避免代码迁移过程中的错误。
- 直接使用线上notebook环境调试请参考[使用JupyterLab开发模型](https://support.huaweicloud.com/devtool-modelarts/devtool-modelarts_0012.html)。
- 配置本地IDE（Pycharm或者VSCode）连接云上环境调试请参考[使用本地IDE开发模型](https://support.huaweicloud.com/devtool-modelarts/devtool-modelarts_0019.html)。
 
