chengzhuo commited on
Commit
9ca2ae8
1 Parent(s): 45b75a3

Upload sdwebUI.ipynb

Browse files
Files changed (1) hide show
  1. sdwebUI.ipynb +245 -0
sdwebUI.ipynb ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {
6
+ "id": "TcLs4cdaLCtB"
7
+ },
8
+ "source": [
9
+ "# 配置项 (修改这里的内容后直接启动就行了 run all 或者save version都可以)\n",
10
+ "\n",
11
+ "---\n",
12
+ "\n",
13
+ "**主要逻辑已经分离出去了,当有更新时也不需要更新这个文件**\n",
14
+ "- 所有的模型列表都支持填文件、文件夹、下载地址\n",
15
+ "- **如果需要在google colab运行**\n",
16
+ " 1. 改好这个文件后下载下来\n",
17
+ " 2. 在cloab新建一个脚本,然后上传这个文件\n",
18
+ " 3. 新建单元格后填入```%run sdwui-before.ipynb```,然后直接执行新建的单元格。注意: sdwui-before.ipynb 需要替换成你上传时的文件名"
19
+ ]
20
+ },
21
+ {
22
+ "cell_type": "code",
23
+ "execution_count": null,
24
+ "metadata": {
25
+ "id": "swzyZ1_gLCs_",
26
+ "trusted": true
27
+ },
28
+ "outputs": [],
29
+ "source": [
30
+ "useGooglrDrive = True # 连接到谷歌云盘 在google colab环境才能开启"
31
+ ]
32
+ },
33
+ {
34
+ "cell_type": "code",
35
+ "execution_count": null,
36
+ "metadata": {
37
+ "id": "7tTWVxHDLCtB",
38
+ "trusted": true
39
+ },
40
+ "outputs": [],
41
+ "source": [
42
+ "# 模型列表 一行一个 可以填文件 文件夹 和下载地址,如果需要自定义文件名,在url前写上文件名加:\n",
43
+ "模型列表 = '''\n",
44
+ "https://civitai.com/api/download/models/75587\n",
45
+ "https://civitai.com/api/download/models/102222\n",
46
+ "'''\n",
47
+ "# 启动时默认加载的模型名称\n",
48
+ "usedCkpt = 'mg-Tender'\n",
49
+ "VAE列表 = '''\n",
50
+ "https://huggingface.co/stabilityai/sd-vae-ft-ema-original/resolve/main/vae-ft-ema-560000-ema-pruned.safetensors\n",
51
+ "https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors\n",
52
+ "https://huggingface.co/WarriorMama777/OrangeMixs/resolve/main/VAEs/orangemix.vae.pt\n",
53
+ "'''\n",
54
+ "Lora列表 = '''\n",
55
+ "https://civitai.com/api/download/models/14856\n",
56
+ "https://civitai.com/api/download/models/13169\n",
57
+ "'''\n",
58
+ "LyCORIS列表 = '''\n",
59
+ "https://civitai.com/api/download/models/46821\n",
60
+ "'''\n",
61
+ "hypernetworks列表 = '''\n",
62
+ "\n",
63
+ "'''\n",
64
+ "embeddings列表 = '''\n",
65
+ "https://civitai.com/api/download/models/60938\n",
66
+ "\n",
67
+ "'''\n",
68
+ "controlNet模型列表 = '''\n",
69
+ "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_canny-fp16.safetensors\n",
70
+ "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_depth-fp16.safetensors\n",
71
+ "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_hed-fp16.safetensors\n",
72
+ "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_mlsd-fp16.safetensors\n",
73
+ "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_normal-fp16.safetensors\n",
74
+ "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_openpose-fp16.safetensors\n",
75
+ "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_scribble-fp16.safetensors\n",
76
+ "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_seg-fp16.safetensors\n",
77
+ "'''\n",
78
+ "# git仓库\n",
79
+ "插件列表='''\n",
80
+ "https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN.git\n",
81
+ "https://github.com/AlUlkesh/stable-diffusion-webui-images-browser.git\n",
82
+ "https://github.com/DominikDoom/a1111-sd-webui-tagcomplete.git\n",
83
+ "https://github.com/Mikubill/sd-webui-controlnet.git\n",
84
+ "https://github.com/KohakuBlueleaf/a1111-sd-webui-lycoris.git\n",
85
+ "https://github.com/LianZiZhou/sd-webui-pixink-console.git\n",
86
+ "https://github.com/ilian6806/stable-diffusion-webui-state.git\n",
87
+ "https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111.git\n",
88
+ "https://github.com/Bing-su/adetailer.git\n",
89
+ "https://github.com/viyiviyi/filter-empty-prompts.git\n",
90
+ "https://github.com/civitai/sd_civitai_extension.git\n",
91
+ "https://github.com/zanllp/sd-webui-infinite-image-browsing.git\n",
92
+ "'''\n",
93
+ "#文件或直接填配置\n",
94
+ "ngrok配置或文件地址='''\n",
95
+ "/kaggle/input/configs/ngrok_token.txt\n",
96
+ "'''\n",
97
+ "frp配置文件或配置='''\n",
98
+ "-f **************************:7691619\n",
99
+ "'''\n",
100
+ "frpSSL文件='''\n",
101
+ "\n",
102
+ "'''\n",
103
+ "参数列表='''\n",
104
+ "--disable-safe-unpickle\n",
105
+ "--deepdanbooru\n",
106
+ "--no-hashing\n",
107
+ "--no-download-sd-model\n",
108
+ "--administrator\n",
109
+ "--skip-torch-cuda-test\n",
110
+ "--skip-version-check\n",
111
+ "--disable-nan-check\n",
112
+ "--opt-sdp-attention\n",
113
+ "--opt-sdp-no-mem-attention\n",
114
+ "--xformers-flash-attention\n",
115
+ "--xformers\n",
116
+ "--api\n",
117
+ "--listen\n",
118
+ "--lowram\n",
119
+ "--no-gradio-queue\n",
120
+ "'''\n",
121
+ "# --api-auth=2333:6666 --gradio-auth=2333:6666"
122
+ ]
123
+ },
124
+ {
125
+ "cell_type": "code",
126
+ "execution_count": null,
127
+ "metadata": {
128
+ "_kg_hide-input": false,
129
+ "id": "r_lBDJdOLCtB",
130
+ "trusted": true
131
+ },
132
+ "outputs": [],
133
+ "source": [
134
+ "# 手机端界面优化 使用了修改过界面布局顺序的webui,不定期同步到官方版本\n",
135
+ "mobileOptimize=True\n",
136
+ "# webui的配置文件\n",
137
+ "webui_settings = 'https://github.com/viyiviyi/sd-configs.git'\n",
138
+ "# 设置文件路径\n",
139
+ "setting_file = '/kaggle/working/configs/config.json'\n",
140
+ "ui_config_file = '/kaggle/working/configs/ui-config.json'\n",
141
+ "\n",
142
+ "# 配置启动参数\n",
143
+ "webuiPort=7860 # webui默认端口\n",
144
+ "disableShared=False # 关闭默认的gradio.live穿透\n",
145
+ "onlyApi=False # 无ui界面,仅提供api服务\n",
146
+ "quickStart=True # 快速启动 使用下载好的python环境 开启后启动到可用需要4分钟,不开启需要8分钟\n",
147
+ "vaeHalf=False # vae开启半精度,关闭效果更好,对速度没啥影响\n",
148
+ "modelHalf=True # 模型开启半精度,关闭效果更好,但生成速度减半\n",
149
+ "consoleProgressbars=False # 控制台显示进度条,关闭可以减少一些输出内容,查看日志时更快一点\n",
150
+ "consolePrompts=False # 同上\n",
151
+ "enableLoadByCopy=False # 是否使用copy的方式加载文件 启动变慢,且测试后没有提高模型切换速度\n",
152
+ "enableThread=True # 启用多线程下载插件 依赖 和 模型\n",
153
+ "#Ngrok\n",
154
+ "useNgrok=True # 非必填 是否使用ngrok作为公网访问地址\n",
155
+ "#Frpc\n",
156
+ "useFrpc=True # 开启frp将不能启动\n",
157
+ "\n",
158
+ "import os\n",
159
+ "INIT_WORK_PATH = os.environ['HOME']\n",
160
+ "if os.getenv('INIT_WORK_PATH',''):\n",
161
+ " INIT_WORK_PATH = os.getenv('INIT_WORK_PATH','')\n",
162
+ "else:\n",
163
+ " os.environ['INIT_WORK_PATH'] = os.getcwd()\n",
164
+ "%cd {INIT_WORK_PATH}"
165
+ ]
166
+ },
167
+ {
168
+ "cell_type": "code",
169
+ "execution_count": null,
170
+ "metadata": {
171
+ "trusted": true,
172
+ "id": "9aHxnTLGBK5J"
173
+ },
174
+ "outputs": [],
175
+ "source": [
176
+ "reLoad = True\n",
177
+ "# 如果需要重新安装,请注释这一行\n",
178
+ "reLoad = False"
179
+ ]
180
+ },
181
+ {
182
+ "cell_type": "code",
183
+ "execution_count": null,
184
+ "metadata": {
185
+ "scrolled": true,
186
+ "trusted": true,
187
+ "id": "BkHAdhudBK5J"
188
+ },
189
+ "outputs": [],
190
+ "source": [
191
+ "!wget https://huggingface.co/viyi/sdwui/resolve/main/sdwui-start.ipynb\n",
192
+ "%run sdwui-start.ipynb"
193
+ ]
194
+ },
195
+ {
196
+ "cell_type": "code",
197
+ "execution_count": null,
198
+ "metadata": {
199
+ "id": "ePT_b-s9LCtF",
200
+ "scrolled": true,
201
+ "trusted": true
202
+ },
203
+ "outputs": [],
204
+ "source": [
205
+ "\n",
206
+ "# 打包收藏文件夹 如果需要可以取消下面两行的注释\n",
207
+ "# zipPath('$install_path/stable-diffusion-webui/log','log')\n",
208
+ "# !mv {output_path}/log.tar {output_path}/log.tar.bak\n",
209
+ "# createOrUpdateDataSet(f'{output_path}/log.tar.bak','sd-webui-log-bak')\n",
210
+ "\n",
211
+ "# 打包 这一行的结果是 压缩一个目录,并放在 output_path: /kaggle/working/ 目录下 名字是训练输出.tar\n",
212
+ "# zipPath('$install_path/stable-diffusion-webui/textual_inversion','训练输出')\n",
213
+ "# zipPath('$install_path/stable-diffusion-webui/outputs','outputs')\n",
214
+ "# zipPath('$install_path/stable-diffusion-webui/venv','venv')\n",
215
+ "# !mv {output_path}/venv.tar /kaggle/working/venv.tar.bak\n",
216
+ "# createOrUpdateDataSet('/kaggle/working/venv.tar.bak','sd-webui-venv')\n",
217
+ "# !tar -cf $output_path/webui.tar.bak --exclude=venv --exclude=extensions -C /kaggle/stable-diffusion-webui/ ."
218
+ ]
219
+ }
220
+ ],
221
+ "metadata": {
222
+ "kernelspec": {
223
+ "display_name": "Python 3",
224
+ "language": "python",
225
+ "name": "python3"
226
+ },
227
+ "language_info": {
228
+ "codemirror_mode": {
229
+ "name": "ipython",
230
+ "version": 3
231
+ },
232
+ "file_extension": ".py",
233
+ "mimetype": "text/x-python",
234
+ "name": "python",
235
+ "nbconvert_exporter": "python",
236
+ "pygments_lexer": "ipython3",
237
+ "version": "3.7.12"
238
+ },
239
+ "colab": {
240
+ "provenance": []
241
+ }
242
+ },
243
+ "nbformat": 4,
244
+ "nbformat_minor": 0
245
+ }