Stable Diffusion

Stable Diffusion

本地CPU部署的stable diffusion webui 环境,本地不受限,还可以生成色图黄图

深度学习马化云 发表了文章 • 0 个评论 • 3524 次浏览 • 2023-04-17 00:27 • 来自相关话题

正常输出,生成图的纹理贴图光线很逼真。





 






需要不断调节词汇(英语),打造你想要的人物设定
 






由于本地使用的词汇不限制,还能够生成细节丰富的黄图。(宅男福音)
提供一个语法给你们用用:prompt: beautiful, masterpiece, best quality, extremely detailed face, perfect lighting, (1girl, solo, 1boy, 1girl, NemoNelly, Slight penetration, lying, on back, spread legs:1.5), street, crowd, ((skinny)), ((puffy eyes)), brown hair, medium hair, cowboy shot, medium breasts, swept bangs, walking, outdoors, sunshine, light_rays, fantasy, rococo, hair_flower,low tied hair, smile, half-closed eyes, dating, (nude), nsfw, (heavy breathing:1.5), tears, crying, blush, wet, sweat, <lora:koreanDollLikeness_v15:0.4>, <lora:povImminentPenetration_ipv1:0>, <lora:breastinclassBetter_v14:0.1>





 
整体来说,现在的AI技术和效果就像跃迁了一个台阶。
  查看全部
正常输出,生成图的纹理贴图光线很逼真。

00015-31697332801.png

 

common_(22).jpeg


需要不断调节词汇(英语),打造你想要的人物设定
 

20230416002.jpg


由于本地使用的词汇不限制,还能够生成细节丰富的黄图。(宅男福音)
提供一个语法给你们用用:
prompt: beautiful, masterpiece, best quality, extremely detailed face, perfect lighting, (1girl, solo, 1boy, 1girl, NemoNelly, Slight penetration, lying, on back, spread legs:1.5), street, crowd, ((skinny)), ((puffy eyes)), brown hair, medium hair, cowboy shot, medium breasts, swept bangs, walking, outdoors, sunshine, light_rays, fantasy, rococo, hair_flower,low tied hair, smile, half-closed eyes, dating, (nude), nsfw, (heavy breathing:1.5), tears, crying, blush, wet, sweat, <lora:koreanDollLikeness_v15:0.4>, <lora:povImminentPenetration_ipv1:0>, <lora:breastinclassBetter_v14:0.1>

20230416001.jpg


 
整体来说,现在的AI技术和效果就像跃迁了一个台阶。
 

Stable Diffusion WebUI 模型下载速度很慢,但挂上梯子后速度狂飙

深度学习马化云 发表了文章 • 0 个评论 • 2822 次浏览 • 2023-04-16 00:38 • 来自相关话题

安装命令:$ git clone https ://github.com/AUTOMATIC1111/stable-diffusion-webui.git

$ cd stable-diffusion-webui

$ git checkout 22bcc7be428c94e9408f589966c2040187245d81

# 我们需要 CPU 版本的 torch
$ export TORCH_COMMAND="pip install torch==1.13.1 torchvision==0.14.1 --index-url https: //download.pytorch.org/whl/cpu"
$ export USE_NNPACK=0

# 前 4 个参数是为了让其运行在 CPU 上, 最后一个参数是让 WebUI 可以远程访问
$ bash webui.sh --skip-torch-cuda-test --no-half --precision full --use-cpu all --listen
不过安装实在太慢了。而且安装好了之后,如果下载模型,还要单独下载,也是奇慢。
 
试了下把梯子代理挂上,模型下载就飞快了





 





 
除了模型,还有一些checkpoint文件
Stable diffusion v1.4
stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt
 
Stable diffusion v1.5
stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt
 
lora模型
koreanDollLikeness_v15.safetensors
 
等等。
  查看全部
安装命令:
$ git clone https ://github.com/AUTOMATIC1111/stable-diffusion-webui.git

$ cd stable-diffusion-webui

$ git checkout 22bcc7be428c94e9408f589966c2040187245d81

# 我们需要 CPU 版本的 torch
$ export TORCH_COMMAND="pip install torch==1.13.1 torchvision==0.14.1 --index-url https: //download.pytorch.org/whl/cpu"
$ export USE_NNPACK=0

# 前 4 个参数是为了让其运行在 CPU 上, 最后一个参数是让 WebUI 可以远程访问
$ bash webui.sh --skip-torch-cuda-test --no-half --precision full --use-cpu all --listen

不过安装实在太慢了。而且安装好了之后,如果下载模型,还要单独下载,也是奇慢。
 
