Overview

Ascend NPU is an up-and-comer in the AI computing field, but most training and online inference scripts are based on GPUs. Due to the architecture differences between NPUs and GPUs, GPU-based training and online inference scripts cannot be directly used on NPUs.

PyTorch GPU2Ascend provides an automated method for migrating GPU-based scripts into NPU-based scripts, reducing the learning cost and workload of manual script migration, thereby improving the migration efficiency. In addition, it provides analysis methods to help users analyze the operators supported by PyTorch training scripts. Currently, training scripts of PyTorch 1.11.0, 2.1.0, and 2.2.0 can be analyzed and migrated.

Constraints

  • The execution logic of scripts migrated by PyTorch GPU2Ascend remains consistent with that before the migration.
  • The scripts to be migrated should be compatible with Python 3.7 or later and capable of running in a GPU environment.
  • If the source code calls third-party libraries, adaptation issues may occur during the migration. Before migrating the source code, you need to install the third-party library versions adapted to Ascend based on the called third-party libraries. For details about the adapted third-party libraries and their usage guides, see "References" > "Model Suites and Third-Party Libraries" in PyTorch Training Model Porting and Tuning Guide.
  • The FusedAdam optimizer used in Apex does not support tool-based migration. If the source code contains this optimizer, you need to modify it.