When you import models in Model Management, if the meta model is imported from OBS or a container image, the model package must meet the following specifications:
ModelArts also provides custom script examples of common AI engines. For details, see Examples of Custom Scripts.
When publishing the model, you only need to specify the ocr directory.
OBS bucket/directory name |── ocr | ├── model (Mandatory) Name of a fixed subdirectory, which is used to store model-related files | │ ├── <<Custom Python package>> (Optional) User's Python package, which can be directly referenced in the model inference code | │ ├── saved_model.pb (Mandatory) Protocol buffer file, which contains the diagram description of the model | │ ├── variables Name of a fixed sub-directory, which contains the weight and deviation rate of the model. It is mandatory for the main file of the *.pb model. | │ │ ├── variables.index Mandatory | │ │ ├── variables.data-00000-of-00001 Mandatory | │ ├──config.json (Mandatory) Model configuration file. The file name is fixed to config.json. Only one model configuration file is supported. | │ ├──customize_service.py (Optional) Model inference code. The file name is fixed to customize_service.py. Only one model inference code file exists. The files on which customize_service.py depends can be directly stored in the model directory.
When publishing the model, you only need to specify the resnet directory.
OBS bucket/directory name |── resnet | ├── model (Mandatory) Name of a fixed subdirectory, which is used to store model-related files | │ ├── <<Custom Python package>> (Optional) User's Python package, which can be directly referenced in the model inference code | │ ├── resnet-50-symbol.json (Mandatory) Model definition file, which contains the neural network description of the model | │ ├── resnet-50-0000.params (Mandatory) Model variable parameter file, which contains parameter and weight information | │ ├──config.json (Mandatory) Model configuration file. The file name is fixed to config.json. Only one model configuration file is supported. | │ ├──customize_service.py (Optional) Model inference code. The file name is fixed to customize_service.py. Only one model inference code file exists. The files on which customize_service.py depends can be directly stored in the model directory.
When publishing the model, you only need to specify the resnet directory.
OBS bucket/directory name |── resnet | ├── model (Mandatory) Name of a fixed subdirectory, which is used to store model-related files | │ ├──config.json (Mandatory) Model configuration file (the address of the SWR image must be configured). The file name is fixed to config.json. Only one model configuration file is supported.
When publishing the model, you only need to specify the resnet directory.
OBS bucket/directory name |── resnet | ├── model (Mandatory) Name of a fixed subdirectory, which is used to store model-related files | │ ├── <<Custom Python package>> (Optional) User's Python package, which can be directly referenced in the model inference code | │ ├── spark_model (Mandatory) Model directory, which contains the model content saved by PySpark | │ ├──config.json (Mandatory) Model configuration file. The file name is fixed to config.json. Only one model configuration file is supported. | │ ├──customize_service.py (Optional) Model inference code. The file name is fixed to customize_service.py. Only one model inference code file exists. The files on which customize_service.py depends can be directly stored in the model directory.
When publishing the model, you only need to specify the resnet directory.
OBS bucket/directory name |── resnet | ├── model (Mandatory) Name of a fixed subdirectory, which is used to store model-related files | │ ├── <<Custom Python package>> (Optional) User's Python package, which can be directly referenced in the model inference code | │ ├── resnet50.pth (Mandatory) PyTorch model file, which contains variable and weight information and is saved as state_dict | │ ├──config.json (Mandatory) Model configuration file. The file name is fixed to config.json. Only one model configuration file is supported. | │ ├──customize_service.py (Optional) Model inference code. The file name is fixed to customize_service.py. Only one model inference code file exists. The files on which customize_service.py depends can be directly stored in the model directory.
OBS bucket/directory name |── resnet | |── model (Mandatory) Name of a fixed subdirectory, which is used to store model-related files | | |── <<Custom Python package>> (Optional) User's Python package, which can be directly referenced in the model inference code | | |── deploy.prototxt (Mandatory) Caffe model file, which contains information such as the model network structure | | |── resnet.caffemodel (Mandatory) Caffe model file, which contains variable and weight information | | |── config.json (Mandatory) Model configuration file. The file name is fixed to config.json. Only one model configuration file is supported. | | |── customize_service.py (Optional) Model inference code. The file name is fixed to customize_service.py. Only one model inference code file exists. The files on which customize_service.py depends can be directly stored in the model directory.
OBS bucket/directory name |── resnet | |── model (Mandatory) Name of a fixed subdirectory, which is used to store model-related files | | |── <<Custom Python package>> (Optional) User's Python package, which can be directly referenced in the model inference code | | |── *.m (Mandatory): Model file whose extension name is .m | | |── config.json (Mandatory) Model configuration file. The file name is fixed to config.json. Only one model configuration file is supported. | | |── customize_service.py (Optional) Model inference code. The file name is fixed to customize_service.py. Only one model inference code file exists. The files on which customize_service.py depends can be directly stored in the model directory.
OBS bucket/directory name |── resnet | |── model (Mandatory) Name of a fixed subdirectory, which is used to store model-related files | | |── <<Custom Python package>> (Optional) User's Python package, which can be directly referenced in the model inference code | | |── *.m (Mandatory): Model file whose extension name is .m | | |── config.json (Mandatory) Model configuration file. The file name is fixed to config.json. Only one model configuration file is supported. | | |── customize_service.py (Optional) Model inference code. The file name is fixed to customize_service.py. Only one model inference code file exists. The files on which customize_service.py depends can be directly stored in the model directory.