试了下把梯子代理挂上,模型下载就飞快了

20230415005.jpg

 

202304150061.jpg

 
除了模型,还有一些checkpoint文件
Stable diffusion v1.4
stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt
 
Stable diffusion v1.5
stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt
 
lora模型
koreanDollLikeness_v15.safetensors
 
等等。
 

没有显卡GPU,想用CPU玩Stable Diffusion 本地部署AI绘图吗? 手把手保姆教程

深度学习马化云 发表了文章 • 0 个评论 • 1827 次浏览 • 2023-04-15 13:16 • 来自相关话题

 





 





 





 





 
在网上看到那些美cry的AI生成的美女图片 ,你是不是也蠢蠢欲动想要按照自己的想法生成一副属于自己的女神照呢?

什么?你的电脑显卡没有显卡? 没关系,今天笔者带大家手把手在本地电脑上使用CPU部署Stable Diffusion+Lora AI绘画 模型。
 
什么是Stable Diffusion ?

Stable Diffusion 是一种通过文字描述创造出图像的 AI 模型. 它是一个开源软件, 有许多人愿意在网络上免费分享他们的计算资源, 使得新手可以在线尝试.

 
安装

本地部署的 Stable Diffusion 有更高的可玩性, 例如允许您替换模型文件, 细致的调整参数, 以及突破线上服务的道德伦理检查等. 鉴于我目前没有可供霍霍的 GPU, 因此我将在一台本地ubuntu上部署,因为Stable Diffusion 在运行过程中大概需要吃掉 12G 内存。如果你的电脑或者服务器没有16GB以上的内存,需要配置一个虚拟内存来扩展你的内存容量,当然,性能也打个折扣,毕竟是在硬盘上扩展的内存空间。

如果你的电脑内存大小大于16GB,可以忽略以下的操作:$ dd if=/dev/zero of=/mnt/swap bs=64M count=256
$ chmod 0600 /mnt/swap
$ mkswap /mnt/swap
$ swapon /mnt/swap笔者的电脑配置:





 
然后直接安装下载并安装 Stable Diffusion WebUI:
 
稍等片刻(依赖你的网速)





 
由于需要连接到github下载源码,所以如果网络不稳定掉线,需要重新运行安装命令就可以了。
 





 
重新运行:bash webui.sh --skip-torch-cuda-test --no-half --precision full --use-cpu all --listen
这个脚本会自动创建python的虚拟环境,并安装对应的pip依赖,一键到位,可谓贴心。果断要到github上给原作者加星
 





 
等待一段时间, 在浏览器中打开 127.0.0.1:7860 即可见到 UI 界面.
 
 
下载更多模型

模型, 有时称为检查点文件(checkpoint), 是预先训练的 Stable Diffusion 权重, 用于生成一般或特定的图像类型. 模型可以生成的图像取决于用于训练它们的数据. 如果训练数据中没有猫, 模型将无法产生猫的形象. 同样, 如果您仅使用猫图像训练模型, 则只会产生猫.

Stable Diffusion WebUI 运行时会自动下载 Stable Diffusion v1.5 模型. 下面提供了一些快速下载其它模型的命令.$ cd models/Stable-diffusion​# Stable diffusion v1.4
# 下面的URL超链接过长有省略号,需要右键复制url$ wget https://huggingface.co/CompVis ... .ckpt




# Stable diffusion v1.5$ wget https://huggingface.co/runwaym ... .ckpt# F222$ wget https://huggingface.co/acheong ... .ckpt# Anything V3$ wget
https://huggingface.co/Linaqru ... nsors

# Open Journey$ wget https://huggingface.co/prompth ... .ckpt# DreamShaper$ wget https://civitai.com/api/download/models/5636 -O dreamshaper_331BakedVae.safetensors# ChilloutMix$ wget https://civitai.com/api/download/models/11745 -O chilloutmix_NiPrunedFp32Fix.safetensors# Robo Diffusion$ wget
https://huggingface.co/nousr/r ... .ckpt

# Mo-di-diffusion$ wget
https://huggingface.co/nitroso ... .ckpt

# Inkpunk Diffusion$ wget
https://huggingface.co/Envvi/I ... .ckpt

修改配置文件

ui-config.json 内包含众多的设置项, 可按照个人的习惯修改部分默认值. 例如我的配置部分如下:{
"txt2img/Batch size/value": 4,
"txt2img/Width/value": 480,
"txt2img/Height/value": 270
}提示语示例model: chilloutmix_NiPrunedFp32Fix.safetensors

