一键部署中文文生图模型(太乙Stable Diffusion在webui)

SD指南1年前 (2023)发布 一起用AI
911 0 0

前言

中文意境,运笔而生。

相关报道:

以梦为马

一键部署中文文生图模型(太乙Stable Diffusion在webui)

Prompt:

宇航员骑着马, 一匹白色的马, 在太空, 遥望地球, 4k壁纸, 插画

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 382472925, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

更多的prompt可以参考:太乙绘画使用手册1.1

一键部署

本文基于 太乙 Taiyi-Stable-Diffusion-1B-Chinese-v0.1:

但是很多同学没有办法用上我们的模型,所以我们做了一个一键部署webui的脚本:

感谢

https://github.com/IDEA-CCNL/stable-diffusion-webuigithub.com/IDEA-CCNL/stable-diffusion-webui

测试环境:Linux服务器。测试环境:Linux服务器。

第一步

因为原生的webui只支持中文,所以我们需要用到 封神榜 团队做的webui:

git clone https://github.com/IDEA-CCNL/stable-diffusion-webui.gitcd stable-diffusion-webui

第二步

一键配置相关环境

bash webui.sh

这一步会需要一些时间,因为会安装非常多相关的python库等。(下载模型的时候,会需要一些时间,因为我们的模型有7GB)

中间会询问,是不是需要下载:

一键部署中文文生图模型(太乙Stable Diffusion在webui)

我选了1,下载。

我的输出是这样的:

################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################

################################################################
Running on wangjunjie user
################################################################

################################################################
Repo already cloned, using it as install directory
################################################################

################################################################
Create and activate python venv
################################################################

