Files
doc-exports/docs/modelarts/umn/inference-modelarts-0040.html
Lai, Weijian 4e4b2d5f6d ModelArts UMN 23.3.0 Version.
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Lai, Weijian <laiweijian4@huawei.com>
Co-committed-by: Lai, Weijian <laiweijian4@huawei.com>
2024-06-26 07:03:02 +00:00

248 lines
32 KiB
HTML

<a name="EN-US_TOPIC_0000001910054882"></a><a name="EN-US_TOPIC_0000001910054882"></a>
<h1 class="topictitle1">Deploying as a Batch Service</h1>
<div id="body0000001210398711"><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p1626935755620">After an AI application is prepared, you can deploy it as a batch service. The <span class="wintitle" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_wintitle3508112010419"><b>Service Deployment &gt; Batch Services</b></span> page lists all batch services. You can enter a service name in the search box in the upper right corner and click <span><img id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_image123650205133" src="figure/en-us_image_0000001943974333.png"></span> to search for the service.</p>
<div class="section" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_section588716131207"><h4 class="sectiontitle">Prerequisites</h4><ul id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ul153712018018"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li1937182017010">A ModelArts application in the <span class="parmname" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmname1915395614182"><b>Normal</b></span> state is available.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li10217815121016">Data to be batch processed is ready and has been upload to an OBS directory.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li1989644620816">At least one empty folder has been created in OBS for storing the output.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_section68775449137"><h4 class="sectiontitle">Context</h4><ul id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ul829617502132"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li76838259146">A maximum of 1,000 batch services can be created.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li367745818179">Based on the input request (JSON or file) defined by the AI application, different parameters are entered. If the AI application input is a JSON file, a configuration file is required to generate a mapping file. If the AI application input is a file, no mapping file is required.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li596104217355">Batch services can only be deployed in a public resource pool, but not a dedicated resource pool.</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_section210412592420"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ol118835914516"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li41881359556">Log in to the ModelArts management console. In the left navigation pane, choose <span class="parmname" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmname1030315441945"><b>Service Deployment</b></span> &gt; <span class="uicontrol" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_uicontrol9407133310348"><b>Batch Services</b></span>. By default, the <span class="wintitle" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_wintitle7409633203419"><b>Batch Services</b></span> page is displayed.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li517243918618">In the batch service list, click <span class="uicontrol" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_uicontrol152521136193412"><b>Deploy</b></span> in the upper left corner. The <span class="wintitle" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_wintitle62544367345"><b>Deploy</b></span> page is displayed.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li105537178719">Set parameters for a batch service.<ol type="a" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ol156031301865"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li45623018616">Set the basic information, including <span class="parmname" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmname1898912117357"><b>Name</b></span> and <span class="parmname" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmname8992201103512"><b>Description</b></span>. The name is generated by default, for example, <strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b4167154511010">service-bc0d</strong>. You can specify <span class="parmname" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmname817474515011"><b>Name</b></span> and <span class="parmname" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmname717410451006"><b>Description</b></span> according to actual requirements.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li31131228711">Set other parameters, including AI application configurations. For details, see <a href="#EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_table1029041641314">Table 1</a>.
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_table1029041641314"></a><a name="en-us_topic_0171858292_table1029041641314"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_table1029041641314" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_row1129018169133"><th align="left" class="cellrowborder" valign="top" width="26.240000000000002%" id="mcps1.3.4.2.3.1.2.2.2.3.1.1"><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p16290181619130">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="73.76%" id="mcps1.3.4.2.3.1.2.2.2.3.1.2"><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p1729071601311">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_row1326414815217"><td class="cellrowborder" valign="top" width="26.240000000000002%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p82641281627">AI Application Source</p>
</td>
<td class="cellrowborder" valign="top" width="73.76%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p14173193214915">Select <span class="parmname" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmname15719830173720"><b>My AI Applications</b></span> based on your requirements.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_row192909169134"><td class="cellrowborder" valign="top" width="26.240000000000002%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p029051691314">AI Application and Version</p>
</td>
<td class="cellrowborder" valign="top" width="73.76%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p18291141691311">Select an AI application and version that are running properly.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_row029151631317"><td class="cellrowborder" valign="top" width="26.240000000000002%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p20291161631314">Input Path</p>
</td>
<td class="cellrowborder" valign="top" width="73.76%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p629121610139">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 <a href="#EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_section190619315314">Manifest File Specifications</a>.</p>
<div class="note" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_note425767202816"><span class="notetitle"> NOTE: </span><div class="notebody"><ul id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ul6675112631414"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li66751626161417">If the input data is an image, ensure that the size of a single image is less than 10 MB.</li><li id="EN-US_TOPIC_0000001910054882__li1451021517214">If the input data is in CSV format, ensure that the file size does not exceed 12 MB.</li></ul>
</div></div>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_row1829151641316"><td class="cellrowborder" valign="top" width="26.240000000000002%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p329121681318">Request Path</p>
</td>
<td class="cellrowborder" valign="top" width="73.76%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p16291191621315">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.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_row202914161132"><td class="cellrowborder" valign="top" width="26.240000000000002%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p11291131616136">Mapping Relationship</p>
</td>
<td class="cellrowborder" valign="top" width="73.76%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p18291101614133">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.</p>
<p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p7183104810137">Automatically generated mapping file. Enter the field index corresponding to each parameter in the CSV file. The index starts from 0.</p>
<p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p02914161137">Mapping rule: The mapping rule comes from the input parameter (<strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b1564513113588">request</strong>) in the model configuration file <strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b19645131116589">config.json</strong>. When <span class="parmname" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmname826044713584"><b>type</b></span> is set to <span class="parmvalue" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmvalue12260104745819"><b>string, number, integer, or boolean</b></span>, you are required to set the index parameter. For details about the mapping rule, see <a href="#EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_section119024213518">Example Mapping</a>.</p>
<p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p2043174112315">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 (,).</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_row112911816111320"><td class="cellrowborder" valign="top" width="26.240000000000002%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p11291181681315">Output Path</p>
</td>
<td class="cellrowborder" valign="top" width="73.76%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p1291141661318">Select the path for saving the batch prediction result. You can select the empty folder that you create.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_row5291716141314"><td class="cellrowborder" valign="top" width="26.240000000000002%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p2271012382">Specifications</p>
</td>
<td class="cellrowborder" valign="top" width="73.76%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p146603363304">Select available specifications based on the list displayed on the console. The specifications in gray cannot be used at the current region.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_row8292181619132"><td class="cellrowborder" valign="top" width="26.240000000000002%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p2283121183">Compute Nodes</p>
</td>
<td class="cellrowborder" valign="top" width="73.76%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p6292716151310">Set the number of instances for the current AI application version. If you set the number of nodes to <strong id="EN-US_TOPIC_0000001910054882__b1649111351095">1</strong>, 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.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_row1029291621311"><td class="cellrowborder" valign="top" width="26.240000000000002%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p1929218169132">Environment Variable</p>
</td>
<td class="cellrowborder" valign="top" width="73.76%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p16292816131313">Set environment variables and inject them to the pod. To ensure data security, do not enter sensitive information in environment variables.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001910054882__row1675410320164"><td class="cellrowborder" valign="top" width="26.240000000000002%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.1 "><p id="EN-US_TOPIC_0000001910054882__p475123516316">Timeout</p>
</td>
<td class="cellrowborder" valign="top" width="73.76%" headers="mcps1.3.4.2.3.1.2.2.2.3.1.2 "><p id="EN-US_TOPIC_0000001910054882__p7761535637">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.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ol>
</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li0335165819514">After setting the parameters, deploy the model as a batch service as prompted. Deploying a service generally requires a period of time, which may be several minutes or tens of minutes depending on the amount of your data and resources.<p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p199943452522"><a name="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li0335165819514"></a><a name="en-us_topic_0171858292_li0335165819514"></a>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 <span class="parmname" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmname6992103916435"><b>Deploying</b></span> to <span class="parmname" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_parmname49941839164318"><b>Running</b></span>, the service is deployed successfully.</p>
</li></ol>
</div>
<div class="section" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_section190619315314"><a name="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_section190619315314"></a><a name="en-us_topic_0171858292_section190619315314"></a><h4 class="sectiontitle">Manifest File Specifications</h4><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p25048010217">ModelArts batch services support manifest files, which describe data input and output.</p>
</div>
<div class="p" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p197931254171211"><strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b19917513175011">Example input manifest file</strong><ul id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ul9357193219228"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li113571932162211">File name: <span class="filepath" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_filepath228471318"><b>test.manifest</b></span></li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li63571132102212">File content:<pre class="screen" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_screen17516011164">{"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&amp;Expires=1550611914&amp;Signature=wZBttZj5QZrReDhz1uDzwve8GpY%3D&amp;x-obs-security-token=gQpzb3V0aGNoaW5hixvY8V9a1SnsxmGoHYmB1SArYMyqnQT-ZaMSxHvl68kKLAy5feYvLDM..."}</pre>
</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li335843211229">Requirements on the file:<ol id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ol56812191169"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li958171618161">The file name extension must be <span class="filepath" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_filepath136511443151414"><b>.manifest</b></span>.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li15521824161619">The file content is in JSON format. Each row describes a piece of input data, which must be accurate to a file instead of a folder.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li268041642112">The value of <strong id="EN-US_TOPIC_0000001910054882__b72716451301">source</strong> is the OBS file path in the format of <strong id="EN-US_TOPIC_0000001910054882__b127145183019">&lt;</strong><em id="EN-US_TOPIC_0000001910054882__i028194516309">OBS path</em><strong id="EN-US_TOPIC_0000001910054882__b32814543015">&gt;</strong><strong id="EN-US_TOPIC_0000001910054882__b1287457305">/{{</strong><em id="EN-US_TOPIC_0000001910054882__i1228164513012">Bucket name</em><strong id="EN-US_TOPIC_0000001910054882__b142994513017">}}/{{</strong><em id="EN-US_TOPIC_0000001910054882__i122915455308">Object name</em><strong id="EN-US_TOPIC_0000001910054882__b1929245173010">}}</strong>.</li></ol>
</li></ul>
</div>
<p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p20541162110137"><strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b962612312527">Example output manifest file</strong></p>
<div class="p" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p89282911114">A manifest file will be generated in the output directory of the batch services.<ul id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ul1948082217114"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li20480922161115">Assume that the output path is <strong id="EN-US_TOPIC_0000001910054882__b843772914167">//test-bucket/test/</strong>. The result is stored in the following path:<pre class="screen" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_en-us_topic_0171858292_screen4350164131219">OBS bucket/directory name
├── test-bucket
│ ├── test
│ │ ├── infer-result-{{task_id}}.manifest
│ │ ├── infer-result
│ │ │ ├── 1.jpg_result.txt
│ │ │ ├── 2.jpg_result.txt</pre>
</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li8705194511113">Content of the <strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b138058114545">infer-result-0.manifest</strong> file:<pre class="screen" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_en-us_topic_0171858292_screen6474424141217">{"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&amp;Expires=1550611914&amp;Signature=wZBttZj5QZrReDhz1uDzwve8GpY%3D&amp;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"}</pre>
</li></ul>
</div>
<ul id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ul38152218214"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li1781514232117">File format:<ol id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ol66934577137"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li20269526823">The file name is <strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b5762125511146">infer-result-{{task_id}}.manifest</strong>, where <strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b71414611516">task_id</strong> is the batch task ID, which is unique for a batch service.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li5269326427">If a large number of files need to be processed, multiple manifest files may be generated with the same suffix <span class="filepath" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_filepath493792617587"><b>.manifest</b></span> and are distinguished by suffix, for example, <span class="filepath" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_filepath19152353145910"><b>infer-result-{{<span id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_text715213532597">task_id</span>}}_1.manifest</b></span>.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li1121011714144">The <strong id="EN-US_TOPIC_0000001910054882__b9931173915164">infer-result</strong><em id="EN-US_TOPIC_0000001910054882__i18932163951614">-{{task_id}}</em> directory is created in the manifest directory to store the file processing result.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li1385916136145">The file content is in JSON format. Each row describes the output result of a piece of input data.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li58151019171416">The file contains multiple fields:<ol type="a" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_ol1280311162216"><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li1457010852219"><strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b360135917569">source</strong>: input data description, which is the same as that of the input manifest file</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li878414200535"><strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b1093720284524">result</strong>: file processing result, which can be <strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b87392472528">SUCCESSFUL</strong> or <strong id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_b14444115218525">FAILED</strong></li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_en-us_topic_0171858292_li927841752215"><strong id="EN-US_TOPIC_0000001910054882__b5884014185">inference-loc</strong>: output result path. This field is available when result is <strong id="EN-US_TOPIC_0000001910054882__b67012197176">SUCCESSFUL</strong>. The format is <strong id="EN-US_TOPIC_0000001910054882__b7702171913174">obs://{{</strong><em id="EN-US_TOPIC_0000001910054882__i57024191173">Bucket name</em><strong id="EN-US_TOPIC_0000001910054882__b870211918176">}}/{</strong><em id="EN-US_TOPIC_0000001910054882__i1270217199176">Object name</em><strong id="EN-US_TOPIC_0000001910054882__b97021196179">}</strong>.</li><li id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_li145823591946"><strong id="EN-US_TOPIC_0000001910054882__b22968121818">error_message</strong>: error information. This field is available when the result is <strong id="EN-US_TOPIC_0000001910054882__b1723316124185">FAILED</strong>.</li></ol>
</li></ol>
</li></ul>
<div class="section" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_section119024213518"><a name="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_section119024213518"></a><a name="en-us_topic_0171858292_section119024213518"></a><h4 class="sectiontitle">Example Mapping</h4><p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p59931771457">The following example shows the relationship between the configuration file, mapping rule, CSV data, and inference request.</p>
<p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p181894144119">The following uses a file for prediction as an example:</p>
<div class="codecoloring" codetype="Xml" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_screen17324243141114"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
<span class="normal"> 2</span>
<span class="normal"> 3</span>
<span class="normal"> 4</span>
<span class="normal"> 5</span>
<span class="normal"> 6</span>
<span class="normal"> 7</span>
<span class="normal"> 8</span>
<span class="normal"> 9</span>
<span class="normal">10</span>
<span class="normal">11</span>
<span class="normal">12</span>
<span class="normal">13</span>
<span class="normal">14</span>
<span class="normal">15</span>
<span class="normal">16</span>
<span class="normal">17</span>
<span class="normal">18</span>
<span class="normal">19</span>
<span class="normal">20</span>
<span class="normal">21</span>
<span class="normal">22</span>
<span class="normal">23</span>
<span class="normal">24</span>
<span class="normal">25</span>
<span class="normal">26</span>
<span class="normal">27</span>
<span class="normal">28</span>
<span class="normal">29</span>
<span class="normal">30</span>
<span class="normal">31</span>
<span class="normal">32</span>
<span class="normal">33</span>
<span class="normal">34</span>
<span class="normal">35</span>
<span class="normal">36</span>
<span class="normal">37</span>
<span class="normal">38</span>
<span class="normal">39</span>
<span class="normal">40</span>
<span class="normal">41</span></pre></div></td><td class="code"><div><pre><span></span>[
<span class="w"> </span>{
<span class="w"> </span>&quot;method&quot;:<span class="w"> </span>&quot;post&quot;,
<span class="w"> </span>&quot;url&quot;:<span class="w"> </span>&quot;/&quot;,
<span class="w"> </span>&quot;request&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;Content-type&quot;:<span class="w"> </span>&quot;multipart/form-data&quot;,
<span class="w"> </span>&quot;data&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;type&quot;:<span class="w"> </span>&quot;object&quot;,
<span class="w"> </span>&quot;properties&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;data&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;type&quot;:<span class="w"> </span>&quot;object&quot;,
<span class="w"> </span>&quot;properties&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;req_data&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;type&quot;:<span class="w"> </span>&quot;array&quot;,
<span class="w"> </span>&quot;items&quot;:<span class="w"> </span>[
<span class="w"> </span>{
<span class="w"> </span>&quot;type&quot;:<span class="w"> </span>&quot;object&quot;,
<span class="w"> </span>&quot;properties&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;input_1&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;type&quot;:<span class="w"> </span>&quot;number&quot;
<span class="w"> </span>},
<span class="w"> </span>&quot;input_2&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;type&quot;:<span class="w"> </span>&quot;number&quot;
<span class="w"> </span>},
<span class="w"> </span>&quot;input_3&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;type&quot;:<span class="w"> </span>&quot;number&quot;
<span class="w"> </span>},
<span class="w"> </span>&quot;input_4&quot;:<span class="w"> </span>{
<span class="w"> </span>&quot;type&quot;:<span class="w"> </span>&quot;number&quot;
<span class="w"> </span>}
<span class="w"> </span>}
<span class="w"> </span>}
<span class="w"> </span>]
<span class="w"> </span>}
<span class="w"> </span>}
<span class="w"> </span>}
<span class="w"> </span>}
<span class="w"> </span>}
<span class="w"> </span>}
<span class="w"> </span>}
]
</pre></div></td></tr></table></div>
</div>
<p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p9568259141119">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.</p>
<pre class="screen" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_screen7828205171317">{
"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
}
}
}
]
}
}
}
}
}</pre>
<p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p8554201591320">Multiple pieces of CSV data for inference are separated by commas (,) The following shows an example:</p>
<pre class="screen" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_screen5266194461319">5.1,3.5,1.4,0.2
4.9,3.0,1.4,0.2
4.7,3.2,1.3,0.2</pre>
<p id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_p191616510147">Depending on the defined mapping relationship, the inference request is shown below, whose format is similar to that for real-time services.</p>
<pre class="screen" id="EN-US_TOPIC_0000001910054882__en-us_topic_0171858292_screen6445112521411">{
"data": {
"req_data": [{
"input_1": 5.1,
"input_2": 3.5,
"input_3": 1.4,
"input_4": 0.2
}]
}
}</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="inference-modelarts-0039.html">Deploying AI Applications as Batch Services</a></div>
</div>
</div>