prompt: beautiful, masterpiece, best quality, extremely detailed face, perfect lighting, (1girl, solo, 1boy, 1girl, NemoNelly, Slight penetration, lying, on back, spread legs:1.5), street, crowd, ((skinny)), ((puffy eyes)), brown hair, medium hair, cowboy shot, medium breasts, swept bangs, walking, outdoors, sunshine, light_rays, fantasy, rococo, hair_flower,low tied hair, smile, half-closed eyes, dating, (nude), nsfw, (heavy breathing:1.5), tears, crying, blush, wet, sweat, <lora:koreanDollLikeness_v15:0.4>, <lora:povImminentPenetration_ipv1:0>, <lora:breastinclassBetter_v14:0.1>
prompt: paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, (ugly:1.331), (duplicate:1.331), (morbid:1.21), (mutilated:1.21), (tranny:1.331), mutated hands, (poorly drawn hands:1.331), blurry, (bad anatomy:1.21), (bad proportions:1.331), extra limbs, (disfigured:1.331), (missing arms:1.331), (extra legs:1.331), (fused fingers:1.61051), (too many fingers:1.61051), (unclear eyes:1.331), bad hands, missing fingers, extra digit, bad body, pubic
上述提示词结尾引用了 3 个 Lora 模型, 需提前下载至 models/Lora 目录.$ cd models/Lora

$ wget
https://huggingface.co/amornln ... nsors




$ wget
https://huggingface.co/samle/s ... nsors

$ wget https://huggingface.co/jomcs/N ... nsors生成的效果图:





 
 
  查看全部
v2-6d1a26989d9d1f455abbdaa930f8bae3_r.jpg


v2-3f0519e151bbb99fa49934670ec8d0a4_r.jpg

 

v2-992a54d0863a4b1ab6cacc0fe597d81b_r.jpg

 

20230415001.jpg

 

v2-efee1a21df13b177267f31889efc5b40_r.jpg

 

v2-c2e1a2a3a1b0849b3f2b7efb3083fd6b_r.jpg

 
在网上看到那些美cry的AI生成的美女图片 ,你是不是也蠢蠢欲动想要按照自己的想法生成一副属于自己的女神照呢?

什么?你的电脑显卡没有显卡? 没关系,今天笔者带大家手把手在本地电脑上使用CPU部署Stable Diffusion+Lora AI绘画 模型。
 
什么是Stable Diffusion ?


Stable Diffusion 是一种通过文字描述创造出图像的 AI 模型. 它是一个开源软件, 有许多人愿意在网络上免费分享他们的计算资源, 使得新手可以在线尝试.


 
安装

本地部署的 Stable Diffusion 有更高的可玩性, 例如允许您替换模型文件, 细致的调整参数, 以及突破线上服务的道德伦理检查等. 鉴于我目前没有可供霍霍的 GPU, 因此我将在一台本地ubuntu上部署,因为Stable Diffusion 在运行过程中大概需要吃掉 12G 内存。如果你的电脑或者服务器没有16GB以上的内存,需要配置一个虚拟内存来扩展你的内存容量,当然,性能也打个折扣,毕竟是在硬盘上扩展的内存空间。

如果你的电脑内存大小大于16GB,可以忽略以下的操作:
$ dd if=/dev/zero of=/mnt/swap bs=64M count=256
$ chmod 0600 /mnt/swap
$ mkswap /mnt/swap
$ swapon /mnt/swap
笔者的电脑配置:

20230415004.jpg

 
然后直接安装下载并安装 Stable Diffusion WebUI:
 
稍等片刻(依赖你的网速)

20230415002.jpg

 
由于需要连接到github下载源码,所以如果网络不稳定掉线,需要重新运行安装命令就可以了。
 

20230415003.jpg

 
重新运行:
bash webui.sh --skip-torch-cuda-test --no-half --precision full --use-cpu all --listen

这个脚本会自动创建python的虚拟环境,并安装对应的pip依赖,一键到位,可谓贴心。果断要到github上给原作者加星
 

v2-a85a91949b0f08315abd104425ecf7ee_r-v1.jpg

 
等待一段时间, 在浏览器中打开 127.0.0.1:7860 即可见到 UI 界面.
 
 
下载更多模型

模型, 有时称为检查点文件(checkpoint), 是预先训练的 Stable Diffusion 权重, 用于生成一般或特定的图像类型. 模型可以生成的图像取决于用于训练它们的数据. 如果训练数据中没有猫, 模型将无法产生猫的形象. 同样, 如果您仅使用猫图像训练模型, 则只会产生猫.