################################################################
Launching launch.py…
################################################################
Python 3.9.12 (main, Jun 1 2022, 11:38:51)
[GCC 7.5.0]
Commit hash: fa2990b8fbf068c79a5d6a4fbef57e662e2747ef
Installing torch and torchvision
Installing gfpgan
Installing clip
Cloning Stable Diffusion into repositories/stable-diffusion…
Cloning Taming Transformers into repositories/taming-transformers…
Cloning K-diffusion into repositories/k-diffusion…
Cloning CodeFormer into repositories/CodeFormer…
Cloning BLIP into repositories/BLIP…
Installing requirements for CodeFormer
Installing requirements for Web UI
Cloning taiyi_model into repositories/Taiyi-Stable-Diffusion-1B-Chinese-v0.1…
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Obtaining file:///your/path/projects/webui/stable-diffusion-webui
ERROR: file:///your/path/projects/webui/stable-diffusion-webui does not appear to be a Python project: neither setup.py nor pyproject.toml found.
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the /your/path/projects/webui/stable-diffusion-webui/venv/bin/python3 -m pip install –upgrade pip command.
Launching Web UI with arguments: –ckpt /your/path/projects/webui/stable-diffusion-webui/repositories/Taiyi-Stable-Diffusion-1B-Chinese-v0.1/Taiyi-Stable-Diffusion-1B-Chinese-v0.1.ckpt –listen –port 12345
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type vanilla with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type vanilla with 512 in_channels
Loading weights [e2e75020] from /your/path/projects/webui/stable-diffusion-webui/repositories/Taiyi-Stable-Diffusion-1B-Chinese-v0.1/Taiyi-Stable-Diffusion-1B-Chinese-v0.1.ckpt
Applying cross attention optimization (Doggettx).
Model loaded.
Loaded a total of 0 textual inversion embeddings.
Embeddings:
Traceback (most recent call last):
File “/your/path/projects/webui/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/networking.py”, line 120, in start_server
s.bind((LOCALHOST_NAME, server_port))
OSError: [Errno 98] Address already in use

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/your/path/projects/webui/stable-diffusion-webui/launch.py”, line 280, in <module>
start()
File “/your/path/projects/webui/stable-diffusion-webui/launch.py”, line 274, in start
webui.webui()
File “/your/path/projects/webui/stable-diffusion-webui/webui.py”, line 151, in webui
app, local_url, share_url = demo.launch(
File “/your/path/projects/webui/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/blocks.py”, line 1255, in launch
server_name, server_port, local_url, app, server = networking.start_server(
File “/your/path/projects/webui/stable-diffusion-webui/venv/lib/python3.9/site-packages/gradio/networking.py”, line 123, in start_server
raise OSError(
OSError: Port 12345 is in use. If a gradio.Blocks is running on the port, you can close() it or gradio.close_all().

我这属于是端口12345给占用了。。。

第三步

运行!

我把端口改到了23333。

bash webui.sh –ckpt repositories/Taiyi-Stable-Diffusion-1B-Chinese-v0.1/Taiyi-Stable-Diffusion-1B-Chinese-v0.1.ckpt –listen –port23333

这样,你的webui就会开放在 服务器的 23333 端口了。我通过vscode做了一个端口转发出来。

一键部署中文文生图模型(太乙Stable Diffusion在webui)

打开之后:

一键部署中文文生图模型(太乙Stable Diffusion在webui)

中文界面

找到settings

找到User interface,下面有一个Localization (requires restart)

把选项切换到zh_CN

划到最上面点击apply settings

再划到最下面,点击

Restart Gradio and Refresh components (Custom Scripts,ui.py, js and css only)

一键部署中文文生图模型(太乙Stable Diffusion在webui)

这时候界面会重新加载,重新加载完了以后就汉化好了(要是宕机了,提示你端口被占用,你就再启动换一个端口就行了。当然,你也可以直接修改config.json)

一键部署中文文生图模型(太乙Stable Diffusion在webui)

生成图片

东临碣石, 以观沧海, 波涛汹涌, 插画

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 4144539673, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

一键部署中文文生图模型(太乙Stable Diffusion在webui)

飞流直下三千尺, 疑是银河落九天, 瀑布, 银河, 插画

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 3180131548, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

一键部署中文文生图模型(太乙Stable Diffusion在webui)

科幻, 外星文明, 建筑, 4k壁纸

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 1405117145, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

赛博朋克, 中国都市, 霓虹, 4k壁纸

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 3723781975, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

一键部署中文文生图模型(太乙Stable Diffusion在webui)

日出, 港口, 油画, 4k壁纸

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 203749013, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

一键部署中文文生图模型(太乙Stable Diffusion在webui)

春天, 花朵漫山遍野, 蓝色的天空, 樱花, 4k壁纸, 插画

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 2357673386, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

我试了试歌词:

缓缓飘落的枫叶想思念, 4k壁纸

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: Euler a, CFG scale: 7, Seed: 255431060, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

一键部署中文文生图模型(太乙Stable Diffusion在webui)

深圳, 4k壁纸, 油画

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: Euler a, CFG scale: 7, Seed: 3309030834, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

一键部署中文文生图模型(太乙Stable Diffusion在webui)

试一下抽象点的:

未来派的精美激光追踪, 4k壁纸, 水彩画

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 1042635182, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

画画可以咋样呢?

一个丰盛的水果篮放在桌子上, 4k壁纸, 油画

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 3021332111, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

一辆汽车, 波普艺术, 4k壁纸, 插画

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 2577380388, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

一些抑郁的向日葵, 在花瓶里, 4k壁纸, 油画

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: PLMS, CFG scale: 7, Seed: 522521927, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

做ppt我想搞个插图:

神经网络, 人工智能, 插画

Negative prompt: 广告, nsfw, 水印, 素材, 新闻, 报道, 资讯, 图片, ,

Steps: 24, Sampler: DDIM, CFG scale: 7, Seed: 1981883095, Size: 832×448, Model hash: e2e75020, Batch size: 6, Batch pos: 0

还有一件事

上面还是太乙stable diffusion的0.1版本哦。

我们很快会推出下一个版本的stable diffusion~

预告一下,相当好玩~

© 版权声明

相关文章