After an AI application is prepared, you can deploy it as a batch service. The Service Deployment > Batch Services page lists all batch services. You can enter a service name in the search box in the upper right corner and click to search for the service.
Parameter |
Description |
---|---|
AI Application Source |
Select My AI Applications based on your requirements. |
AI Application and Version |
Select an AI application and version that are running properly. |
Input Path |
Select the OBS directory where the uploaded data is stored. Select a folder or a .manifest file. For details about the specifications of the .manifest file, see Manifest File Specifications. NOTE:
|
Request Path |
URI used for calling the AI application interface in a batch service, and also the request path of the AI application service. Its value is obtained from the url field of apis in the AI application configuration file. |
Mapping Relationship |
If the AI application input is in JSON format, the system automatically generates the mapping based on the configuration file corresponding to the AI application. If the AI application input is other file, mapping is not required. Automatically generated mapping file. Enter the field index corresponding to each parameter in the CSV file. The index starts from 0. Mapping rule: The mapping rule comes from the input parameter (request) in the model configuration file config.json. When type is set to string, number, integer, or boolean, you are required to set the index parameter. For details about the mapping rule, see Example Mapping. The index must be a positive integer starting from 0. If the value of index does not comply with the rule, this parameter is ignored in the request. After the mapping rule is configured, the corresponding CSV data must be separated by commas (,). |
Output Path |
Select the path for saving the batch prediction result. You can select the empty folder that you create. |
Specifications |
Select available specifications based on the list displayed on the console. The specifications in gray cannot be used at the current region. |
Compute Nodes |
Set the number of instances for the current AI application version. If you set the number of nodes to 1, the standalone computing mode is used. If you set the number of nodes to a value greater than 1, the distributed computing mode is used. Select a computing mode based on the actual requirements. |
Environment Variable |
Set environment variables and inject them to the pod. To ensure data security, do not enter sensitive information in environment variables. |
Timeout |
Timeout of a single model, including both the deployment and startup time. The default value is 20 minutes. The value must range from 3 to 120. |
You can go to the batch service list to view the basic information about the batch service. In the batch service list, after the status of the newly deployed service changes from Deploying to Running, the service is deployed successfully.
ModelArts batch services support manifest files, which describe data input and output.
{"source": "obs://test/data/1.jpg"} {"source": "s3://test/data/2.jpg"} {"source": "https://infers-data.obs.xxx.com:443/xgboosterdata/data.csv?AccessKeyId=2Q0V0TQ461N26DDL18RB&Expires=1550611914&Signature=wZBttZj5QZrReDhz1uDzwve8GpY%3D&x-obs-security-token=gQpzb3V0aGNoaW5hixvY8V9a1SnsxmGoHYmB1SArYMyqnQT-ZaMSxHvl68kKLAy5feYvLDM..."}
Example output manifest file
OBS bucket/directory name ├── test-bucket │ ├── test │ │ ├── infer-result-{{task_id}}.manifest │ │ ├── infer-result │ │ │ ├── 1.jpg_result.txt │ │ │ ├── 2.jpg_result.txt
{"source": "obs://obs-data-bucket/test/data/1.jpg","result":"SUCCESSFUL","inference-loc": "obs://test-bucket/test/infer-result/1.jpg_result.txt"} {"source": "s3://obs-data-bucket/test/data/2.jpg","result":"FAILED","error_message": "Download file failed."} {"source ": "https://infers-data.obs.xxx.com:443/xgboosterdata/2.jpg?AccessKeyId=2Q0V0TQ461N26DDL18RB&Expires=1550611914&Signature=wZBttZj5QZrReDhz1uDzwve8GpY%3D&x-obs-security-token=gQpzb3V0aGNoaW5hixvY8V9a1SnsxmGoHYmB1SArYMyqnQT-ZaMSxHvl68kKLAy5feYvLDMNZWxzhBZ6Q-3HcoZMh9gISwQOVBwm4ZytB_m8sg1fL6isU7T3CnoL9jmvDGgT9VBC7dC1EyfSJrUcqfB_N0ykCsfrA1Tt_IQYZFDu_HyqVk-GunUcTVdDfWlCV3TrYcpmznZjliAnYUO89kAwCYGeRZsCsC0ePu4PHMsBvYV9gWmN9AUZIDn1sfRL4voBpwQnp6tnAgHW49y5a6hP2hCAoQ-95SpUriJ434QlymoeKfTHVMKOeZxZea-JxOvevOCGI5CcGehEJaz48sgH81UiHzl21zocNB_hpPfus2jY6KPglEJxMv6Kwmro-ZBXWuSJUDOnSYXI-3ciYjg9-h10b8W3sW1mOTFCWNGoWsd74it7l_5-7UUhoIeyPByO_REwkur2FOJsuMpGlRaPyglZxXm_jfdLFXobYtzZhbul4yWXga6oxTOkfcwykTOYH0NPoPRt5MYGYweOXXxFs3d5w2rd0y7p0QYhyTzIkk5CIz7FlWNapFISL7zdhsl8RfchTqESq94KgkeqatSF_iIvnYMW2r8P8x2k_eb6NJ7U_q5ztMbO9oWEcfr0D2f7n7Bl_nb2HIB_H9tjzKvqwngaimYhBbMRPfibvttW86GiwVP8vrC27FOn39Be9z2hSfJ_8pHej0yMlyNqZ481FQ5vWT_vFV3JHM-7I1ZB0_hIdaHfItm-J69cTfHSEOzt7DGaMIES1o7U3w%3D%3D","result":"SUCCESSFUL","inference-loc": "obs://test-bucket/test/infer-result/2.jpg_result.txt"}
The following example shows the relationship between the configuration file, mapping rule, CSV data, and inference request.
The following uses a file for prediction as an example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | [ { "method": "post", "url": "/", "request": { "Content-type": "multipart/form-data", "data": { "type": "object", "properties": { "data": { "type": "object", "properties": { "req_data": { "type": "array", "items": [ { "type": "object", "properties": { "input_1": { "type": "number" }, "input_2": { "type": "number" }, "input_3": { "type": "number" }, "input_4": { "type": "number" } } } ] } } } } } } } ] |
The ModelArts management console automatically resolves the mapping relationship from the configuration file as shown below. When calling a ModelArts API, configure the mapping by following the rule.
{ "type": "object", "properties": { "data": { "type": "object", "properties": { "req_data": { "type": "array", "items": [ { "type": "object", "properties": { "input_1": { "type": "number", "index": 0 }, "input_2": { "type": "number", "index": 1 }, "input_3": { "type": "number", "index": 2 }, "input_4": { "type": "number", "index": 3 } } } ] } } } } }
Multiple pieces of CSV data for inference are separated by commas (,) The following shows an example:
5.1,3.5,1.4,0.2 4.9,3.0,1.4,0.2 4.7,3.2,1.3,0.2
Depending on the defined mapping relationship, the inference request is shown below, whose format is similar to that for real-time services.
{ "data": { "req_data": [{ "input_1": 5.1, "input_2": 3.5, "input_3": 1.4, "input_4": 0.2 }] } }