Train a PyTorch model using EAIS

Updated at:

After you attach an EAIS instance to an ECS instance, you can log on to the ECS instance to train a PyTorch model.

Prerequisites

An EAIS instance is attached to an ECS instance. For more information, see Associate with an ECS instance.

Background information

You can train PyTorch models using only Python scripts. If you encounter problems during training, contact EAIS technical support.

Limits

PyTorch models can be trained only when a single EAIS instance is attached to a single ECS instance.

Procedure

  1. Remotely log on to the ECS instance.

    1. Log on to the EAIS console.

    2. In the upper-left corner of the page, select the region where the instance is located.

    3. In the instance list, click the ID of the ECS instance that is associated with the EAIS instance to open the ECS console.

    4. Remotely log on to the ECS instance.

      For more information, see Remote connection to an ECS instance.

  2. Install the eais-tool package and view the information about the EAIS instance.

    For more information, see eais-tool.

  3. Install a CUDA 11.X.X package.

    1. Run the following command to download and install the CUDA package.

      Note

      This topic uses CUDA 11.7.0 as an example. The command varies based on the CUDA version that you install.

      wget https://developer.download.nvidia.com/compute/cuda/11.7.0/local_installers/cuda_11.7.0_515.43.04_linux.run
      sudo sh cuda_11.7.0_515.43.04_linux.run --silent --toolkit
    2. Run the following command to set the CUDA-related environment variables.

      export PATH=/usr/local/cuda/bin:$PATH
      export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
  4. Install the eais-cuda package.

    For more information, see eais-cuda.

  5. Deploy your training program and train the PyTorch model.