Stable Diffusion WebUI 运行时会自动下载 Stable Diffusion v1.5 模型. 下面提供了一些快速下载其它模型的命令.
$ cd models/Stable-diffusion​
# Stable diffusion v1.4
# 下面的URL超链接过长有省略号,需要右键复制url
$ wget https://huggingface.co/CompVis ... .ckpt




# Stable diffusion v1.5
$ wget https://huggingface.co/runwaym ... .ckpt
# F222
$ wget https://huggingface.co/acheong ... .ckpt
# Anything V3
$ wget 
https://huggingface.co/Linaqru ... nsors

# Open Journey
$ wget https://huggingface.co/prompth ... .ckpt
# DreamShaper
$ wget https://civitai.com/api/download/models/5636 -O dreamshaper_331BakedVae.safetensors
# ChilloutMix
$ wget https://civitai.com/api/download/models/11745 -O chilloutmix_NiPrunedFp32Fix.safetensors
# Robo Diffusion
$ wget 
https://huggingface.co/nousr/r ... .ckpt

# Mo-di-diffusion
$ wget 
https://huggingface.co/nitroso ... .ckpt

# Inkpunk Diffusion
$ wget 
https://huggingface.co/Envvi/I ... .ckpt

修改配置文件

ui-config.json 内包含众多的设置项, 可按照个人的习惯修改部分默认值. 例如我的配置部分如下:
{
"txt2img/Batch size/value": 4,
"txt2img/Width/value": 480,
"txt2img/Height/value": 270
}
提示语示例
model: chilloutmix_NiPrunedFp32Fix.safetensors

prompt: beautiful, masterpiece, best quality, extremely detailed face, perfect lighting, (1girl, solo, 1boy, 1girl, NemoNelly, Slight penetration, lying, on back, spread legs:1.5), street, crowd, ((skinny)), ((puffy eyes)), brown hair, medium hair, cowboy shot, medium breasts, swept bangs, walking, outdoors, sunshine, light_rays, fantasy, rococo, hair_flower,low tied hair, smile, half-closed eyes, dating, (nude), nsfw, (heavy breathing:1.5), tears, crying, blush, wet, sweat, <lora:koreanDollLikeness_v15:0.4>, <lora:povImminentPenetration_ipv1:0>, <lora:breastinclassBetter_v14:0.1>
prompt: paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, (ugly:1.331), (duplicate:1.331), (morbid:1.21), (mutilated:1.21), (tranny:1.331), mutated hands, (poorly drawn hands:1.331), blurry, (bad anatomy:1.21), (bad proportions:1.331), extra limbs, (disfigured:1.331), (missing arms:1.331), (extra legs:1.331), (fused fingers:1.61051), (too many fingers:1.61051), (unclear eyes:1.331), bad hands, missing fingers, extra digit, bad body, pubic

上述提示词结尾引用了 3 个 Lora 模型, 需提前下载至 models/Lora 目录.
$ cd models/Lora

$ wget
https://huggingface.co/amornln ... nsors




$ wget 
https://huggingface.co/samle/s ... nsors

$ wget https://huggingface.co/jomcs/N ... nsors
生成的效果图:

11102.png

 
 
 

本地CPU部署的stable diffusion webui 环境,本地不受限,还可以生成色图黄图

深度学习马化云 发表了文章 • 0 个评论 • 3524 次浏览 • 2023-04-17 00:27 • 来自相关话题

正常输出,生成图的纹理贴图光线很逼真。





 






需要不断调节词汇(英语),打造你想要的人物设定
 






由于本地使用的词汇不限制,还能够生成细节丰富的黄图。(宅男福音)
提供一个语法给你们用用:prompt: beautiful, masterpiece, best quality, extremely detailed face, perfect lighting, (1girl, solo, 1boy, 1girl, NemoNelly, Slight penetration, lying, on back, spread legs:1.5), street, crowd, ((skinny)), ((puffy eyes)), brown hair, medium hair, cowboy shot, medium breasts, swept bangs, walking, outdoors, sunshine, light_rays, fantasy, rococo, hair_flower,low tied hair, smile, half-closed eyes, dating, (nude), nsfw, (heavy breathing:1.5), tears, crying, blush, wet, sweat, <lora:koreanDollLikeness_v15:0.4>, <lora:povImminentPenetration_ipv1:0>, <lora:breastinclassBetter_v14:0.1>





 
整体来说,现在的AI技术和效果就像跃迁了一个台阶。
  查看全部
