After training a model, you can deploy it as an online service by using PAI-EAS for other applications to call.
PAI-EAS
EAS (Elastic Algorithm Service) is the model online serving platform of PAI. It supports one-click deployment of models as online inference services or AI-Web applications, and provides auto scaling, resource group management, versioning, and resource monitoring. This helps you deliver highly concurrent, stable online model serving at a low resource cost. For more information, see EAS overview.
Billing
The examples in this topic use public resources to create an EAS service on a pay-as-you-go basis. Stop or delete the service when you no longer need it to avoid ongoing charges.
Deploy a model by using EAS
For a complete example of developing a model in DSW and deploying it in EAS, see Deploy the model service with EAS .
Log on to the PAI console. Select the target region and workspace at the top of the page. Then, in the left-side navigation pane, choose Elastic Algorithm Service (EAS) > Deploy Service > Custom Deployment.
-
Configure the following key parameters and keep the default values for other parameters. For the full list of configuration parameters, see Custom deployment.
Deployment Method: Select Image-based Deployment.
-
Image Configuration: An image provides the runtime environment for your model. You can use an official image, a custom image, or enter an image address.
If you developed your model in DSW, you can select Image Address and copy the image used by your DSW instance. In the DSW Instance list, find the target instance and click the copy icon next to the image address in the Image Version column.
Alternatively, use the image building feature of DSW to push the image to Container Service for Registry (ACR) for EAS to use. For more information, see Create a DSW instance image.
-
Mount storage: You can upload your application code files to OSS and configure a mount path. In the Direct Mount configuration, set the type to OSS, set Uri to the OSS path (for example,
oss://bucket-name/directory/), set Mount Path to/mnt/data/, and configure the Read-only switch as needed.The following sample code is used in this example. The code file has been uploaded to OSS.
Command: Enter the startup command to launch the sample code. In this example, set Command to
python /mnt/data/web.pyand Port Number to9000.Port Number: Enter the port number
9000used in web.py.Third-party Library Settings: Add third-party libraries that are missing from the image. For example, in the Third-party Library List tab, enter the required library names such as
numpy bottlein the input field.Resource Type: Select Public Resources. For Resource Specification, select
ecs.gn7i-c16g1.4xlarge.
Click Deploy. The service is deployed when the service status changes to Running.
Test the service
After the model is deployed, use the EAS debugging console to test the service API.
On the EAS instance list page, click the instance name to go to the instance details page, and then click Online Debugging.
Using the web.py application as an example, set the request path to /api/predict/pai_eas_test/hello and the HTTP method to POST, enter the request URL, and then click Send Request. If "Hello, World!" is returned, the request succeeds.
To call the service by using a public endpoint or a VPC endpoint, see Service invocation.
References
For more EAS features, see Overview.
For the full list of EAS console configuration parameters, see Custom deployment.
If you encounter issues when deploying or calling a service, see EAS FAQ.