赞
踩
最近要用到 AI 绘画,所以研究了下目前市面上的 AI 绘画工具,真可谓是琳琅满目,但主流的还是 Stable diffusion 和 Midjourney 两大阵营。
Midjourney 不多说,开箱即用,对新手非常友好,但不免费,Stable diffusion 相对 Midjourney 来说,专业性更强,不易上手,但更灵活,指哪打哪,模型生态丰富,最重要的是免费!
树先生总结了目前使用 Stable diffusion 的几种不同姿势,还没上车的朋友们快跟着我一起上车吧~
推荐指数:★☆☆☆☆
适用人群:浅尝辄止地体验玩家
如果你只想浅尝辄止地体验一下 AI 绘画的魅力,可以考虑使用一些 SD 的在线网站,比如 DreamStudio,可免费生成 200 张图片,之后需要缴费,这类在线网站对生成的图片的调教功能偏弱,无法批量生成图片,体验着玩玩还行,不适合深度玩耍。
推荐指数:★★★★☆
适用人群:本地电脑无法运行 Stable diffusion 的玩家
如果你本地电脑不满足安装 Stable diffusion 的条件,可以考虑使用云服务器,现在很多云服务器厂商都自带了 Stable diffusion 的镜像,一键启动,非常方便,就是需要一些费用~
这里我们还是白嫖阿里云的机器学习 PAI 平台,使用 A10 显卡,这部分内容之前文章中有介绍。
【注意】:镜像选择选择官方镜像中的 stable-diffusion-webui-env:pytorch1.13-gpu-py310-cu117-ubuntu22.04
环境准备好了以后,就可以开始部署工作了。
【说明】:由于Github访问存在不稳定性,如果运行后未出现正常返回结果且提示网络相关原因,例如:Network is unreachable
、unable to access '``https://github.com/......'
,您可以重新运行命令。
下载源码
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
cd stable-diffusion-webui
git checkout a9fed7c364061ae6efb37f797b6b522cb3cf7aa2
mkdir -p repositories && cd repositories
git clone https://github.com/sczhou/CodeFormer.git
下载常用插件
cd stable-diffusion-webui/extensions
git clone https://gitcode.net/mirrors/DominikDoom/a1111-sd-webui-tagcomplete.git
git clone https://gitcode.net/ranting8323/stable-diffusion-webui-localization-zh_CN
cd ..
wget -c http://pai-vision-data-sh.oss-cn-shanghai.aliyuncs.com/aigc-data/webui_config/config.json
下载 chilloutmix 大模型
cd stable-diffusion-webui/models/Stable-diffusion
wget -c https://huggingface.co/naonovn/chilloutmix_NiPrunedFp32Fix/resolve/main/chilloutmix_NiPrunedFp32Fix.safetensors -O chilloutmix_NiPrunedFp32Fix.safetensors
下载额外模型
cd stable-diffusion-webui/repositories/CodeFormer/weights/facelib
wget -c http://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/EasyCV/datasets/try_on/detection_Resnet50_Final.pth
wget -c http://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/EasyCV/datasets/try_on/parsing_parsenet.pth
mkdir -p stable-diffusion-webui/models/Codeformer
cd stable-diffusion-webui/models/Codeformer
wget -c http://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/EasyCV/datasets/try_on/codeformer-v0.1.0.pth
cd stable-diffusion-webui/embeddings
wget -c http://pai-vision-data-hz.oss-cn-zhangjiakou.aliyuncs.com/EasyCV/datasets/try_on/ng_deepnegative_v1_75t.pt
cd stable-diffusion-webui/models/Lora
wget -c https://huggingface.co/Kanbara/doll-likeness-series/resolve/main/koreanDollLikeness_v10.safetensors
启动服务
cd stable-diffusion-webui
python -m venv --system-site-packages --symlinks venv
sed -i 's/can_run_as_root=0/can_run_as_root=1/g' webui.sh
./webui.sh --no-download-sd-model --xformers
服务启动成功后,左键点击生成的 URL 即可跳转到 WebUI 前端。
# prompt
<lora:koreanDollLikeness_v10:1>
the best quality, ultra-high definition,masterpiece, extreme detail, 8K
1girl, curly hair, detail eyes and mouth, fair skin,big eyes,
white shirt,
street
# negative prompt
(worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), bad anatomy,DeepNegative, skin spots, acnes, skin blemishes,(fat:1.2),facing away, looking away,tilted head, lowres,bad anatomy,bad hands, missing fingers,extra digit, fewer digits,bad feet,poorly drawn hands,poorly drawn face,mutation,deformed,extra fingers,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,missing arms,missing legs,extra digit, extra arms, extra leg, extra foot,teethcroppe,signature, watermark, username,blurry,cropped,jpeg artifacts,text,error,
泰裤辣!
推荐指数:★★★★★
适用人群:本地电脑可以运行 Stable diffusion 的玩家
要在本地顺利运行 Stable diffusion,需要满足如下条件:
以上是最基本的硬件配置。
安装 Python
Python 版本需要 3.10.6,Python 安装可以参考我之前写的这篇。
安装 CUDA
接下来安装 CUDA,CUDA是 Nvidia 显卡的 AI 运算库,Stable diffusion 通过这个库使用显卡资源。命令行输入nvidia-smi
,查看自己显卡支持的版本。
然后去 Nvidia CUDA 官网下载支持的版本。
下载源码
git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
一键启动
这里使用 B 站秋葉的启动器,支持一键启动/修复/更新/模型下载管理,后台回复【qiuye】获取。
运行启动器运行依赖
安装依赖包,解压sd-webui启动器.zip
,将解压后的文件复制到项目源代码目录下,最后运行A启动器
启动项目。
点击一键启动
,耐心等待一段时间,直到看到下图代表启动成功。
细心的朋友会发现上图有报错,说是没找到 checkpoints,其实就是没有对应的大模型,我们回到秋葉的启动器,在模型管理中下载自己喜欢的大模型即可,也可以去 Civitai 网站下载。
耐心等待下载完成。。。
刷新浏览器访问 http://127.0.0.1:7860 即可看到熟悉的界面。
依次点击 Extensions --> Available --> Load from加载插件列表,在搜索框输入cn
搜索语言包,点击安装
下载完成后,选择 setting --> user interface --> localization,选择 zh_CN,点击 Apply settings 按钮应用设置,再点击 Reload UI 刷新页面。
汉化成功~
# prompt
the best quality, ultra-high definition,masterpiece, extreme detail, 8K
1girl, curly hair, detail eyes and mouth, fair skin,big eyes,
white shirt,
street
# negative prompt
(worst quality:2), (low quality:2), (normal quality:2), lowres, ((monochrome)), ((grayscale)), bad anatomy,DeepNegative, skin spots, acnes, skin blemishes,(fat:1.2),facing away, looking away,tilted head, lowres,bad anatomy,bad hands, missing fingers,extra digit, fewer digits,bad feet,poorly drawn hands,poorly drawn face,mutation,deformed,extra fingers,extra limbs,extra arms,extra legs,malformed limbs,fused fingers,too many fingers,long neck,cross-eyed,mutated hands,polar lowres,bad body,bad proportions,gross proportions,missing arms,missing legs,extra digit, extra arms, extra leg, extra foot,teethcroppe,signature, watermark, username,blurry,cropped,jpeg artifacts,text,error,
好了,就到这里,Stable diffusion 的玩法很多,这里只是最基本的文生图功能,就已经很强大了,其他的就交给你们自己去探索吧。
这份完整版的stable diffusion资料我已经打包好,需要的点击下方添加,即可前往免费领取!
随着技术的迭代,目前 Stable Diffusion 已经能够生成非常艺术化的图片了,完全有赶超人类的架势,已经有不少工作被这类服务替代,比如制作一个 logo 图片,画一张虚拟老婆照片,画质堪比相机。
最新 Stable Diffusion 除了有win多个版本,就算说底端的显卡也能玩了哦!此外还带来了Mac版本,仅支持macOS 12.3或更高版本。
我们在学习的时候,往往书籍源码难以理解,阅读困难,这时候视频教程教程是就很适合了,生动形象加上案例实战,一步步带你入坑stable diffusion,科学有趣才能更方便的学习下去。
stable diffusion往往一开始使用时图片等无法达到理想的生成效果,这时则需要通过使用大量训练数据,调整模型的超参数(如学习率、训练轮数、模型大小等),可以使得模型更好地适应数据集,并生成更加真实、准确、高质量的图像。
提示词是构建由文本到图像模型解释和理解的单词的过程。可以把它理解为你告诉 AI 模型要画什么而需要说的语言,整个SD学习过程中都离不开这本提示词手册。
如果你能在15天内完成所有的任务,那你堪称天才。然而,如果你能完成 60-70% 的内容,你就已经开始具备成为一名SD大神的正确特征了。
这份完整版的stable diffusion资料我已经打包好,需要的点击下方添加,即可前往免费领取!
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。