正常输出,生成图的纹理贴图光线很逼真。

00015-31697332801.png

 

common_(22).jpeg


需要不断调节词汇(英语),打造你想要的人物设定
 

20230416002.jpg


由于本地使用的词汇不限制,还能够生成细节丰富的黄图。(宅男福音)
提供一个语法给你们用用:
prompt: beautiful, masterpiece, best quality, extremely detailed face, perfect lighting, (1girl, solo, 1boy, 1girl, NemoNelly, Slight penetration, lying, on back, spread legs:1.5), street, crowd, ((skinny)), ((puffy eyes)), brown hair, medium hair, cowboy shot, medium breasts, swept bangs, walking, outdoors, sunshine, light_rays, fantasy, rococo, hair_flower,low tied hair, smile, half-closed eyes, dating, (nude), nsfw, (heavy breathing:1.5), tears, crying, blush, wet, sweat, <lora:koreanDollLikeness_v15:0.4>, <lora:povImminentPenetration_ipv1:0>, <lora:breastinclassBetter_v14:0.1>

20230416001.jpg


 
整体来说,现在的AI技术和效果就像跃迁了一个台阶。
 

本地CPU部署的stable diffusion webui 环境,本地不受限,还可以生成色图黄图

深度学习马化云 发表了文章 • 0 个评论 • 3524 次浏览 • 2023-04-17 00:27 • 来自相关话题

正常输出,生成图的纹理贴图光线很逼真。





 






需要不断调节词汇(英语),打造你想要的人物设定
 






由于本地使用的词汇不限制,还能够生成细节丰富的黄图。(宅男福音)
提供一个语法给你们用用:prompt: beautiful, masterpiece, best quality, extremely detailed face, perfect lighting, (1girl, solo, 1boy, 1girl, NemoNelly, Slight penetration, lying, on back, spread legs:1.5), street, crowd, ((skinny)), ((puffy eyes)), brown hair, medium hair, cowboy shot, medium breasts, swept bangs, walking, outdoors, sunshine, light_rays, fantasy, rococo, hair_flower,low tied hair, smile, half-closed eyes, dating, (nude), nsfw, (heavy breathing:1.5), tears, crying, blush, wet, sweat, <lora:koreanDollLikeness_v15:0.4>, <lora:povImminentPenetration_ipv1:0>, <lora:breastinclassBetter_v14:0.1>





 
整体来说,现在的AI技术和效果就像跃迁了一个台阶。
  查看全部
正常输出,生成图的纹理贴图光线很逼真。

00015-31697332801.png

 

common_(22).jpeg


需要不断调节词汇(英语),打造你想要的人物设定
 

20230416002.jpg


由于本地使用的词汇不限制,还能够生成细节丰富的黄图。(宅男福音)
提供一个语法给你们用用:
prompt: beautiful, masterpiece, best quality, extremely detailed face, perfect lighting, (1girl, solo, 1boy, 1girl, NemoNelly, Slight penetration, lying, on back, spread legs:1.5), street, crowd, ((skinny)), ((puffy eyes)), brown hair, medium hair, cowboy shot, medium breasts, swept bangs, walking, outdoors, sunshine, light_rays, fantasy, rococo, hair_flower,low tied hair, smile, half-closed eyes, dating, (nude), nsfw, (heavy breathing:1.5), tears, crying, blush, wet, sweat, <lora:koreanDollLikeness_v15:0.4>, <lora:povImminentPenetration_ipv1:0>, <lora:breastinclassBetter_v14:0.1>

20230416001.jpg


 
整体来说,现在的AI技术和效果就像跃迁了一个台阶。
 

Stable Diffusion WebUI 模型下载速度很慢,但挂上梯子后速度狂飙

深度学习马化云 发表了文章 • 0 个评论 • 2822 次浏览 • 2023-04-16 00:38 • 来自相关话题

安装命令:$ git clone https ://github.com/AUTOMATIC1111/stable-diffusion-webui.git

$ cd stable-diffusion-webui

$ git checkout 22bcc7be428c94e9408f589966c2040187245d81

# 我们需要 CPU 版本的 torch
$ export TORCH_COMMAND="pip install torch==1.13.1 torchvision==0.14.1 --index-url https: //download.pytorch.org/whl/cpu"
$ export USE_NNPACK=0

# 前 4 个参数是为了让其运行在 CPU 上, 最后一个参数是让 WebUI 可以远程访问
$ bash webui.sh --skip-torch-cuda-test --no-half --precision full --use-cpu all --listen
不过安装实在太慢了。而且安装好了之后,如果下载模型,还要单独下载,也是奇慢。
 
