Build the model

Log in to the development environment as the running user. Use the ATC tool to compile an open source network (such as ONNX and TensorFlow) into an .om file.

The ONNX model is used as an example. You must have the read and write permissions on the files specified in the command.

atc --model=$HOME/module/resnet50*.onnx --framework=5 --output=$HOME/module/out/onnx_resnet50 --soc_version=<soc_version>  

Parameters are listed below. For details about the restrictions, see ATC.

  • --model: path of the ResNet-50 model file.
  • --framework: source framework type. 5 indicates ONNX.
  • --output: path of the resnet50.om model file. Record this path for future use during app development.
  • --soc_version: version of the AI processor. Replace <soc_version> with the actual value.

    If you cannot determine the soc_version of the current device, perform the following steps:

    • For the following products: Run the npu-smi info command on the server where AI processor is installed to obtain the Name information. The actual value is AscendName. For example, if Name is xxxyy, the actual value is Ascendxxxyy.

      Atlas A2 training product / Atlas A2 inference product

      Atlas 200I/500 A2 inference product

      Atlas inference product

      Atlas training product

    • For the Atlas A3 training product / Atlas A3 inference product : Run the npu-smi info -t board -i id -c chip_id command on the server where AI processor is installed to obtain the Chip Name and NPU Name information. The actual value is Chip Name_NPU Name. For example, if the value of Chip Name is Ascendxxx and the value of NPU Name is 1234, the actual value is Ascendxxx_1234. Note that:
      • id: device ID, which is the NPU ID obtained by running the npu-smi info -l command.
      • chip_id: chip ID, which is obtained by running the npu-smi info -m command.
    • For the Atlas 350 Accelerator Card: Run the npu-smi info -t board -i id command on the server where AI processor is installed to obtain the Chip Name and NPU Name information. The actual value is Chip Name_NPU Name. For example, if the value of Chip Name is Ascendxxx and the value of NPU Name is 1234, the actual value is Ascendxxx_1234.

      id indicates the device ID, which is the NPU ID obtained by running the npu-smi info -l command.

Note:

  • If a message is displayed indicating that an operator is not supported during model conversion, develop a custom operator by referring to Ascend C Operator Development and convert the model again.
  • During model conversion, if a message is displayed, indicating that an operator compilation error occurs, but the error cannot be located based on the error message, contact technical support (After obtaining the logs, click here to contact technical support.) . In this case, set the DUMP_GE_GRAPH and DUMP_GRAPH_LEVEL environment variables, convert the model again, and collect graphs in each phase during model conversion. For details about the environment variables and graph description, see Reference > Dump Graph Details in ATC.