Prerequisites

Before using the PyTorch GPU2Ascend tool, make the following preparations:

Environment Setup

  1. Prepare a training server powered by Atlas training productss and install the corresponding driver and firmware.
  2. Install the Ascend-CANN-Toolkit. For details, see "Installing the Development Environment" in the CANN Software Installation Guide.
  3. Install MindStudio. For details, see "Installing MindStudio (Linux)" in the MindStudio Installation Guide.
  4. Install PyTorch 1.5.0. For details, see the "Installing PyTorch" in CANN Software Installation Guide.
  5. Before using PyTorch GPU2Ascend for script migration, run the following command to install the dependency:
    pip3 install pandas         # The pandas version must be 1.2.4 or later.
    pip3 install libcst

Environment Variable Configuration

  1. Log in as the running user, run the vi ~/.bashrc command in any directory to open the .bashrc file, and append the following content to the file (the default installation path of a non-root user is used as an example):
    # Ascend-CANN-Toolkit environment variable. Change it to the actual path.
    source ~/Ascend/ascend-toolkit/set_env.sh
    
    # PyTorch environment variable. Change it to the actual path.
    export LD_LIBRARY_PATH=~/.local/lib/python3.7/site-packages/torch/lib:$LD_LIBRARY_PATH
  2. Run the :wq! command to save the file and exit.
  3. Run the source ~/.bashrc command for the modification to take effect immediately.

Data Preparation

  • PyTorch-CIFAR-100 model script. Upload it to the personal directory on the training server.
  • CIFAR-100 dataset. It is automatically downloaded during training.