试了下把梯子代理挂上,模型下载就飞快了





 





 
除了模型,还有一些checkpoint文件
Stable diffusion v1.4
stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt
 
Stable diffusion v1.5
stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt
 
lora模型
koreanDollLikeness_v15.safetensors
 
等等。
  查看全部
安装命令:
$ git clone https ://github.com/AUTOMATIC1111/stable-diffusion-webui.git

$ cd stable-diffusion-webui

$ git checkout 22bcc7be428c94e9408f589966c2040187245d81

# 我们需要 CPU 版本的 torch
$ export TORCH_COMMAND="pip install torch==1.13.1 torchvision==0.14.1 --index-url https: //download.pytorch.org/whl/cpu"
$ export USE_NNPACK=0

# 前 4 个参数是为了让其运行在 CPU 上, 最后一个参数是让 WebUI 可以远程访问
$ bash webui.sh --skip-torch-cuda-test --no-half --precision full --use-cpu all --listen

不过安装实在太慢了。而且安装好了之后,如果下载模型,还要单独下载,也是奇慢。
 
试了下把梯子代理挂上,模型下载就飞快了

20230415005.jpg

 

202304150061.jpg

 
除了模型,还有一些checkpoint文件
Stable diffusion v1.4
stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt
 
Stable diffusion v1.5
stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt
 
lora模型
koreanDollLikeness_v15.safetensors
 
等等。
 

没有显卡GPU,想用CPU玩Stable Diffusion 本地部署AI绘图吗? 手把手保姆教程

深度学习马化云 发表了文章 • 0 个评论 • 1827 次浏览 • 2023-04-15 13:16 • 来自相关话题

 





 





 





 





 
在网上看到那些美cry的AI生成的美女图片 ,你是不是也蠢蠢欲动想要按照自己的想法生成一副属于自己的女神照呢?

什么?你的电脑显卡没有显卡? 没关系,今天笔者带大家手把手在本地电脑上使用CPU部署Stable Diffusion+Lora AI绘画 模型。
 
什么是Stable Diffusion ?

Stable Diffusion 是一种通过文字描述创造出图像的 AI 模型. 它是一个开源软件, 有许多人愿意在网络上免费分享他们的计算资源, 使得新手可以在线尝试.

 
安装

本地部署的 Stable Diffusion 有更高的可玩性, 例如允许您替换模型文件, 细致的调整参数, 以及突破线上服务的道德伦理检查等. 鉴于我目前没有可供霍霍的 GPU, 因此我将在一台本地ubuntu上部署,因为Stable Diffusion 在运行过程中大概需要吃掉 12G 内存。如果你的电脑或者服务器没有16GB以上的内存,需要配置一个虚拟内存来扩展你的内存容量,当然,性能也打个折扣,毕竟是在硬盘上扩展的内存空间。

如果你的电脑内存大小大于16GB,可以忽略以下的操作:$ dd if=/dev/zero of=/mnt/swap bs=64M count=256
$ chmod 0600 /mnt/swap
$ mkswap /mnt/swap
$ swapon /mnt/swap笔者的电脑配置:





 
然后直接安装下载并安装 Stable Diffusion WebUI:
 
稍等片刻(依赖你的网速)





 
由于需要连接到github下载源码,所以如果网络不稳定掉线,需要重新运行安装命令就可以了。
 





 
重新运行:bash webui.sh --skip-torch-cuda-test --no-half --precision full --use-cpu all --listen
这个脚本会自动创建python的虚拟环境,并安装对应的pip依赖,一键到位,可谓贴心。果断要到github上给原作者加星
 





 
等待一段时间, 在浏览器中打开 127.0.0.1:7860 即可见到 UI 界面.
 
 
下载更多模型

模型, 有时称为检查点文件(checkpoint), 是预先训练的 Stable Diffusion 权重, 用于生成一般或特定的图像类型. 模型可以生成的图像取决于用于训练它们的数据. 如果训练数据中没有猫, 模型将无法产生猫的形象. 同样, 如果您仅使用猫图像训练模型, 则只会产生猫.

Stable Diffusion WebUI 运行时会自动下载 Stable Diffusion v1.5 模型. 下面提供了一些快速下载其它模型的命令.$ cd models/Stable-diffusion​# Stable diffusion v1.4
# 下面的URL超链接过长有省略号,需要右键复制url$ wget https://huggingface.co/CompVis ... .ckpt




