doc-exports/docs/modelarts/api-ref/modelarts_03_0082.html

611 lines
57 KiB
HTML

<a name="modelarts_03_0082"></a><a name="modelarts_03_0082"></a>
<h1 class="topictitle1">Deploying a Model as a Service</h1>
<div id="en-us_topic_0129882788_body1536238941991"><div class="section" id="modelarts_03_0082__en-us_topic_0129882788_section10317176102318"><h4 class="sectiontitle">Function</h4><p id="modelarts_03_0082__en-us_topic_0129882788_p2057712871016">This API is used to deploy a model as a service.</p>
</div>
<div class="section" id="modelarts_03_0082__en-us_topic_0129882788_section181341535122619"><h4 class="sectiontitle">URI</h4><p id="modelarts_03_0082__en-us_topic_0129882788_p10907132203515">POST /v1/{project_id}/services</p>
<div class="p" id="modelarts_03_0082__en-us_topic_0129882788_p16174165411613"><a href="#modelarts_03_0082__en-us_topic_0129882788_table16518993181628">Table 1</a> describes the required parameters.
<div class="tablenoborder"><a name="modelarts_03_0082__en-us_topic_0129882788_table16518993181628"></a><a name="en-us_topic_0129882788_table16518993181628"></a><table cellpadding="4" cellspacing="0" summary="" id="modelarts_03_0082__en-us_topic_0129882788_table16518993181628" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters</caption><thead align="left"><tr id="modelarts_03_0082__en-us_topic_0129882788_row41524868181628"><th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.2.3.2.2.5.1.1"><p id="modelarts_03_0082__en-us_topic_0129882788_p30350749181639">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.2.3.2.2.5.1.2"><p id="modelarts_03_0082__en-us_topic_0129882788_p42491604181639">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13%" id="mcps1.3.2.3.2.2.5.1.3"><p id="modelarts_03_0082__en-us_topic_0129882788_p19267891181639">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="55.00000000000001%" id="mcps1.3.2.3.2.2.5.1.4"><p id="modelarts_03_0082__en-us_topic_0129882788_p17195363181639">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_03_0082__en-us_topic_0129882788_row6770181628"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.2.3.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p8780885181639">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.3.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p40163046181639">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.2.3.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p31981288181639">String</p>
</td>
<td class="cellrowborder" valign="top" width="55.00000000000001%" headers="mcps1.3.2.3.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p40347522181639">Project ID. For details about how to obtain the project ID, see <a href="modelarts_03_0147.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="modelarts_03_0082__en-us_topic_0129882788_section71456147333"><h4 class="sectiontitle">Request Body</h4><div class="p" id="modelarts_03_0082__en-us_topic_0129882788_p93001825170"><a href="#modelarts_03_0082__en-us_topic_0129882788_table37462542238">Table 2</a> describes the request parameters.
<div class="tablenoborder"><a name="modelarts_03_0082__en-us_topic_0129882788_table37462542238"></a><a name="en-us_topic_0129882788_table37462542238"></a><table cellpadding="4" cellspacing="0" summary="" id="modelarts_03_0082__en-us_topic_0129882788_table37462542238" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameters</caption><thead align="left"><tr id="modelarts_03_0082__en-us_topic_0129882788_row57501354122312"><th align="left" class="cellrowborder" valign="top" width="16.831683168316832%" id="mcps1.3.3.2.2.2.5.1.1"><p id="modelarts_03_0082__en-us_topic_0129882788_p14751165412319">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.85148514851485%" id="mcps1.3.3.2.2.2.5.1.2"><p id="modelarts_03_0082__en-us_topic_0129882788_p575315411231">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.85148514851485%" id="mcps1.3.3.2.2.2.5.1.3"><p id="modelarts_03_0082__en-us_topic_0129882788_p1275435419238">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="53.46534653465347%" id="mcps1.3.3.2.2.2.5.1.4"><p id="modelarts_03_0082__en-us_topic_0129882788_p10756175492314">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_03_0082__en-us_topic_0129882788_row4758654192310"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p47591654132311">service_name</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p17761854142313">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p8762155482314">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p77641954152311">Service name. Enter 1 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row197641954112315"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p176625410236">description</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p12768115419231">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p15770145472313">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p137721654202317">Service description, which contains a maximum of 100 characters. By default, this parameter is left blank.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row8773165432319"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1477414540232">infer_type</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1977655415234">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p12777135420239">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p2853191713361">Inference mode. The value can be <strong id="modelarts_03_0082__en-us_topic_0129882788_b1598534912247">real-time</strong> or <strong id="modelarts_03_0082__en-us_topic_0129882788_b11991989181">batch</strong>.</p>
<ul id="modelarts_03_0082__en-us_topic_0129882788_ul2419112113367"><li id="modelarts_03_0082__en-us_topic_0129882788_li1957942814364"><strong id="modelarts_03_0082__en-us_topic_0129882788_b7250115020184">real-time</strong>: real-time service, which can be stopped as scheduled.</li><li id="modelarts_03_0082__en-us_topic_0129882788_li3154113773617"><strong id="modelarts_03_0082__en-us_topic_0129882788_b20387916192519">batch</strong>: batch service, which can be configured as tasks to run in batches. When the tasks are completed, the service stops automatically.</li></ul>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row1053111164815"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p054171184813">workspace_id</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p18547113486">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p2541114484">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p20547154811">ID of the workspace to which a service belongs. The default value is <strong id="modelarts_03_0082__en-us_topic_0129882788_b2931434182810">0</strong>, indicating the default workspace. </p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row17794194272713"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p4795144232710">vpc_id</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p187298872820">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p61472185282">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p17291814103714">ID of the VPC to which a real-time service instance is deployed. By default, this parameter is left blank.</p>
<ul id="modelarts_03_0082__en-us_topic_0129882788_ul393381264811"><li id="modelarts_03_0082__en-us_topic_0129882788_li17933111294812">In this case, ModelArts allocates a dedicated VPC to each user so that users are isolated from each other. If you need to access other service components in a VPC of a service instance, set this parameter to the ID of the corresponding VPC.</li><li id="modelarts_03_0082__en-us_topic_0129882788_li8746101464815">Once a VPC is configured, it cannot be modified. If both <strong id="modelarts_03_0082__en-us_topic_0129882788_b1015794782917">vpc_id</strong> and <strong id="modelarts_03_0082__en-us_topic_0129882788_b12663949152919">cluster_id</strong> are configured, only the dedicated resource pool takes effect.</li></ul>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row20209140182715"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p7211140132713">subnet_network_id</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p8743182282">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1315531812810">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p12957727133712">ID of a subnet. By default, this parameter is left blank.</p>
<p id="modelarts_03_0082__en-us_topic_0129882788_p92111540182712">This parameter is mandatory when <strong id="modelarts_03_0082__en-us_topic_0129882788_b179615565292">vpc_id</strong> is configured. Enter the network ID displayed in the subnet details on the VPC console. A subnet provides dedicated network resources that are isolated from other networks.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row12369183762719"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p237016371274">security_group_id</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p107502080289">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p131631718192812">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p157981836143712">Security group. By default, this parameter is left blank. This parameter is mandatory when <strong id="modelarts_03_0082__en-us_topic_0129882788_b49842023104213">vpc_id</strong> is configured.</p>
<p id="modelarts_03_0082__en-us_topic_0129882788_p037093782715">A security group is a virtual firewall that provides secure network access control policies for service instances. A security group must contain at least one inbound rule to permit the requests whose protocol is TCP, source address is <strong id="modelarts_03_0082__en-us_topic_0129882788_b108381316143119">0.0.0.0/0</strong>, and port number is <strong id="modelarts_03_0082__en-us_topic_0129882788_b58715183317">8080</strong>.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row58381958154919"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p16838658104915">cluster_id</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p18838758144913">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p11838135814490">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p10838135864910">ID of a dedicated resource pool. This parameter is left blank by default, indicating that no dedicated resource pool is used. When using a dedicated resource pool to deploy services, ensure that the resource pool is running properly. After this parameter is set, the network configuration of the cluster is used, and the <strong id="modelarts_03_0082__en-us_topic_0129882788_b16520341152915">vpc_id</strong> parameter does not take effect. If this parameter is configured together with <strong id="modelarts_03_0082__en-us_topic_0129882788_b88151829163014">cluster_id</strong> in <strong id="modelarts_03_0082__en-us_topic_0129882788_b11483346306">real-time config</strong>, <strong id="modelarts_03_0082__en-us_topic_0129882788_b179064183115">cluster_id</strong> in <strong id="modelarts_03_0082__en-us_topic_0129882788_b557841019312">real-time config</strong> is used preferentially.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row1477965462320"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1678119545237">config</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p12784165413231">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1378505482320"><strong id="modelarts_03_0082__en-us_topic_0129882788_b210337203417">config</strong> array corresponding to <strong id="modelarts_03_0082__en-us_topic_0129882788_b063492019343">infer_type</strong></p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_en-us_topic_0129882788_p678715419237">Model running configuration. If <strong id="modelarts_03_0082__en-us_topic_0129882788_b77381523194410">infer_type</strong> is <strong id="modelarts_03_0082__en-us_topic_0129882788_b8738192318444">batch</strong>, you can configure only one model. If <strong id="modelarts_03_0082__en-us_topic_0129882788_b473972374417">infer_type</strong> is <strong id="modelarts_03_0082__en-us_topic_0129882788_b117393239448">real-time</strong>, you can configure multiple models and assign weights based on service requirements. However, the versions of these models cannot be the same.</p>
<ul id="modelarts_03_0082__en-us_topic_0129882788_ul1961616438479"><li id="modelarts_03_0082__en-us_topic_0129882788_li36162433474">If <strong id="modelarts_03_0082__en-us_topic_0129882788_b10265201712447">infer_type</strong> is set to <strong id="modelarts_03_0082__en-us_topic_0129882788_b19265171717440">real-time</strong>, see <a href="#modelarts_03_0082__en-us_topic_0129882788_table6841887256">Table 3</a>.</li><li id="modelarts_03_0082__en-us_topic_0129882788_li7616104334714">If <strong id="modelarts_03_0082__en-us_topic_0129882788_b133999248449">infer_type</strong> is set to <strong id="modelarts_03_0082__en-us_topic_0129882788_b44001424144419">batch</strong>, see <a href="#modelarts_03_0082__en-us_topic_0129882788_table6420928063">Table 4</a>.</li></ul>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row43051393120"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.2.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p16306103103120">schedule</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p23067311315">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p13306173173111"><strong id="modelarts_03_0082__en-us_topic_0129882788_b527818324718">schedule</strong> array</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.2.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p33061130310">Service scheduling configuration, which can be configured only for real-time services. By default, this parameter is not used. Services run for a long time. For details, see <a href="#modelarts_03_0082__en-us_topic_0129882788_table1892915349285">Table 5</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="modelarts_03_0082__en-us_topic_0129882788_table6841887256"></a><a name="en-us_topic_0129882788_table6841887256"></a><table cellpadding="4" cellspacing="0" summary="" id="modelarts_03_0082__en-us_topic_0129882788_table6841887256" frame="border" border="1" rules="all"><caption><b>Table 3 </b><strong id="modelarts_03_0082__en-us_topic_0129882788_b190922610169">config</strong> parameters of <strong id="modelarts_03_0082__en-us_topic_0129882788_b16222163916163">real-time</strong></caption><thead align="left"><tr id="modelarts_03_0082__en-us_topic_0129882788_row4846788252"><th align="left" class="cellrowborder" valign="top" width="16.831683168316832%" id="mcps1.3.3.2.3.2.5.1.1"><p id="modelarts_03_0082__en-us_topic_0129882788_p884819812515">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.841584158415841%" id="mcps1.3.3.2.3.2.5.1.2"><p id="modelarts_03_0082__en-us_topic_0129882788_p1985013812252">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13.861386138613863%" id="mcps1.3.3.2.3.2.5.1.3"><p id="modelarts_03_0082__en-us_topic_0129882788_p1852188192520">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="53.46534653465347%" id="mcps1.3.3.2.3.2.5.1.4"><p id="modelarts_03_0082__en-us_topic_0129882788_p38538832514">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_03_0082__en-us_topic_0129882788_row1856380258"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.3.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1786010872513">model_id</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.3.2.3.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p386268152512">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.3.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1386419814252">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.3.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p9866118172511">Model ID</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row1086798112511"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.3.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p986916812517">weight</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.3.2.3.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p687111819259">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.3.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p138731787259">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.3.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p19875118162511">Traffic weight allocated to a model. This parameter is mandatory only when <strong id="modelarts_03_0082__en-us_topic_0129882788_b5285632201718">infer_type</strong> is set to <strong id="modelarts_03_0082__en-us_topic_0129882788_b751912367172">real-time</strong>. The sum of the weights must be 100.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row1687613842514"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.3.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1187828182513">specification</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.3.2.3.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p38801282251">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.3.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p08821882254">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.3.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1732816427113">Resource specifications. Select specifications based on service requirements. </p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row1577715014366"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.3.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p49518457100">custom_spec</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.3.2.3.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1595144518103">No</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.3.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p2095144591017">Object</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.3.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p795164591015">Custom specifications. Set this parameter when you use a dedicated resource pool. For details, see <a href="#modelarts_03_0082__en-us_topic_0129882788_table134334512416">Table 6</a>.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row988558102512"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.3.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1588814812519">instance_count</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.3.2.3.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p68902872512">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.3.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p18926812256">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.3.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p11894788252">Number of instances deployed in a model. The value must be greater than 0.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row208952088256"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.3.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p48972820252">envs</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.3.2.3.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1889910820252">No</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.3.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p119011483251">Map&lt;String, String&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.3.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p590416818251">(Optional) Environment variable key-value pair required for running a model. By default, this parameter is left blank.</p>
<p id="modelarts_03_0082__en-us_topic_0129882788_p1933202593313">To ensure data security, do not enter sensitive information, such as plaintext passwords, in environment variables.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row184117584514"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.2.3.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1984255875116">cluster_id</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.3.2.3.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p28421358135110">No</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.3.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p6842125817517">string</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.2.3.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p4842658185112">ID of a dedicated resource pool. By default, this parameter is left blank, indicating that no dedicated resource pool is used. </p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="modelarts_03_0082__en-us_topic_0129882788_table6420928063"></a><a name="en-us_topic_0129882788_table6420928063"></a><table cellpadding="4" cellspacing="0" summary="" id="modelarts_03_0082__en-us_topic_0129882788_table6420928063" frame="border" border="1" rules="all"><caption><b>Table 4 </b><strong id="modelarts_03_0082__en-us_topic_0129882788_b174461719142117">config</strong> parameters of <strong id="modelarts_03_0082__en-us_topic_0129882788_b127532110217">batch</strong></caption><thead align="left"><tr id="modelarts_03_0082__en-us_topic_0129882788_row12420102810614"><th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.3.2.4.2.5.1.1"><p id="modelarts_03_0082__en-us_topic_0129882788_p164282280612">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.3.2.4.2.5.1.2"><p id="modelarts_03_0082__en-us_topic_0129882788_p1442892817613">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.3.2.4.2.5.1.3"><p id="modelarts_03_0082__en-us_topic_0129882788_p942814289610">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="54%" id="mcps1.3.3.2.4.2.5.1.4"><p id="modelarts_03_0082__en-us_topic_0129882788_p342819281067">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_03_0082__en-us_topic_0129882788_row242862813615"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1042811281364">model_id</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1343542810611">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p643515281612">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p144351289614">Model ID</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row644311283615"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1444316281614">specification</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1745022815613">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p124501281565">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1445012281764">Resource flavor. Options: <strong id="modelarts_03_0082__en-us_topic_0129882788_b5824182213308">modelarts.vm.cpu.2u</strong> and <strong id="modelarts_03_0082__en-us_topic_0129882788_b671143010304">modelarts.vm.gpu.p4</strong></p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row104508285618"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p645020286620">instance_count</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p104501028868">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p545910281362">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1745912811612">Number of instances deployed in a model.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row245911284618"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p174598287617">envs</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p194590281468">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p204591928064">Map&lt;String, String&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p14459202819615">(Optional) Environment variable key-value pair required for running a model. By default, this parameter is left blank.</p>
<p id="modelarts_03_0082__en-us_topic_0129882788_p7751032133413">To ensure data security, do not enter sensitive information, such as plaintext passwords, in environment variables.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row106241138135111"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p362417380511">src_type</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1662410381513">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p186242388512">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p5624163820510">Data source type. This parameter can be set to <strong id="modelarts_03_0082__en-us_topic_0129882788_b14481412163019">ManifestFile</strong>. By default, this parameter is left blank, indicating that only files in the <strong id="modelarts_03_0082__en-us_topic_0129882788_b163761134133017">src_path</strong> directory are read. If this parameter is set to <strong id="modelarts_03_0082__en-us_topic_0129882788_b16420104411415">ManifestFile</strong>, <strong id="modelarts_03_0082__en-us_topic_0129882788_b1474075184120">src_path</strong> must be a specific manifest file path. You can specify multiple data paths in the manifest file. </p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row27917187920"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p27919181917">src_path</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p37921815919">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p2791818799">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p137911181899">OBS path of the input data of a batch job</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row924312220920"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p13250162218914">dest_path</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p152505229917">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p122507220919">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p647112917104">OBS path of the output data of a batch job</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row47439433566"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p4743184317564">req_uri</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p97431443195610">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p769362075712">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p12743174314568">Inference API called in a batch task, which is a REST API in the model image. Select an API URI from the model <span class="parmvalue" id="modelarts_03_0082__en-us_topic_0129882788_parmvalue89825505114"><b>config.json</b></span> file for inference. If a ModelArts built-in inference image is used, the value of this parameter is <span class="parmvalue" id="modelarts_03_0082__en-us_topic_0129882788_parmvalue259414411118"><b>/</b></span>.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row34628464568"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1246314615563">mapping_type</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p16463154665614">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p127001020155716">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1935524110385">Mapping type of the input data. The value can be <strong id="modelarts_03_0082__en-us_topic_0129882788_b14884203513113">file</strong> or <strong id="modelarts_03_0082__en-us_topic_0129882788_b189763515317">csv</strong>.</p>
<ul id="modelarts_03_0082__en-us_topic_0129882788_ul1226004413385"><li id="modelarts_03_0082__en-us_topic_0129882788_li10900195016384">If you select <strong id="modelarts_03_0082__en-us_topic_0129882788_b857165115313">file</strong>, each inference request corresponds to a file in the input data path. When this mode is used, <strong id="modelarts_03_0082__en-us_topic_0129882788_b1713117713327">req_uri</strong> of this model can have only one input parameter and the type of this parameter is <strong id="modelarts_03_0082__en-us_topic_0129882788_b11716724133218">file</strong>.</li><li id="modelarts_03_0082__en-us_topic_0129882788_li126094413816">If you select <strong id="modelarts_03_0082__en-us_topic_0129882788_b51761653163214">csv</strong>, each inference request corresponds to a row of data in the CSV file. When this mode is used, the files in the input data path can only be in CSV format and <strong id="modelarts_03_0082__en-us_topic_0129882788_b10318151483410">mapping_rule</strong> needs to be configured to map the index of each parameter in the inference request body to the CSV file.</li></ul>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row52721349165615"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p172741749115618">mapping_rule</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p127454975612">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p12274849145617">Map</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p10153011183915">Mapping between input parameters and CSV data. This parameter is mandatory only when <strong id="modelarts_03_0082__en-us_topic_0129882788_b1530995144513">mapping_type</strong> is set to <strong id="modelarts_03_0082__en-us_topic_0129882788_b6309195124510">csv</strong>.</p>
<p id="modelarts_03_0082__en-us_topic_0129882788_p1643134111314">Mapping rule: The mapping rule comes from the input parameter (<strong id="modelarts_03_0082__en-us_topic_0129882788_b13148827162211">input_params</strong>) in the model configuration file <strong id="modelarts_03_0082__en-us_topic_0129882788_b192461033162216">config.json</strong>. When <span class="parmname" id="modelarts_03_0082__en-us_topic_0129882788_parmname765411320412"><b>type</b></span> is set to <strong id="modelarts_03_0082__en-us_topic_0129882788_b775182713213">string</strong>, <strong id="modelarts_03_0082__en-us_topic_0129882788_b1369692913211">number</strong>, <strong id="modelarts_03_0082__en-us_topic_0129882788_b545863313213">integer</strong>, or <strong id="modelarts_03_0082__en-us_topic_0129882788_b17721184218325">boolean</strong>, you need to configure the index parameter. For details, see .</p>
<p id="modelarts_03_0082__en-us_topic_0129882788_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>
</tbody>
</table>
</div>
</div>
<div class="tablenoborder"><a name="modelarts_03_0082__en-us_topic_0129882788_table1892915349285"></a><a name="en-us_topic_0129882788_table1892915349285"></a><table cellpadding="4" cellspacing="0" summary="" id="modelarts_03_0082__en-us_topic_0129882788_table1892915349285" frame="border" border="1" rules="all"><caption><b>Table 5 </b><strong id="modelarts_03_0082__en-us_topic_0129882788_b17658345281">schedule</strong> parameters</caption><thead align="left"><tr id="modelarts_03_0082__en-us_topic_0129882788_row9929133418283"><th align="left" class="cellrowborder" valign="top" width="16.831683168316832%" id="mcps1.3.3.3.2.5.1.1"><p id="modelarts_03_0082__en-us_topic_0129882788_p7929113442813">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.85148514851485%" id="mcps1.3.3.3.2.5.1.2"><p id="modelarts_03_0082__en-us_topic_0129882788_p49301534192811">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.85148514851485%" id="mcps1.3.3.3.2.5.1.3"><p id="modelarts_03_0082__en-us_topic_0129882788_p199305340285">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="53.46534653465347%" id="mcps1.3.3.3.2.5.1.4"><p id="modelarts_03_0082__en-us_topic_0129882788_p7930173472812">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_03_0082__en-us_topic_0129882788_row1893015341284"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.3.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p15930834142811">type</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.3.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p19930434162810">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.3.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p15930193412820">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.3.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1393083414285">Scheduling type. Only the value <strong id="modelarts_03_0082__en-us_topic_0129882788_b21121634104715">stop</strong> is supported.</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row179301634112811"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.3.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1593053482815">time_unit</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.3.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p10930133402815">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.3.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p129301334162818">String</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.3.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p351365234513">Scheduling time unit. Options:</p>
<ul id="modelarts_03_0082__en-us_topic_0129882788_ul432310557456"><li id="modelarts_03_0082__en-us_topic_0129882788_li1639220589457"><strong id="modelarts_03_0082__en-us_topic_0129882788_b128991129124911">DAYS</strong></li><li id="modelarts_03_0082__en-us_topic_0129882788_li27461074611"><strong id="modelarts_03_0082__en-us_topic_0129882788_b081716346493">HOURS</strong></li><li id="modelarts_03_0082__en-us_topic_0129882788_li632345574511"><strong id="modelarts_03_0082__en-us_topic_0129882788_b17977402492">MINUTES</strong></li></ul>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row89301634162818"><td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.3.3.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p39301334172816">duration</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.3.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1293093442817">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.3.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p12930734202819">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="53.46534653465347%" headers="mcps1.3.3.3.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p753864762914">Value that maps to the time unit. For example, if the task stops after two hours, set <strong id="modelarts_03_0082__en-us_topic_0129882788_b8598635124916">time_unit</strong> to <strong id="modelarts_03_0082__en-us_topic_0129882788_b139331639114914">HOURS</strong> and <strong id="modelarts_03_0082__en-us_topic_0129882788_b0139134394917">duration</strong> to <strong id="modelarts_03_0082__en-us_topic_0129882788_b189424664920">2</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="modelarts_03_0082__en-us_topic_0129882788_table134334512416"></a><a name="en-us_topic_0129882788_table134334512416"></a><table cellpadding="4" cellspacing="0" summary="" id="modelarts_03_0082__en-us_topic_0129882788_table134334512416" frame="border" border="1" rules="all"><caption><b>Table 6 </b><strong id="modelarts_03_0082__en-us_topic_0129882788_b1334545518470">custom_spec</strong> parameters</caption><thead align="left"><tr id="modelarts_03_0082__en-us_topic_0129882788_row63432456418"><th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.3.4.2.5.1.1"><p id="modelarts_03_0082__en-us_topic_0129882788_p534318455417">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.3.4.2.5.1.2"><p id="modelarts_03_0082__en-us_topic_0129882788_p334374574119">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.3.4.2.5.1.3"><p id="modelarts_03_0082__en-us_topic_0129882788_p153434452415">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="53%" id="mcps1.3.3.4.2.5.1.4"><p id="modelarts_03_0082__en-us_topic_0129882788_p183446457417">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_03_0082__en-us_topic_0129882788_row10344194584120"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1434415453416">cpu</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p163447457412">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p53441453417">Float</p>
</td>
<td class="cellrowborder" valign="top" width="53%" headers="mcps1.3.3.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p53441945104115">Number of required CPUs</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row1634414517415"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p334444512410">memory</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1634434510414">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p183447450410">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="53%" headers="mcps1.3.3.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p93441445154112">Required memory capacity, in MB</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row18688125794310"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.4.2.5.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p8689205712437">gpu_p4</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.4.2.5.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p468985734314">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.4.2.5.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p12689175794315">Float</p>
</td>
<td class="cellrowborder" valign="top" width="53%" headers="mcps1.3.3.4.2.5.1.4 "><p id="modelarts_03_0082__en-us_topic_0129882788_p12689457114318">Number of GPUs, which can be decimals. This parameter is optional. By default, it is not used.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="modelarts_03_0082__en-us_topic_0129882788_section54078976"><h4 class="sectiontitle">Response Body</h4><div class="p" id="modelarts_03_0082__en-us_topic_0129882788_p16223571711"><a href="#modelarts_03_0082__en-us_topic_0129882788_table95112832610">Table 7</a> describes the response parameters.
<div class="tablenoborder"><a name="modelarts_03_0082__en-us_topic_0129882788_table95112832610"></a><a name="en-us_topic_0129882788_table95112832610"></a><table cellpadding="4" cellspacing="0" summary="" id="modelarts_03_0082__en-us_topic_0129882788_table95112832610" frame="border" border="1" rules="all"><caption><b>Table 7 </b>Parameters</caption><thead align="left"><tr id="modelarts_03_0082__en-us_topic_0129882788_row810728112611"><th align="left" class="cellrowborder" valign="top" width="15.841584158415841%" id="mcps1.3.4.2.2.2.4.1.1"><p id="modelarts_03_0082__en-us_topic_0129882788_p1513182822619">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.831683168316832%" id="mcps1.3.4.2.2.2.4.1.2"><p id="modelarts_03_0082__en-us_topic_0129882788_p1416152812267">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="67.32673267326733%" id="mcps1.3.4.2.2.2.4.1.3"><p id="modelarts_03_0082__en-us_topic_0129882788_p21942813263">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="modelarts_03_0082__en-us_topic_0129882788_row1921628142610"><td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.4.2.2.2.4.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p16234289263">service_id</p>
</td>
<td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.4.2.2.2.4.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1725428162616">String</p>
</td>
<td class="cellrowborder" valign="top" width="67.32673267326733%" headers="mcps1.3.4.2.2.2.4.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p1327628102616">Service ID</p>
</td>
</tr>
<tr id="modelarts_03_0082__en-us_topic_0129882788_row1342375419370"><td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.4.2.2.2.4.1.1 "><p id="modelarts_03_0082__en-us_topic_0129882788_p54241554143716">resource_ids</p>
</td>
<td class="cellrowborder" valign="top" width="16.831683168316832%" headers="mcps1.3.4.2.2.2.4.1.2 "><p id="modelarts_03_0082__en-us_topic_0129882788_p2042413548375">Array of strings</p>
</td>
<td class="cellrowborder" valign="top" width="67.32673267326733%" headers="mcps1.3.4.2.2.2.4.1.3 "><p id="modelarts_03_0082__en-us_topic_0129882788_p164246547371">Resource ID array for the resource IDs generated by the target model</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="modelarts_03_0082__en-us_topic_0129882788_section1810193414711"><h4 class="sectiontitle">Samples</h4><p id="modelarts_03_0082__en-us_topic_0129882788_p1626113524475">The following shows how to deploy different types of services.</p>
</div>
<ul id="modelarts_03_0082__en-us_topic_0129882788_ul11661134735818"><li id="modelarts_03_0082__en-us_topic_0129882788_li19906201474216">Sample request: Creating a real-time service<pre class="screen" id="modelarts_03_0082__en-us_topic_0129882788_screen1369112453392">POST https://endpoint/v1/{project_id}/services
{
"service_name": "mnist",
"description": "mnist service",
"infer_type": "real-time",
"config": [
{
"model_id": "xxxmodel-idxxx",
"weight": "100",
"specification": "modelarts.vm.cpu.2u",
"instance_count": 1
}
]
}</pre>
</li><li id="modelarts_03_0082__en-us_topic_0129882788_li13176914017">Sample request: Creating a real-time service and configuring multi-version traffic distribution<pre class="screen" id="modelarts_03_0082__en-us_topic_0129882788_screen483712814012">{
"service_name": "mnist",
"description": "mnist service",
"infer_type": "real-time",
"config": [
{
"model_id": "xxxmodel-idxxx",
"weight": "70",
"specification": "modelarts.vm.cpu.2u",
"instance_count": 1,
"envs":
{
"model_name": "mxnet-model-1",
"load_epoch": "0"
}
},
{
"model_id": "xxxxxx",
"weight": "30",
"specification": "modelarts.vm.cpu.2u",
"instance_count": 1
}
]
}</pre>
</li><li id="modelarts_03_0082__en-us_topic_0129882788_li1581935820711">Sample request: Creating a real-time service in a dedicated resource pool with custom specifications<pre class="screen" id="modelarts_03_0082__en-us_topic_0129882788_screen17561139818">{
"service_name": "realtime-demo",
"description": "",
"infer_type": "real-time",
"cluster_id": "8abf68a969c3cb3a0169c4acb24b0000",
"config": [{
"model_id": "eb6a4a8c-5713-4a27-b8ed-c7e694499af5",
"weight": "100",
"cluster_id": "8abf68a969c3cb3a0169c4acb24b0000",
"specification": "custom",
"custom_spec": {
"cpu": 1.5,
"memory": 7500,
"gpu_p4": 0,
},
"instance_count": 1
}]
}</pre>
</li><li id="modelarts_03_0082__en-us_topic_0129882788_li1285717291886">Sample request: Creating a real-time service and setting it to automatically stop<pre class="screen" id="modelarts_03_0082__en-us_topic_0129882788_screen19822440587">{
"service_name": "service-demo",
"description": "demo",
"infer_type": "real-time",
"config": [{
"model_id": "xxxmodel-idxxx",
"weight": "100",
"specification": "modelarts.vm.cpu.2u",
"instance_count": 1
}],
"schedule": [{
"type": "stop",
"time_unit": "HOURS",
"duration": 1
}]
}</pre>
</li><li id="modelarts_03_0082__en-us_topic_0129882788_li15828133318414">Sample request: Creating a batch service and setting <strong id="modelarts_03_0082__en-us_topic_0129882788_b15961631103615">mapping_type</strong> to <strong id="modelarts_03_0082__en-us_topic_0129882788_b710214318360">file</strong><pre class="screen" id="modelarts_03_0082__en-us_topic_0129882788_screen1599132254114">{
"service_name": "batchservicetest",
"description": "",
"infer_type": "batch",
"cluster_id": "8abf68a969c3cb3a0169c4acb24b****",
"config": [{
"model_id": "598b913a-af3e-41ba-a1b5-bf065320f1e2",
"specification": "modelarts.vm.cpu.2u",
"instance_count": 1,
"src_path": "https://infers-data.obs.xxxx.com/xgboosterdata/",
"dest_path": "https://infers-data.obs.dxxxx.com/output/",
"req_uri": "/",
"mapping_type": "file"
}]
}</pre>
</li><li id="modelarts_03_0082__en-us_topic_0129882788_li266195415423">Sample request: Creating a batch service and setting <strong id="modelarts_03_0082__en-us_topic_0129882788_b696554033615">mapping_type</strong> to <span class="parmvalue" id="modelarts_03_0082__en-us_topic_0129882788_parmvalue616493919428"><b>csv</b></span><pre class="screen" id="modelarts_03_0082__en-us_topic_0129882788_screen1056485810421">{
"service_name": "batchservicetest",
"description": "",
"infer_type": "batch",
"config": [{
"model_id": "598b913a-af3e-41ba-a1b5-bf065320f1e2",
"specification": "modelarts.vm.cpu.2u",
"instance_count": 1,
"src_path": "https://infers-data.obs.xxxx.com/xgboosterdata/",
"dest_path": "https://infers-data.obs.xxxx.com.com/output/",
"req_uri": "/",
"mapping_type": "csv",
"mapping_rule": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"req_data": {
"type": "array",
"items": [{
"type": "object",
"properties": {
"input5": {
"type": "number",
"index": 0
},
"input4": {
"type": "number",
"index": 1
},
"input3": {
"type": "number",
"index": 2
},
"input2": {
"type": "number",
"index": 3
},
"input1": {
"type": "number",
"index": 4
}
}
}]
}
}
}
}
}
}]
}</pre>
<div class="p" id="modelarts_03_0082__en-us_topic_0129882788_p109441132164711">The format of the inference request body described in <strong id="modelarts_03_0082__en-us_topic_0129882788_b887317116392">mapping_rule</strong> is as follows:<pre class="screen" id="modelarts_03_0082__en-us_topic_0129882788_screen1983105175417">{
"data": {
"req_data": [{
"input1": 1,
"input2": 2,
"input3": 3,
"input4": 4,
"input5": 5
}]
}
}</pre>
</div>
</li></ul>
<ul id="modelarts_03_0082__en-us_topic_0129882788_ul163453474715"><li id="modelarts_03_0082__en-us_topic_0129882788_li1533103454717">Sample response<pre class="screen" id="modelarts_03_0082__en-us_topic_0129882788_screen16841649164311">{
"service_id": "10eb0091-887f-4839-9929-cbc884f1e20e",
"resource_ids": [ "INF-f878991839647358@1598319442708" ]
}</pre>
</li></ul>
<div class="section" id="modelarts_03_0082__en-us_topic_0129882788_section16948739"><h4 class="sectiontitle">Status Code</h4><p id="modelarts_03_0082__en-us_topic_0129882788_p1731954913014">For details about the status code, see <a href="modelarts_03_0094.html#modelarts_03_0094__en-us_topic_0132773864_table1450010510213">Table 1</a>.</p>
</div>
<div class="section" id="modelarts_03_0082__section27281325181210"><h4 class="sectiontitle">Error Codes</h4><p id="modelarts_03_0082__p1572811255123">See <a href="modelarts_03_0095.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="modelarts_03_0081.html">Service Management</a></div>
</div>
</div>