This topic describes how to deploy the Stable Diffusion 1.5 model and start the web application to fine-tune the model in Platform for AI (PAI).
Prerequisites
An Object Storage Service (OSS) bucket is created. For more information, see Create buckets.
Step 1. Go to the details page of the model
Go to the Model Gallery page.
Log on to the PAI console.
In the left-side navigation pane, click Workspaces. On the Workspaces page, find the workspace that you want to manage and click the name of the workspace. The Workspace Details page appears.
In the left-side navigation pane of the Workspace Details page, click Model Gallery.
On the Model Gallery page, enter Stable_Diffusion_V1.5 in the search box and click Search.
In the search results, click the stable_diffusion_v1.5 model to go to the details page of the model.
Step 2. Deploy and debug the model
On the details page of the model, click Deploy in the upper-right corner.
Verify the parameter settings in the Model Service Information and Resource Deployment Information sections.
Model Gallery specifies a service name and presets the computing resources that are required to deploy a model based on characteristics of the model. In this example, the default parameter settings are used.
Click Deploy. In the Billing Notification message, click OK.
The details page of the service appears. On the Service details tab, you can view the deployment status of the model service in the Basic information section. When the Status parameter changes to In operation, the model service is deployed.
In the Web Application section of the Service details tab, click View Web App to start the web application.
On the web application interface, test the model.
On the txt2img tab, enter
The eagle is flying in the sky, in the distance is the vast snow, and under the snow mountain is a grassland
in the Prompt field and click Generate. The following figure shows a sample response.
Step 3. Fine-tune the model
You can fine-tune the Stable Diffusion 1.5 model to better align with your business requirements.
Go to the details page of the model and click Train in the upper-right corner.
In the Fine-tune panel, view and modify the following parameters. Use the default values of other parameters. For more information about the parameters, see the "Fine-tune a model" section of the Deploy and train models topic.
Parameter
Description
Datasets
The dataset that is used for training. You can use the default dataset. If you want to use your dataset, perform the following steps:
On the model details page, prepare training data based on the Training Data Format. For more information, see sample dataset.
Upload the dataset to an OSS bucket. For more information about how to upload objects to an OSS bucket, see Upload objects.
Specify your dataset as the training dataset. For more information, see the "Fine-tune a model" section of the Deploy and train models topic.
Hyper-parameters
Set the training_method parameter to lora and use the default values of other parameters.
Job Configuration
Click the icon next to the OSS file or directory drop-down list and select the OSS bucket in which the dataset is stored.
Click Fine-tune.
The details page of the job appears..
After the training job is complete, you can click Deploy in the Model Deployment section of the Task details tab to deploy the model. The process of deploying a fine-tuned model is the same as directly deploying a model. For more information, see the Directly deploy and debug the model section of this topic.