# Stable diffusion v1.5$ wget https://huggingface.co/runwaym ... .ckpt# F222$ wget https://huggingface.co/acheong ... .ckpt# Anything V3$ wget
https://huggingface.co/Linaqru ... nsors

# Open Journey$ wget https://huggingface.co/prompth ... .ckpt# DreamShaper$ wget https://civitai.com/api/download/models/5636 -O dreamshaper_331BakedVae.safetensors# ChilloutMix$ wget https://civitai.com/api/download/models/11745 -O chilloutmix_NiPrunedFp32Fix.safetensors# Robo Diffusion$ wget
https://huggingface.co/nousr/r ... .ckpt

# Mo-di-diffusion$ wget
https://huggingface.co/nitroso ... .ckpt

# Inkpunk Diffusion$ wget
https://huggingface.co/Envvi/I ... .ckpt

修改配置文件

ui-config.json 内包含众多的设置项, 可按照个人的习惯修改部分默认值. 例如我的配置部分如下:{
"txt2img/Batch size/value": 4,
"txt2img/Width/value": 480,
"txt2img/Height/value": 270
}提示语示例model: chilloutmix_NiPrunedFp32Fix.safetensors

prompt: beautiful, masterpiece, best quality, extremely detailed face, perfect lighting, (1girl, solo, 1boy, 1girl, NemoNelly, Slight penetration, lying, on back, spread legs:1.5), street, crowd, ((skinny)), ((puffy eyes)), brown hair, medium hair, cowboy shot, medium breasts, swept bangs, walking, outdoors, sunshine, light_rays, fantasy, rococo, hair_flower,low tied hair, smile, half-closed eyes, dating, (nude), nsfw, (heavy breathing:1.5), tears, crying, blush, wet, sweat, <lora:koreanDollLikeness_v15:0.4>, <lora:povImminentPenetration_ipv1:0>, <lora:breastinclassBetter_v14:0.1>
prompt: paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, (ugly:1.331), (duplicate:1.331), (morbid:1.21), (mutilated:1.21), (tranny:1.331), mutated hands, (poorly drawn hands:1.331), blurry, (bad anatomy:1.21), (bad proportions:1.331), extra limbs, (disfigured:1.331), (missing arms:1.331), (extra legs:1.331), (fused fingers:1.61051), (too many fingers:1.61051), (unclear eyes:1.331), bad hands, missing fingers, extra digit, bad body, pubic
上述提示词结尾引用了 3 个 Lora 模型, 需提前下载至 models/Lora 目录.$ cd models/Lora

$ wget
https://huggingface.co/amornln ... nsors




$ wget
https://huggingface.co/samle/s ... nsors

$ wget https://huggingface.co/jomcs/N ... nsors生成的效果图:





 
 
  查看全部
v2-6d1a26989d9d1f455abbdaa930f8bae3_r.jpg


v2-3f0519e151bbb99fa49934670ec8d0a4_r.jpg

 

v2-992a54d0863a4b1ab6cacc0fe597d81b_r.jpg

 

20230415001.jpg

 

v2-efee1a21df13b177267f31889efc5b40_r.jpg

 

v2-c2e1a2a3a1b0849b3f2b7efb3083fd6b_r.jpg

 
在网上看到那些美cry的AI生成的美女图片 ,你是不是也蠢蠢欲动想要按照自己的想法生成一副属于自己的女神照呢?

什么?你的电脑显卡没有显卡? 没关系,今天笔者带大家手把手在本地电脑上使用CPU部署Stable Diffusion+Lora AI绘画 模型。
 
什么是Stable Diffusion ?


Stable Diffusion 是一种通过文字描述创造出图像的 AI 模型. 它是一个开源软件, 有许多人愿意在网络上免费分享他们的计算资源, 使得新手可以在线尝试.


 
安装

本地部署的 Stable Diffusion 有更高的可玩性, 例如允许您替换模型文件, 细致的调整参数, 以及突破线上服务的道德伦理检查等. 鉴于我目前没有可供霍霍的 GPU, 因此我将在一台本地ubuntu上部署,因为Stable Diffusion 在运行过程中大概需要吃掉 12G 内存。如果你的电脑或者服务器没有16GB以上的内存,需要配置一个虚拟内存来扩展你的内存容量,当然,性能也打个折扣,毕竟是在硬盘上扩展的内存空间。

如果你的电脑内存大小大于16GB,可以忽略以下的操作:
$ dd if=/dev/zero of=/mnt/swap bs=64M count=256
$ chmod 0600 /mnt/swap
$ mkswap /mnt/swap
$ swapon /mnt/swap
笔者的电脑配置:

