Logo for AiToolGo

AI Painting with Stable Diffusion on 函数计算: A Quick Deployment Guide

In-depth discussion
Technical
 0
 0
 24
本文介绍如何通过阿里云函数计算快速搭建Stable Diffusion的WebUI框架,实现文本生成图片的功能,涵盖了部署步骤、费用说明及常见问题解答。
  • main points
  • unique insights
  • practical applications
  • key topics
  • key insights
  • learning outcomes
  • main points

    • 1
      提供详细的部署步骤和操作指导
    • 2
      涵盖了费用说明和资源使用评估
    • 3
      包含常见问题解答,便于用户理解
  • unique insights

    • 1
      深入解析了Stable Diffusion的工作原理
    • 2
      提供了基于函数计算的AI绘画应用的实用案例
  • practical applications

    • 文章为用户提供了清晰的操作步骤和费用评估,使得AI绘画的实现变得更加可行和透明。
  • key topics

    • 1
      Stable Diffusion
    • 2
      函数计算
    • 3
      AI绘画
  • key insights

    • 1
      详细的步骤指导使部署过程简单易懂
    • 2
      费用透明,帮助用户合理评估成本
    • 3
      结合实际应用场景,增强了内容的实用性
  • learning outcomes

    • 1
      掌握Stable Diffusion的部署流程
    • 2
      理解AI绘画的基本原理
    • 3
      评估使用Stable Diffusion的成本
examples
tutorials
code samples
visuals
fundamentals
advanced content
practical tips
best practices

Introduction to Stable Diffusion and AIGC

AIGC (Artificial Intelligence Generated Content) refers to content generated by artificial intelligence. The 'text-to-image' technology uses AI to create images. Stable Diffusion is a diffusion model that generates images from text. It extracts latent variables from text using the CLIP model and generates images using the UNet model. The image quality is optimized through gradual diffusion and processing. This article guides you on how to quickly deploy the Stable Diffusion text-to-image model based on Function Compute and implement AI painting.

Prerequisites for Deployment

Before deploying Stable Diffusion, ensure you have activated the Function Compute service. Refer to the Function Compute documentation for details on activation.

Creating and Deploying the Stable Diffusion Application

1. Log in to the Function Compute console and click on 'Applications' in the left navigation bar. 2. If you are a first-time user or have no applications, you will automatically enter the application creation page. Otherwise, click 'Create Application'. 3. Choose to create an application from a template and select the 'AI Digital Painting stable-diffusion' template. Click 'Create Immediately'. 4. Configure the following settings: - Deployment Type: Select 'Direct Deployment'. - Role Name: If you are a first-time user, click 'Authorize' to configure role permissions (e.g., AliyunFCServerlessDevsRole). - Region: Choose a region for deployment. If deployment fails, try switching to another region. - Drawing Type: Select a drawing type (e.g., SD1.5, Anime Style, Realistic Style, or Lightweight Version). 5. Acknowledge the cost implications and click 'Agree and Continue Deployment'. 6. Wait for the deployment to complete (approximately 1-2 minutes).

Accessing the Stable Diffusion WebUI

1. Check the image acceleration readiness status of the GPU function 'sd'. Function Compute provides image acceleration to optimize the startup of large AI/GPU images. 2. In the application details page, click on the environment name (e.g., 'default environment'). 3. Select the 'Environment Details' tab and click on the 'sd' function in the 'Resource Information' area. 4. In the 'Function Configuration' tab, under 'Environment Information', wait for the 'Image Acceleration Readiness Status' to become 'Available'. 5. Return to the application details page and click on the access domain in the 'Operation' column of the target environment. This will take you to the Stable Diffusion WebUI.

Generating Images with Text Prompts

Once in the Stable Diffusion WebUI, navigate to the 'Text to Image' tab. Enter your text prompt in the input box and click the 'Generate' button. The image will gradually become clearer, and a progress bar will show the generation progress and estimated remaining time.

Cost Considerations and Free Tier Usage

Deploying and using Stable Diffusion will incur costs for GPU resources, vCPU resources, memory resources, disk resources, public network traffic, and function calls. New users can claim a trial package, but it may not cover public network traffic and disk usage. If you generate 100 images, each requiring 5 MB of public network traffic and taking 5 seconds, the costs can be estimated as follows: - Public Network Traffic: 0.50 yuan/GB * 500MB = 0.25 yuan - Disk Usage: (Exceeding 512 MB) 0.00000175 yuan/GB*second * 5000 GB*seconds = 0.008 yuan With a Function Compute configuration of GPU 16 GB, vCPU 8 cores, and memory 32 GB, the free trial can support approximately 1041 minutes of Stable Diffusion WebUI usage. Each image generation (assuming 5 seconds) can generate up to 12500 images. Remember to close the WebUI when not in use to conserve resources.

Deleting Resources

If you no longer need to use the Stable Diffusion application, delete the resources to avoid incurring further costs. Go to the Function Compute console, click on 'Applications', and delete the target application. Confirm the deletion and associated resources.

FAQ

Refer to the Function Compute documentation for troubleshooting common issues such as application startup failures, process freezes during image generation, inability to install plugins online, accessing the Stable Diffusion API, cost details, and alternative customization options.

 Original link: https://help.aliyun.com/zh/functioncompute/fc-2-0/use-cases/one-click-deployment-of-stable-diffusion-based-on-function-calculation-for

Comment(0)

user's avatar

      Related Tools