All Products
Search
Document Center

Platform For AI:Model Prediction

Last Updated:Jul 14, 2023

You can use this component to perform offline prediction to EasyRec models.

Prerequisites

You have trained a model by using the Model Training component. For more information, see Model Training.

Configure the component in Machine Learning Designer

  • Input ports

Port (from left to right)

Recommended upstream component

Parameters of PAI commands

Required

Input model

saved_model_dir

Yes

Input table

input_table

Yes

  • Component parameters

Tab

Parameter

Required

Description

Parameters of PAI commands

Default value

Parameters Setting

Input Feature Columns

No

The feature columns that are selected from the input table for training. You cannot specify this parameter and the Excluded Columns parameter at the same time.

selected_cols

No default value

Excluded Columns

No

The columns that you want to exclude from the input table. You cannot specify this parameter and the Input Feature Columns parameter at the same time.

excluded_cols

No default value

Reserved Columns

No

The names of the generated columns that you want to reserve.

reserved_cols

No default value

Output Columns

No

The output columns in the MaxCompute table.

output_cols

probs double

miniBatch size

No

The size of the minibatch, which indicates the minimum number of samples contained in a batch.

batch_size

1024

Specify the algorithm version

Yes

This parameter is available if you select the Advanced Options.

Select an algorithm package to run.

  1. Generate a TAR package. For more information, see Release & Upgrade in the EasyRec documentation.

  2. Upload the TAR package to the OSS path. For more information, see Upload objects.

  3. Select the uploaded TAR package.

script

No default value

Tuning

Worker Count

No

The number of worker nodes.

Passed in as the cluster parameter.

1

Worker CPU

No

The CPU number of each worker. A value of 1 indicates one CPU core.

6

Worker Memory

No

The memory size of each worker node. A value of 100 indicates 100 MB.

30000

Worker GPU

No

GPUs are not required in most EasyRec trainings.

0

  • Output ports

Port (from left to right)

Data type

Parameters of PAI commands

Output table

MaxCompute table

output_table

PAI command and parameters

PAI -project algo_public -name easy_rec_ext 
    -Darn="acs:ram::xxx:role/aliyunodpspaidefaultrole" 
    -Dbatch_size="1024" 
    -Dbuckets="oss://rec_sln_demo/" 
    -Dcluster="{\"worker\": {\"count\": 1, \"cpu\": 600, \"gpu\": 0, \"memory\": 30000}}" 
    -Dcmd="predict" 
    -Dinput_table="odps://pai_hangzhou/tables/pai_temp_flow_inpwi02on49ooub78p_node_dn3y3lvucm862jr71n_outputTable" 
    -Dlifecycle="28" 
    -DossHost="oss-cn-hangzhou-internal.aliyuncs.com" 
    -Doutput_cols="item_emb string" 
    -Doutput_table="odps://pai_hangzhou/tables/pai_temp_flow_da1nuzwmbdfyw5kajy_node_5jgko0vlrjiwawp6y8_outputTable" 
    -Dreserved_cols="item_id" 
    -Dsaved_model_dir="oss://rec_sln_demo/EasyRec/deploy/rec_sln_demo_dssm_recall_v1/20230425/export/final/item" 
    -Dscript="oss://rec_sln_demo/easy_rec_ext_0.6.1_res.tar.gz";

Parameter

Required

Description

saved_model_dir

Yes

The directory of the exported model files.

input_table

Yes

The name of the input table.

output_table

No

The output table that is automatically created.

reserved_cols

No

The columns to be copied to the output_table. Separate multiple columns with commas (,).

output_cols

No

The names and data types of the columns in the output table. Separate multiple columns with commas (,).

batch_size

No

The size of minibatch.

arn

Yes

To obtain the value of the arn, perform the following operations: Log on to the PAI console. In the left-side navigation pane, choose Activation & Authorization > Dependent Services. In the Designer section, find OSS and click View Authorization in the Actions column.

buckets

Yes

The bucket where the model file resides and the bucket where the model is stored. If multiple buckets are used, separate multiple buckets with commas (,). Example: oss://xxxx/,oss://xxxx/.

ossHost

Yes

The endpoint of OSS. For more information about endpoints, see Regions and endpoints.

script

No

The path of the OSS bucket where the EasyRec TAR package is stored. For more information about how to configure the EasyRec TAR package, see Release & Upgrade in the EasyRec documentation.

Example

  1. Create a pipeline as shown in the following figure. d97c947a2a84a25c45582ba08920423c..png

    Section

    Description

    ① ② ③

    For more information about how to configure the parameters, see Examples in Model Training.

    Connect the Model Training component to the left input port of Model Prediction, and connect the Read Table-2 component to the right input port of Model Prediction. Set Exclude Column to clk and select user_id and pid for Reserved Columns.

  2. After the pipeline is run, right-click the Model Prediction component and choose View Data > Output Table. image..png

For more information, see 13_rec_sln_demo_dssm_recall_item_embedding_v1 in Vector Recall.