Help Center/ ModelArts/ Troubleshooting/ Training Jobs/ In-Cloud Migration Adaptation Issues/ Error Message "AttributeError: module '***' has no attribute '***'" Displayed Training Job Logs
Updated on 2024-06-11 GMT+08:00

Error Message "AttributeError: module '***' has no attribute '***'" Displayed Training Job Logs

Symptom

Error message "AttributeError: module '***' has no attribute '***'" is displayed in the logs of a training job, for example, "AttributeError: module 'torch' has no attribute 'concat'".

Possible Causes

The possible causes are as follows:

  • The Python package is incorrectly used. There is no required variable or method in the Python package.
  • The Python package version in the third-party pip source has been updated. As a result, the version of the Python package installed in the training job may also change. If a training job ran properly originally, but this issue occurs in the training job later, consider this cause.

Solution

  • Use notebook for debugging.
  • Specify a version for installation, for example, pip install xxx==1.x.x.
  • The third-party pip source may be updated at any time. To prevent this issue from occurring, create a custom image.

Summary and Suggestions

Before creating a training job, use the ModelArts development environment to debug the training code to maximally eliminate errors in code migration.