简介
Stable Diffusion 是一种开源的机器学习模型,可以根据文本生成图像、基于文本修改图像以及增强低分辨率或低细节图像。它已经过数十亿张图像的训练,可以产生与 DALL-E 2 和 MidJourney 生成的结果相当的结果。
Stable Diffusion Web UI 是基于稳定扩散的 Gradio 库的浏览器界面。我们将逐步介绍如何在 Windows 上安装流行的 Stable Diffusion 软件 AUTOMATIC1111。完成本教程后,您可以在自己的 PC 上或租赁的GPU服务器上自由地创建 AI 图像。
系统要求
Windows 10、11
Git, Conda, Python 3.10
16GB RAM、30G SSD 磁盘空间
具有至少 8GB VRAM 的 Nvidia 显卡
如何安装 AUTOMATIC1111
步骤 1. 安装 Chocolatey
Chocolatey 是 Microsoft Windows 上软件的命令行包管理器和安装程序。我们将使用 Chocolatey 来安装 Git 和 Conda。首先以管理员身份打开powershell工具,执行以下代码:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

步骤 2. 安装 Git 和 Conda
现在我们可以方便地使用choco来安装git和conda工具了,请执行以下命令行:
# 安装 git choco install git # 安装 conda choco install anaconda3
注意:您也可以手动安装 Git 和 Conda,而不使用 choco
步骤 3. 下载 Stable Diffusion 项目代码
将 stable-diffusion-webui 存储库下载为 .zip 文件,然后解压或使用 git 直接克隆项目到本地:
PS D:github>git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git Cloning into 'stable-diffusion-webui'... remote: Enumerating objects: 18979, done. remote: Counting objects: 100% (573/573), done. remote: Compressing objects: 100% (248/248), done. remote: Total 18979 (delta 359), reused 480 (delta 325), pack-reused 18406 Receiving objects: 100% (18979/18979), 28.88 MiB | 9.87 MiB/s, done. Resolving deltas: 100% (13233/13233), done.
注意:某些文件超过数千兆字节,因此请先确保有足够的可用空间。
步骤4. 创建Python 3.10.11环境
打开 Anaconda Navigator,然后创建 StableDiffusion Env,如下所示:

打开 StableDiffusion Env 终端:

注意:您也可以在不安装 Anaconda 的情况下手动安装 Python 3.10.11,较新版本的 Python 不支持 torch,记得选中“将 Python 添加到 PATH”。
步骤 5. 下载 Stable Diffusion 模型
模型有时称为检查点文件,是预先训练的稳定扩散权重,旨在生成一般或特定类型的图像。请打开 CompVis 或 Stable Diffusion Art 并下载您喜欢的任何模型,例如 1.5,并将其放入 models 目录。
(StableDiffusion) D:githubstable-diffusion-webuimodelsStable-diffusion

步骤 6. 启动 Stable Diffusion WebUI 服务器
(StableDiffusion) D:githubstable-diffusion-webui>webui.bat --xformers venv "D:githubstable-diffusion-webuivenvScriptsPython.exe" Python 3.10.11 | packaged by Anaconda, Inc. | (main, Apr 20 2023, 18:56:50) [MSC v.1916 64 bit (AMD64)] Commit hash: 5ab7f213bec2f816f9c5644becb32eb72c8ffb89 Installing xformers Collecting xformers==0.0.17 Downloading xformers-0.0.17-cp310-cp310-win_amd64.whl (112.6 MB) …… Model loaded in 12.8s (calculate hash: 6.1s, load weights from disk: 0.3s, create model: 1.7s, apply weights to model: 1.1s, apply half(): 1.2s, move model to device: 1.0s, load textual inversion embeddings: 1.3s). Running on local URL: http://127.0.0.1:7860

制作您的人工智能图像
使用浏览器打开本地Stable Diffusion WebUI URL,在输入提示的字段中,输入要生成的图像的描述。然后,单击生成按钮。以下是一些最佳 Stable Diffusion 1.5 提示词示例,供您参考。
提示词:
Pixar style little girl, 4k, 8k, unreal engine, octane render photorealistic by cosmicwonder, hdr, photography by cosmicwonder, high definition, symmetrical face, volumetric lighting, dusty haze, photo, octane render, 24mm, 4k, 24mm, DSLR, high quality, 60 fps, ultra realistic

提示词:
(masterpiece:1.0), (best quality:1.4), (ultra highres:1.2), (photorealistic:1.4), (8k, RAW photo:1.2), (soft focus:1.4), 1 woman, posh, (sharp focus:1.4), (korean:1.2), (american:1.1), detailed beautiful face, black hair, (detailed open blazer:1.4), tie, beautiful white shiny humid skin, smiling
负提示词:
illustration, 3d, sepia, painting, cartoons, sketch, (worst quality:2), (low quality:2), (normal quality:2), lowres, bad anatomy, bad hands, normal quality, ((monochrome)), ((grayscale:1.2)),newhalf, collapsed eyeshadow, multiple eyebrows, pink hair, analog, analogphoto

总结
Stable Diffusion 在 AI 艺术模型中脱颖而出,您既可以在具有GPU支持的本地 PC 上运行它,从而允许您微调算法生成各种艺术作品,直到您对结果感到满意为止。如果您已经拥有功能强大的游戏电脑或其他GPU服务器,那么您只需点击几下即可在任何地方创作令人难以置信的艺术作品。
文章来源于互联网:如何在 Windows 上安装 Stable Diffusion WebUI AUTOMATIC1111
相关推荐: Stable Diffusion Fooocus批量绘图脚本
当当当挡~,流动传热数值计算之余发布点AIGC相关文章,希望大家能喜欢~ 1 Stable Diffusion各种UI分析对比 提示:此部分主要是对SD各种界面的简要介绍和对比,只关注Fooocus批量绘图的读者可直接跳到第二部分。 Stable Diffus…
5bei.cn大模型教程网










