wang0856 commited on
Commit
4152e1e
·
1 Parent(s): 92c7e64

Upload sd-webui-aki-aliyun-v2.ipynb

Browse files
Files changed (1) hide show
  1. sd-webui-aki-aliyun-v2.ipynb +208 -0
sd-webui-aki-aliyun-v2.ipynb ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "id": "f06bea55-7889-4576-a83b-d3b207729e3d",
6
+ "metadata": {},
7
+ "source": [
8
+ "# Stable Diffusion WebUI"
9
+ ]
10
+ },
11
+ {
12
+ "attachments": {},
13
+ "cell_type": "markdown",
14
+ "id": "9fab4ab6-be4b-4206-ba12-8dad73bac833",
15
+ "metadata": {},
16
+ "source": [
17
+ "阿里云 DSW 一键脚本 By bilibili@秋葉aaaki\n",
18
+ "\n",
19
+ "#### 更新日志\n",
20
+ "\n",
21
+ "- 添加了部分插件(LoRA)\n",
22
+ "- 添加了下载文件用的代码"
23
+ ]
24
+ },
25
+ {
26
+ "cell_type": "markdown",
27
+ "id": "39df08ff-45e4-4a86-add4-a5af9cc7f7d6",
28
+ "metadata": {},
29
+ "source": [
30
+ "## 安装 第一次需要执行"
31
+ ]
32
+ },
33
+ {
34
+ "cell_type": "code",
35
+ "execution_count": null,
36
+ "id": "567fe4a3-a897-48b6-bde2-0afb3d064c80",
37
+ "metadata": {},
38
+ "outputs": [],
39
+ "source": [
40
+ "!apt update\n",
41
+ "!apt install -y aria2\n",
42
+ "\n",
43
+ "!git clone https://gitcode.net/overbill1683/stable-diffusion-webui\n",
44
+ "%cd stable-diffusion-webui\n",
45
+ "!mkdir repositories\n",
46
+ "%cd repositories\n",
47
+ "!git clone \"https://gitcode.net/overbill1683/stablediffusion\" \"stable-diffusion-stability-ai\"\n",
48
+ "!git clone \"https://gitcode.net/overbill1683/taming-transformers\" \"taming-transformers\"\n",
49
+ "!git clone \"https://gitcode.net/overbill1683/k-diffusion\" \"k-diffusion\"\n",
50
+ "!git clone \"https://gitcode.net/overbill1683/CodeFormer\" \"CodeFormer\"\n",
51
+ "!git clone \"https://gitcode.net/overbill1683/BLIP\" \"BLIP\"\n",
52
+ "\n",
53
+ "%cd /mnt/workspace/stable-diffusion-webui\n",
54
+ "!wget -O \"config.json\" \"https://gitcode.net/Akegarasu/sd-webui-configs/-/raw/master/config.json\""
55
+ ]
56
+ },
57
+ {
58
+ "cell_type": "code",
59
+ "execution_count": null,
60
+ "id": "29c0c31d-ea47-4056-9ace-ff044cc42cbd",
61
+ "metadata": {},
62
+ "outputs": [],
63
+ "source": [
64
+ "## 安装常用插件\n",
65
+ "extensions = [\n",
66
+ " \"https://gitcode.net/ranting8323/a1111-sd-webui-tagcomplete\",\n",
67
+ " \"https://gitcode.net/ranting8323/stable-diffusion-webui-localization-zh_CN\",\n",
68
+ " \"https://gitcode.net/ranting8323/sd-webui-additional-networks\",\n",
69
+ "]\n",
70
+ "\n",
71
+ "%cd /mnt/workspace/stable-diffusion-webui\n",
72
+ "for e in extensions:\n",
73
+ " !git -C \"extensions\" clone {e}"
74
+ ]
75
+ },
76
+ {
77
+ "cell_type": "markdown",
78
+ "id": "ced6371a-1cff-4dbf-9400-459ebb588df2",
79
+ "metadata": {},
80
+ "source": [
81
+ "## 下载模型"
82
+ ]
83
+ },
84
+ {
85
+ "cell_type": "code",
86
+ "execution_count": null,
87
+ "id": "8c290ca4-0880-41e1-b1c5-58fd9a755bb7",
88
+ "metadata": {},
89
+ "outputs": [],
90
+ "source": [
91
+ "def aria2(url, filename, d):\n",
92
+ " !aria2c --console-log-level=error -c -x 16 -s 16 {url} -o {filename} -d {d}\n",
93
+ "\n",
94
+ "model_url = \"https://huggingface.co/gsdf/Counterfeit-V2.5/resolve/main/Counterfeit-V2.5_fp16.safetensors\"\n",
95
+ "aria2(model_url, model_url.split(\"/\")[-1], \"/mnt/workspace/stable-diffusion-webui/models/Stable-diffusion\")"
96
+ ]
97
+ },
98
+ {
99
+ "cell_type": "markdown",
100
+ "id": "d90eabd2-39cb-445d-b1b1-6e2740938948",
101
+ "metadata": {},
102
+ "source": [
103
+ "## 下载 VAE"
104
+ ]
105
+ },
106
+ {
107
+ "cell_type": "code",
108
+ "execution_count": null,
109
+ "id": "9936de5b-3f98-41ab-9af2-5691f60c4764",
110
+ "metadata": {},
111
+ "outputs": [],
112
+ "source": [
113
+ "VAE_URL = \"https://huggingface.co/akibanzu/animevae/resolve/main/animevae.pt\"\n",
114
+ "aria2(VAE_URL, VAE_URL.split(\"/\")[-1], \"/mnt/workspace/stable-diffusion-webui/models/VAE\")"
115
+ ]
116
+ },
117
+ {
118
+ "attachments": {},
119
+ "cell_type": "markdown",
120
+ "id": "383abdf0",
121
+ "metadata": {},
122
+ "source": [
123
+ "## 下载 其他文件(可选)"
124
+ ]
125
+ },
126
+ {
127
+ "cell_type": "code",
128
+ "execution_count": null,
129
+ "id": "e1dd7015",
130
+ "metadata": {},
131
+ "outputs": [],
132
+ "source": [
133
+ "# 这部分是可选的!!!!!有需要再执行!!!!!!! 修改对应文本,运行即可下载文件\n",
134
+ "DOWNLOAD_URL = \"文件链接\" # 文件链接,需要下载的url直链才可以\n",
135
+ "FILE_NAME = \"aki\" # 下载保存的文件名\n",
136
+ "SAVE_DIR = \"~/\" # 文件保存的路径\n",
137
+ "aria2(DOWNLOAD_URL, FILE_NAME, SAVE_DIR)"
138
+ ]
139
+ },
140
+ {
141
+ "cell_type": "markdown",
142
+ "id": "e4bff16e-1f2d-4324-b1b8-78758b107eed",
143
+ "metadata": {},
144
+ "source": [
145
+ "## 启动WebUI"
146
+ ]
147
+ },
148
+ {
149
+ "cell_type": "code",
150
+ "execution_count": null,
151
+ "id": "edb12c51-eacb-4086-857e-e2eac64ac94f",
152
+ "metadata": {},
153
+ "outputs": [],
154
+ "source": [
155
+ "import os\n",
156
+ "package_envs = [\n",
157
+ " {\n",
158
+ " \"env\": \"GFPGAN_PACKAGE\",\n",
159
+ " \"url\": \"git+https://gitcode.net/overbill1683/GFPGAN.git@8d2447a2d918f8eba5a4a01463fd48e45126a379\"\n",
160
+ " },\n",
161
+ " {\n",
162
+ " \"env\": \"CLIP_PACKAGE\",\n",
163
+ " \"url\": \"git+https://gitcode.net/overbill1683/CLIP.git@d50d76daa670286dd6cacf3bcd80b5e4823fc8e1\"\n",
164
+ " },\n",
165
+ " {\n",
166
+ " \"env\": \"OPENCLIP_PACKAGE\",\n",
167
+ " \"url\": \"git+https://gitcode.net/overbill1683/open_clip.git@bb6e834e9c70d9c27d0dc3ecedeebeaeb1ffad6b\"\n",
168
+ " }\n",
169
+ "]\n",
170
+ "os.environ[\"PIP_INDEX_URL\"] = \"https://mirrors.bfsu.edu.cn/pypi/web/simple\"\n",
171
+ "for i in package_envs:\n",
172
+ " os.environ[i[\"env\"]] = i[\"url\"]\n",
173
+ "\n",
174
+ "%cd /mnt/workspace/stable-diffusion-webui\n",
175
+ "!python launch.py --no-download-sd-model --xformers --share --listen"
176
+ ]
177
+ },
178
+ {
179
+ "cell_type": "code",
180
+ "execution_count": null,
181
+ "id": "b778a001-6f15-459f-ab52-f0ae75c8c8af",
182
+ "metadata": {},
183
+ "outputs": [],
184
+ "source": []
185
+ }
186
+ ],
187
+ "metadata": {
188
+ "kernelspec": {
189
+ "display_name": "Python 3 (ipykernel)",
190
+ "language": "python",
191
+ "name": "python3"
192
+ },
193
+ "language_info": {
194
+ "codemirror_mode": {
195
+ "name": "ipython",
196
+ "version": 3
197
+ },
198
+ "file_extension": ".py",
199
+ "mimetype": "text/x-python",
200
+ "name": "python",
201
+ "nbconvert_exporter": "python",
202
+ "pygments_lexer": "ipython3",
203
+ "version": "3.10.6"
204
+ }
205
+ },
206
+ "nbformat": 4,
207
+ "nbformat_minor": 5
208
+ }