By Hanxie
AIGC has gone viral! Stable Diffusion is also making waves in the realm of generative art, profoundly affecting painting, video production, and other related fields. Even ordinary people can produce amazing works of art with this technology.
Today, I will use Alibaba Cloud Function Compute to deploy Stable Diffusion WebUI to show you the charm of this technology.
Before starting with the technical tutorial, let's take a look at some pictures I generated with this technology.
Stable Diffusion WebUI: https://github.com/AUTOMATIC1111/stable-diffusion-webui
edition: 1.0.0
name: fc-stable-diffusion
access: default
services:
cn-shanghai-stable-diffusion-sd:
component: devsapp/fc
props:
region: cn-shanghai
service:
description: stable-diffusion部署到函数计算
internetAccess: true
name: stable-diffusion
function:
handler: index.handler
timeout: 600
diskSize: 10240
caPort: 7860
instanceType: fc.gpu.tesla.1
runtime: custom-container
cpu: 8
customContainerConfig:
args: ''
accelerationType: Default
image: registry.cn-shanghai.aliyuncs.com/vipas/stable-diffusion-web:v2
accelerationInfo:
status: Preparing
command: ''
webServerMode: true
instanceConcurrency: 1
memorySize: 32768
environmentVariables: {}
gpuMemorySize: 16384
name: sd
asyncConfiguration: {}
triggers:
- name: defaultTrigger
description: ''
type: http
qualifier: LATEST
config:
methods:
- GET
- POST
- PUT
- DELETE
authType: anonymous
disableURLInternet: false
customDomains:
- domainName: auto
protocol: HTTP
routeConfigs:
- path: /*
s deploy
After executing the deployment instruction, you will get the access address, as shown in the following:http://sd.stable-diffusion.xxxxxx.cn-shanghai.fc.devsapp.net
(xxxxxx is your account uid)
cn-shanghai-stable-diffusion-sd:
region: cn-shanghai
service:
name: stable-diffusion
function:
name: sd
runtime: custom-container
handler: index.handler
memorySize: 32768
timeout: 600
url:
system_url: https://sd-stable-iffusion-zulpjlkgaj.cn-shanghai.fcapp.run
custom_domain:
-
domain: http://sd.stable-diffusion.xxxxxx.cn-shanghai.fc.devsapp.net
triggers:
-
type: http
name: defaultTrigger
It takes Function Compute 3-4 minutes to start the first time. You need to complete operations, such as image pulling and cold start.
The final screen is shown below:
The default image provided comes with a base model, Stable Diffusion.
After the deployment is successful, you can enter some text descriptions to generate pictures. As shown in the picture above, Stable Diffusion generated a picture of a cute puppy 🐕.
You can use Function Compute to deploy Stable Diffusion and run it with one-line instruction. However, there are many practical problems. For example, the image used here only retains a base model, and the image needs to be re-mirrored if the model is expanded later, which is very troublesome. In addition, the overall cold start time is long, making the initial access experience not good. How to dynamically manage and extend the model and speed up the startup will be discussed further in the next practice section.
[1] Function Compute
https://www.alibabacloud.com/product/function-compute
[2] Alibaba Cloud Container Registry (ACR)
https://www.alibabacloud.com/product/container-registry
[3] Serverless Devs
https://docs.serverless-devs.com/en/serverless-devs/quick_start
[4] Alibaba Cloud Key Information
https://docs.serverless-devs.com/en/serverless-devs/command/config
Alibaba Cloud Function Compute Helps to Upgrade the Architecture of Amap RTA Advertising System
Summary of Stability Construction of Kubernetes-based Serverless PaaS
99 posts | 7 followers
FollowH Ohara - May 8, 2024
Alibaba Cloud Serverless - July 9, 2024
Alibaba Cloud Native Community - September 19, 2023
Alibaba Cloud Community - July 11, 2024
Alibaba Cloud Native - December 10, 2024
ferdinjoe - June 5, 2024
99 posts | 7 followers
FollowAlibaba Cloud Function Compute is a fully-managed event-driven compute service. It allows you to focus on writing and uploading code without the need to manage infrastructure such as servers.
Learn MoreA secure image hosting platform providing containerized image lifecycle management
Learn MoreVisualization, O&M-free orchestration, and Coordination of Stateful Application Scenarios
Learn MoreAccelerate AI-driven business and AI model training and inference with Alibaba Cloud GPU technology
Learn MoreMore Posts by Alibaba Cloud Serverless