Updated on 2024-06-11 GMT+08:00

Failed to Download the Code Directory

Symptom

The code directory fails to be downloaded during training job running, and the following error message is displayed. See Figure 1.

ERROR: modelarts-downloader.py: Get object key failed: 'Contents'
Figure 1 Failure of getting content

Possible Cause

The code directory specified during training job creation does not exist. As a result, the training fails.

Solution

Check whether the code directory specified during training job creation, that is, the OBS bucket path, is correct based on the error cause. There are two methods to check whether it exists.

  • Log in to the OBS management console using the current account, and search for the OBS buckets, folders, and files in the path to check whether the code directory exists.
  • Using APIs to check whether the directory exists: Run the following command in code to check whether the directory exists:
    import moxing as mox
    mox.file.exists('obs://obs-test/ModelArts/examples/')