Model Input Path Specifications
The converted models can run on different chips. The requirements for the model input path vary according to the chips. ModelArts has different requirements for the model input path of the Ascend chip and ARM or GPU.
Ascend Chip
The requirements for converting the models run on the Ascend chip are as follows:
- For Caffe-based models, the input path must comply with the following specifications during model conversion:
| |---xxxx.caffemodel (Mandatory) Model parameter file. Only one model parameter file can exist in the input path. |---xxxx.prototxt (Mandatory) Model network file. Only one model network file can exist in the input path. |---insert_op_conf.cfg (Optional) Insertion operator configuration file. Only one insertion operator configuration file can exist in the input path. |---plugin (Optional) Custom operator directory. The input directory can contain only one plugin folder. Only custom operators developed based on Tensor Engine (TE) are supported.
- For TensorFlow-based models (in frozen_graph or saved_model format), the input path must comply with the following specifications during model conversion:
frozen_graph format
| |---xxxx.pb (Mandatory) Model network file. Only one model network file can exist in the input path. The model must be in frozen_graph or saved_model format. |---insert_op_conf.cfg (Optional) Insertion operator configuration file. Only one insertion operator configuration file can exist in the input path. |---plugin (Optional) Custom operator directory. The input directory can contain only one plugin folder. Only custom operators developed based on Tensor Engine (TE) are supported.
saved_model format
| |---saved_model.pb (Mandatory) Model network file. Only one model network file can exist in the input path. The model must be in frozen_graph or saved_model format. |---variables (Mandatory) Fixed subdirectory name, including the model weight deviation. |---variables.index Mandatory |---variables.data-00000-of-00001 Mandatory |---insert_op_conf.cfg (Optional) Insertion operator configuration file. Only one insertion operator configuration file can exist in the input path. |---plugin (Optional) Custom operator directory. The input directory can contain only one plugin folder. Only custom operators developed based on Tensor Engine (TE) are supported.
ARM or GPU
Only TensorFlow-based models can be converted to run on the ARM or GPU, that is, the models in frozen_graph and saved_model formats.
|
|---model Directory for storing the model. The directory must be named model. Only one model directory exists and only one model-related file can be stored in the directory.
|----xxx.pb Model file. The file must be in frozen_graph format of TensorFlow.
|---calibration_data Directory for storing the calibration dataset. The directory must be named calibration_data. The directory is required for 8-bit and 32-bit conversion. Only one calibration_data directory exists in the input path.
During 32-bit conversion, you can directly use the test.npy file generated by the Python tool.
|---xx.npy Calibration dataset. The dataset can contain multiple .npy files. Ensure that the .npy files are the data directly inputted into the model after preprocessing, and the input tensors must be the same as those of the model.
The requirements for converting the models in saved_model format are as follows:
|
|---model Directory for storing the model. The directory must be named model. Only one model directory exists and only one model-related file can be stored in the directory.
|----saved_model.pb Model file. The file must be in saved_model format of TensorFlow.
|----variables Directory for storing variables
|----variables.data-******-of-***** Data required for the saved_model file
|----variables.index Index required by the saved_model file
|---calibration_data Directory for storing the calibration dataset. The directory must be named calibration_data. The directory is required for 8-bit and 32-bit conversion. Only one calibration_data directory exists in the input path. During 32-bit conversion, you can directly use the test.npy file generated by the Python tool.
|---xx.npy Calibration dataset. The dataset can contain multiple .npy files. Ensure that the .npy files are the data directly inputted into the model after preprocessing, and the input tensors must be the same as those of the model.
During 32-bit conversion, you can directly use the test.npy file generated by the Python tool and save the file to the calibration_data directory in the preceding two formats.
import numpy as np
a = np.arange(4)
np.save("test.npy", a)
Last Article: Compressing and Converting Models
Next Article: Model Output Path Description
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.