20230415004.jpg

 
然后直接安装下载并安装 Stable Diffusion WebUI:
 
稍等片刻(依赖你的网速)

20230415002.jpg

 
由于需要连接到github下载源码,所以如果网络不稳定掉线,需要重新运行安装命令就可以了。
 

20230415003.jpg

 
重新运行:
bash webui.sh --skip-torch-cuda-test --no-half --precision full --use-cpu all --listen

这个脚本会自动创建python的虚拟环境,并安装对应的pip依赖,一键到位,可谓贴心。果断要到github上给原作者加星
 

v2-a85a91949b0f08315abd104425ecf7ee_r-v1.jpg

 
等待一段时间, 在浏览器中打开 127.0.0.1:7860 即可见到 UI 界面.
 
 
下载更多模型

模型, 有时称为检查点文件(checkpoint), 是预先训练的 Stable Diffusion 权重, 用于生成一般或特定的图像类型. 模型可以生成的图像取决于用于训练它们的数据. 如果训练数据中没有猫, 模型将无法产生猫的形象. 同样, 如果您仅使用猫图像训练模型, 则只会产生猫.

Stable Diffusion WebUI 运行时会自动下载 Stable Diffusion v1.5 模型. 下面提供了一些快速下载其它模型的命令.
$ cd models/Stable-diffusion​
# Stable diffusion v1.4
# 下面的URL超链接过长有省略号,需要右键复制url
$ wget https://huggingface.co/CompVis ... .ckpt




# Stable diffusion v1.5
$ wget https://huggingface.co/runwaym ... .ckpt
# F222
$ wget https://huggingface.co/acheong ... .ckpt
# Anything V3
$ wget 
https://huggingface.co/Linaqru ... nsors

# Open Journey
$ wget https://huggingface.co/prompth ... .ckpt
# DreamShaper
$ wget https://civitai.com/api/download/models/5636 -O dreamshaper_331BakedVae.safetensors
# ChilloutMix
$ wget https://civitai.com/api/download/models/11745 -O chilloutmix_NiPrunedFp32Fix.safetensors
# Robo Diffusion
$ wget 
https://huggingface.co/nousr/r ... .ckpt

# Mo-di-diffusion
$ wget 
https://huggingface.co/nitroso ... .ckpt

# Inkpunk Diffusion
$ wget 
https://huggingface.co/Envvi/I ... .ckpt

修改配置文件

ui-config.json 内包含众多的设置项, 可按照个人的习惯修改部分默认值. 例如我的配置部分如下:
{
"txt2img/Batch size/value": 4,
"txt2img/Width/value": 480,
"txt2img/Height/value": 270
}
提示语示例
model: chilloutmix_NiPrunedFp32Fix.safetensors

prompt: beautiful, masterpiece, best quality, extremely detailed face, perfect lighting, (1girl, solo, 1boy, 1girl, NemoNelly, Slight penetration, lying, on back, spread legs:1.5), street, crowd, ((skinny)), ((puffy eyes)), brown hair, medium hair, cowboy shot, medium breasts, swept bangs, walking, outdoors, sunshine, light_rays, fantasy, rococo, hair_flower,low tied hair, smile, half-closed eyes, dating, (nude), nsfw, (heavy breathing:1.5), tears, crying, blush, wet, sweat, <lora:koreanDollLikeness_v15:0.4>, <lora:povImminentPenetration_ipv1:0>, <lora:breastinclassBetter_v14:0.1>
prompt: paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, normal quality, ((monochrome)), ((grayscale)), skin spots, acnes, skin blemishes, age spot, (ugly:1.331), (duplicate:1.331), (morbid:1.21), (mutilated:1.21), (tranny:1.331), mutated hands, (poorly drawn hands:1.331), blurry, (bad anatomy:1.21), (bad proportions:1.331), extra limbs, (disfigured:1.331), (missing arms:1.331), (extra legs:1.331), (fused fingers:1.61051), (too many fingers:1.61051), (unclear eyes:1.331), bad hands, missing fingers, extra digit, bad body, pubic

上述提示词结尾引用了 3 个 Lora 模型, 需提前下载至 models/Lora 目录.
$ cd models/Lora

$ wget
https://huggingface.co/amornln ... nsors




$ wget 
https://huggingface.co/samle/s ... nsors

$ wget https://huggingface.co/jomcs/N ... nsors
生成的效果图:

11102.png

 
 
 
  AI绘图