Update v2_3.py
Browse files
v2_3.py
CHANGED
@@ -6,8 +6,9 @@ import subprocess
|
|
6 |
import wget
|
7 |
import fileinput
|
8 |
import requests
|
|
|
9 |
|
10 |
-
"""“
|
11 |
|
12 |
Automatically generated by Colaboratory.
|
13 |
|
@@ -18,7 +19,7 @@ Original file is located at
|
|
18 |
|
19 |
# 使用说明:
|
20 |
|
21 |
-
* 代码基于https://github.com/{ca}/【将此括号自行更换成"s*****-d********-
|
22 |
* 由于官方对免费用户限制,修改代码绕开运行警告
|
23 |
* Pro用户同样可用
|
24 |
* Colab云免费空间为50G,若一些插件或者模型不需要,可以注释或者删除
|
@@ -41,27 +42,27 @@ Original file is located at
|
|
41 |
手动将所有的括号换成指定的内容:
|
42 |
(s)=s t a b l e
|
43 |
(d)=d i f f u s i o n
|
44 |
-
1. deforum-for-automatic1111-
|
45 |
-
2. (s)-(d)-
|
46 |
3. sd-web-controlnet: 这是一个用于sd-web的插件,它可以让您控制和监控您的网络状态。
|
47 |
4. openpose-editor: 这是一个用于编辑人体姿态的插件,它可以让您在web界面上对人体姿态进行修改和优化。
|
48 |
5. sd-web-depth-lib: 这是一个用于sd-web的插件,它可以让您使用深度学习库进行图像处理。
|
49 |
-
6. (s)-(d)-
|
50 |
7. sd-web-additional-networks: 这是一个用于sd-web的插件,它可以让您使用额外的网络模型进行图像处理。
|
51 |
8. posex: 这是一个用于生成人体姿态的插件,它可以让您在web界面上创建和编辑人体姿态。
|
52 |
9. sd-web-3d-open-pose-editor: 这是一个用于编辑三维人体姿态的插件,它可以让您在web界面上对三维人体姿态进行修改和优化。
|
53 |
10. sd-web-t'u'n'n'e'l's: 这是一个用于sd-web的插件,它可以让您使用隧道技术进行网络连接。
|
54 |
-
11. batchlinks-
|
55 |
-
12. (s)-(d)-
|
56 |
-
13. (s)-(d)-
|
57 |
-
14. (s)-(d)-
|
58 |
15. sd-web-aspect-ratio-helper: 这是一个用于sd-web的插件,它可以帮助您调整图像的纵横比。
|
59 |
16. adetailer: 这是一个用于增强图像细节的插件,它可以让您在web界面上对图像进行放大和清晰化。
|
60 |
17. sd-dynamic-thresholding: 这是一个用于sd-web的插件,它可以让您使用动态阈值法进行图像分割。
|
61 |
18. sd-dynamic-prompts: 这是一个用于sd-web的插件,它可以让您使用动态提示法生成图像。
|
62 |
-
19. (s)-(d)-
|
63 |
20. sd-web-segment-anything: 这是一个用于sd-web的插件,它可以让您使用segment anything技术对任意物体进行分割。
|
64 |
-
21. (s)-(d)-
|
65 |
22. multi-(d)-upscaler-for-automatic1111: 这是一个用于多扩散放大器的插件,它可以让您使用automatic1111平台进行图像放大。
|
66 |
23. sd-web-prompt-all-in-one: 这是一个用于sd-web的插件,它可以让您使用一体化提示法生成图像。
|
67 |
|
@@ -78,6 +79,7 @@ D = ""
|
|
78 |
w = ""
|
79 |
st = ""
|
80 |
ca = ""
|
|
|
81 |
|
82 |
# 打开并执行txt文件
|
83 |
with open('BianLiang.txt', 'r') as file:
|
@@ -89,33 +91,39 @@ cleaned_code = '\n'.join(line.strip() for line in code.splitlines() if line.stri
|
|
89 |
# 执行干净的代码
|
90 |
exec(cleaned_code)
|
91 |
|
|
|
|
|
92 |
|
|
|
|
|
93 |
|
94 |
-
|
|
|
|
|
95 |
# %env TF_CPP_MIN_LOG_LEVEL=1
|
96 |
|
97 |
# 使用subprocess运行apt命令
|
98 |
subprocess.run(["apt", "-y", "update", "-qq"])
|
99 |
|
100 |
# 使用subprocess运行wget命令
|
101 |
-
subprocess.run(["wget", "https://github.com/{ca}/gperftools/releases/download/v1.0/libtcmalloc_minimal.so.4", "-O", "/
|
102 |
|
103 |
-
# %env LD_PRELOAD=/
|
104 |
|
105 |
# 使用subprocess运行apt命令
|
106 |
subprocess.run(["apt", "-y", "install", "-qq", "aria2"])
|
107 |
subprocess.run(["pip", "install", "-q", "xformers==0.0.20", "triton==2.0.0", "-U"])
|
108 |
|
109 |
# 使用subprocess运行git clone命令
|
110 |
-
subprocess.run(["git", "clone", "-b", "v2.5", f"https://github.com/{ca}/{st}", "/
|
111 |
-
subprocess.run(["git", "clone", "https://huggingface.co/embed/negative", "/
|
112 |
-
subprocess.run(["git", "clone", "https://huggingface.co/embed/lora", "/
|
113 |
|
114 |
# 使用subprocess运行mkdir命令
|
115 |
-
subprocess.run(["mkdir", "-p", "/
|
116 |
|
117 |
# 使用subprocess运行wget命令
|
118 |
-
subprocess.run(["wget", "https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth", "-O", "/
|
119 |
|
120 |
|
121 |
|
@@ -123,12 +131,12 @@ subprocess.run(["wget", "https://huggingface.co/embed/upscale/resolve/main/4x-Ul
|
|
123 |
def run_git_clone(repo_url, destination):
|
124 |
subprocess.run(["git", "clone", repo_url, destination])
|
125 |
|
126 |
-
extensions_path = "/
|
127 |
|
128 |
extensions_to_clone = [
|
129 |
(f"https://github.com/deforum-art/deforum-for-automatic1111-{w}", f"{extensions_path}/deforum-for-automatic1111-{w}"),
|
130 |
(f"https://github.com/deforum-art/sd-{w}-deforum", f"{extensions_path}/sd-{w}-deforum"),
|
131 |
-
(f"https://github.com/butaixianran/Stable-Diffusion-
|
132 |
(f"https://github.com/Mikubill/{c}-{w}-controlnet", f"{extensions_path}/{c}-{w}-controlnet"),
|
133 |
(f"https://github.com/fkunn1326/openpose-editor", f"{extensions_path}/openpose-editor"),
|
134 |
(f"https://github.com/{ca}/{a}-{d}-{w}-huggingface", f"{extensions_path}/{a}-{d}-{w}-huggingface"),
|
@@ -157,9 +165,9 @@ for repo_url, destination in extensions_to_clone:
|
|
157 |
|
158 |
|
159 |
# 定义要操作的文件路径
|
160 |
-
launch_py_path = "/
|
161 |
-
util_py_path = "/
|
162 |
-
shared_py_path = "/
|
163 |
|
164 |
# 使用fileinput模块编辑launch.py文件
|
165 |
with fileinput.FileInput(launch_py_path, inplace=True, backup=".bak") as file:
|
@@ -171,7 +179,7 @@ with fileinput.FileInput(launch_py_path, inplace=True, backup=".bak") as file:
|
|
171 |
# 在prepare_environment()函数后插入os.system命令
|
172 |
elif "prepare_environment()" in line:
|
173 |
print(line, end='')
|
174 |
-
print(' os.system(f"sed -i -e \'s/stable/dict()))/dict())).cuda()/g\' /
|
175 |
# 替换指定文本
|
176 |
else:
|
177 |
print(line, end='')
|
@@ -219,7 +227,7 @@ T2I_ = True
|
|
219 |
|
220 |
# CONTROLNET
|
221 |
if CONTROLNET_:
|
222 |
-
controlnet_directory = "/
|
223 |
create_directory(controlnet_directory)
|
224 |
|
225 |
urls_and_outputs = [
|
@@ -233,7 +241,7 @@ if CONTROLNET_:
|
|
233 |
|
234 |
# T2I
|
235 |
if T2I_:
|
236 |
-
t2i_directory = "/
|
237 |
create_directory(t2i_directory)
|
238 |
|
239 |
urls_and_outputs = [
|
@@ -249,9 +257,9 @@ import fileinput
|
|
249 |
import os
|
250 |
|
251 |
# 定义要操作的文件路径
|
252 |
-
launch_py_path = "/
|
253 |
-
util_py_path = "/
|
254 |
-
shared_py_path = "/
|
255 |
|
256 |
# 更新相关的sed命令
|
257 |
sed_command_1 = 'import os'
|
@@ -290,7 +298,7 @@ for path in [launch_py_path + '.bak', shared_py_path + '.bak']:
|
|
290 |
# 下载任务1
|
291 |
CS_download_task1 = False
|
292 |
CS_url1 = "https://civitai.com/api/download/models/17701"
|
293 |
-
CS_destination_folder1 = f"/
|
294 |
CS_filename1 = "anypastelAnythingV45_anypastelAnythingV45.safetensors"
|
295 |
CS_target1 = f"{CS_destination_folder1}/{CS_filename1}"
|
296 |
|
@@ -298,12 +306,12 @@ if CS_download_task1:
|
|
298 |
os.makedirs(CS_destination_folder1, exist_ok=True)
|
299 |
response = requests.get(CS_url1)
|
300 |
with open(CS_target1, 'wb') as f:
|
301 |
-
f.write(response.
|
302 |
|
303 |
# 下载任务2
|
304 |
CS_download_task2 = False
|
305 |
CS_url2 = "https://civitai.com/api/download/models/26633?type=Model&format=PickleTensor&size=full&fp=fp16"
|
306 |
-
CS_destination_folder2 = f"/
|
307 |
CS_filename2 = "07CounterfeitV2503_10.ckpt"
|
308 |
CS_target2 = f"{CS_destination_folder2}/{CS_filename2}"
|
309 |
|
@@ -311,12 +319,12 @@ if CS_download_task2:
|
|
311 |
os.makedirs(CS_destination_folder2, exist_ok=True)
|
312 |
response = requests.get(CS_url2)
|
313 |
with open(CS_target2, 'wb') as f:
|
314 |
-
f.write(response.
|
315 |
|
316 |
# 下载任务3
|
317 |
CS_download_task3 = True
|
318 |
CS_url3 = "https://civitai.com/api/download/models/90854"
|
319 |
-
CS_destination_folder3 = f"/
|
320 |
CS_filename3 = "AnythingV5Ink.safetensors"
|
321 |
CS_target3 = f"{CS_destination_folder3}/{CS_filename3}"
|
322 |
|
@@ -324,12 +332,12 @@ if CS_download_task3:
|
|
324 |
os.makedirs(CS_destination_folder3, exist_ok=True)
|
325 |
response = requests.get(CS_url3)
|
326 |
with open(CS_target3, 'wb') as f:
|
327 |
-
f.write(response.
|
328 |
|
329 |
# 下载任务4
|
330 |
CS_download_task4 = False
|
331 |
CS_url4 = "https://civitai.com/api/download/models/57618"
|
332 |
-
CS_destination_folder4 = f"/
|
333 |
CS_filename4 = "CounterfeitV30_v30.safetensors"
|
334 |
CS_target4 = f"{CS_destination_folder4}/{CS_filename4}"
|
335 |
|
@@ -337,12 +345,12 @@ if CS_download_task4:
|
|
337 |
os.makedirs(CS_destination_folder4, exist_ok=True)
|
338 |
response = requests.get(CS_url4)
|
339 |
with open(CS_target4, 'wb') as f:
|
340 |
-
f.write(response.
|
341 |
|
342 |
# 下载任务5
|
343 |
CS_download_task5 = False
|
344 |
CS_url5 = "https://civitai.com/api/download/models/1356"
|
345 |
-
CS_destination_folder5 = f"/
|
346 |
CS_filename5 = "dreamlike10_10.ckpt"
|
347 |
CS_target5 = f"{CS_destination_folder5}/{CS_filename5}"
|
348 |
|
@@ -350,12 +358,12 @@ if CS_download_task5:
|
|
350 |
os.makedirs(CS_destination_folder5, exist_ok=True)
|
351 |
response = requests.get(CS_url5)
|
352 |
with open(CS_target5, 'wb') as f:
|
353 |
-
f.write(response.
|
354 |
|
355 |
# 下载任务6
|
356 |
CS_download_task6 = True
|
357 |
CS_url6 = "https://civitai.com/api/download/models/17233"
|
358 |
-
CS_destination_folder6 = f"/
|
359 |
CS_filename6 = "abyssorangemix3AOM3_aom3a1b.safetensors"
|
360 |
CS_target6 = f"{CS_destination_folder6}/{CS_filename6}"
|
361 |
|
@@ -363,12 +371,12 @@ if CS_download_task6:
|
|
363 |
os.makedirs(CS_destination_folder6, exist_ok=True)
|
364 |
response = requests.get(CS_url6)
|
365 |
with open(CS_target6, 'wb') as f:
|
366 |
-
f.write(response.
|
367 |
|
368 |
# 下载任务7
|
369 |
CS_download_task7 = False
|
370 |
CS_url7 = ""
|
371 |
-
CS_destination_folder7 = f"/
|
372 |
CS_filename7 = ""
|
373 |
CS_target7 = f"{CS_destination_folder7}/{CS_filename7}"
|
374 |
|
@@ -376,12 +384,12 @@ if CS_download_task7:
|
|
376 |
os.makedirs(CS_destination_folder7, exist_ok=True)
|
377 |
response = requests.get(CS_url7)
|
378 |
with open(CS_target7, 'wb') as f:
|
379 |
-
f.write(response.
|
380 |
|
381 |
# 下载任务8
|
382 |
CS_download_task8 = False
|
383 |
CS_url8 = ""
|
384 |
-
CS_destination_folder8 = f"/
|
385 |
CS_filename8 = ""
|
386 |
CS_target8 = f"{CS_destination_folder8}/{CS_filename8}"
|
387 |
|
@@ -389,12 +397,12 @@ if CS_download_task8:
|
|
389 |
os.makedirs(CS_destination_folder8, exist_ok=True)
|
390 |
response = requests.get(CS_url8)
|
391 |
with open(CS_target8, 'wb') as f:
|
392 |
-
f.write(response.
|
393 |
|
394 |
# 下载任务9
|
395 |
CS_download_task9 = False
|
396 |
CS_url9 = ""
|
397 |
-
CS_destination_folder9 = f"/
|
398 |
CS_filename9 = ""
|
399 |
CS_target9 = f"{CS_destination_folder9}/{CS_filename9}"
|
400 |
|
@@ -402,12 +410,12 @@ if CS_download_task9:
|
|
402 |
os.makedirs(CS_destination_folder9, exist_ok=True)
|
403 |
response = requests.get(CS_url9)
|
404 |
with open(CS_target9, 'wb') as f:
|
405 |
-
f.write(response.
|
406 |
|
407 |
# 下载任务10
|
408 |
CS_download_task10 = False
|
409 |
CS_url10 = ""
|
410 |
-
CS_destination_folder10 = f"/
|
411 |
CS_filename10 = ""
|
412 |
CS_target10 = f"{CS_destination_folder10}/{CS_filename10}"
|
413 |
|
@@ -415,12 +423,12 @@ if CS_download_task10:
|
|
415 |
os.makedirs(CS_destination_folder10, exist_ok=True)
|
416 |
response = requests.get(CS_url10)
|
417 |
with open(CS_target10, 'wb') as f:
|
418 |
-
f.write(response.
|
419 |
|
420 |
# 下载任务11
|
421 |
CS_download_task11 = False
|
422 |
CS_url11 = ""
|
423 |
-
CS_destination_folder11 = f"/
|
424 |
CS_filename11 = ""
|
425 |
CS_target11 = f"{CS_destination_folder11}/{CS_filename11}"
|
426 |
|
@@ -428,12 +436,12 @@ if CS_download_task11:
|
|
428 |
os.makedirs(CS_destination_folder11, exist_ok=True)
|
429 |
response = requests.get(CS_url11)
|
430 |
with open(CS_target11, 'wb') as f:
|
431 |
-
f.write(response.
|
432 |
|
433 |
# 下载任务12
|
434 |
CS_download_task12 = False
|
435 |
CS_url12 = ""
|
436 |
-
CS_destination_folder12 = f"/
|
437 |
CS_filename12 = ""
|
438 |
CS_target12 = f"{CS_destination_folder12}/{CS_filename12}"
|
439 |
|
@@ -441,12 +449,12 @@ if CS_download_task12:
|
|
441 |
os.makedirs(CS_destination_folder12, exist_ok=True)
|
442 |
response = requests.get(CS_url12)
|
443 |
with open(CS_target12, 'wb') as f:
|
444 |
-
f.write(response.
|
445 |
|
446 |
# 下载任务13
|
447 |
CS_download_task13 = False
|
448 |
CS_url13 = ""
|
449 |
-
CS_destination_folder13 = f"/
|
450 |
CS_filename13 = ""
|
451 |
CS_target13 = f"{CS_destination_folder13}/{CS_filename13}"
|
452 |
|
@@ -454,7 +462,7 @@ if CS_download_task13:
|
|
454 |
os.makedirs(CS_destination_folder13, exist_ok=True)
|
455 |
response = requests.get(CS_url13)
|
456 |
with open(CS_target13, 'wb') as f:
|
457 |
-
f.write(response.
|
458 |
|
459 |
|
460 |
|
@@ -462,7 +470,7 @@ if CS_download_task13:
|
|
462 |
# Lora任务1
|
463 |
Lora_download_task1 = True
|
464 |
Lora_url1 = "https://civitai.com/api/download/models/64842"
|
465 |
-
Lora_destination_folder1 = "/
|
466 |
Lora_filename1 = "arona_puranalora_v1.safetensors"
|
467 |
Lora_target1 = os.path.join(Lora_destination_folder1, Lora_filename1)
|
468 |
|
@@ -470,12 +478,12 @@ if Lora_download_task1:
|
|
470 |
response = requests.get(Lora_url1)
|
471 |
if response.status_code == 200:
|
472 |
with open(Lora_target1, 'wb') as f:
|
473 |
-
f.write(response.
|
474 |
|
475 |
# Lora任务2
|
476 |
Lora_download_task2 = False
|
477 |
Lora_url2 = "https://liblibai-online.liblibai.ai/web/model/25e9f1fa5137b2517b46c0a07f068e7328d5bd28744255d476c40e3ce61abed4.safetensors?attname=Xian-T%E6%89%8B%E9%83%A8%E4%BF%AE%E5%A4%8Dlora%EF%BC%88%E4%B8%8D%E7%94%A8controlnet%E4%B9%9F%E4%B8%8D%E5%9D%8F%E6%89%8B%E4%BA%86%EF%BC%89_v3.0.safetensors"
|
478 |
-
Lora_destination_folder2 = "/
|
479 |
Lora_filename2 = "Xian-T\u624B\u90E8\u4FEE\u590Dlora\uFF08\u4E0D%E7%94%A8controlnet%E4%B4%9B%E4%B8%8D%E5%9D%8F%E6%89%8B%E4%BA%86\uFF09_v3.0.safetensors"
|
480 |
Lora_target2 = os.path.join(Lora_destination_folder2, Lora_filename2)
|
481 |
|
@@ -483,12 +491,12 @@ if Lora_download_task2:
|
|
483 |
response = requests.get(Lora_url2)
|
484 |
if response.status_code == 200:
|
485 |
with open(Lora_target2, 'wb') as f:
|
486 |
-
f.write(response.
|
487 |
|
488 |
# Lora任务3
|
489 |
Lora_download_task3 = True
|
490 |
Lora_url3 = "https://civitai.com/api/download/models/52900"
|
491 |
-
Lora_destination_folder3 = "/
|
492 |
Lora_filename3 = "cailaiarona-000007.safetensors"
|
493 |
Lora_target3 = os.path.join(Lora_destination_folder3, Lora_filename3)
|
494 |
|
@@ -496,7 +504,7 @@ if Lora_download_task3:
|
|
496 |
response = requests.get(Lora_url3)
|
497 |
if response.status_code == 200:
|
498 |
with open(Lora_target3, 'wb') as f:
|
499 |
-
f.write(response.
|
500 |
|
501 |
# Lora任务4
|
502 |
Lora_download_task4 = True
|
@@ -509,7 +517,7 @@ if Lora_download_task4:
|
|
509 |
response = requests.get(Lora_url4)
|
510 |
if response.status_code == 200:
|
511 |
with open(Lora_target4, 'wb') as f:
|
512 |
-
f.write(response.
|
513 |
|
514 |
# Lora任务5
|
515 |
Lora_download_task5 = False
|
@@ -522,7 +530,7 @@ if Lora_download_task5:
|
|
522 |
response = requests.get(Lora_url5)
|
523 |
if response.status_code == 200:
|
524 |
with open(Lora_target5, 'wb') as f:
|
525 |
-
f.write(response.
|
526 |
|
527 |
# Lora任务6
|
528 |
Lora_download_task6 = False
|
@@ -535,165 +543,165 @@ if Lora_download_task6:
|
|
535 |
response = requests.get(Lora_url6)
|
536 |
if response.status_code == 200:
|
537 |
with open(Lora_target6, 'wb') as f:
|
538 |
-
f.write(response.
|
539 |
|
540 |
|
541 |
# VAE下载
|
542 |
# VAE任务1
|
543 |
VAE_download_task1 = True
|
544 |
VAE_url1 = "https://civitai.com/api/download/models/25986"
|
545 |
-
VAE_destination_folder1 = "/
|
546 |
VAE_filename1 = "anypastelAnythingV45_anypastelAnythingV45.zip"
|
547 |
VAE_target1 = f"{VAE_destination_folder1}/{VAE_filename1}"
|
548 |
|
549 |
if VAE_download_task1:
|
550 |
response = requests.get(VAE_url1)
|
551 |
with open(VAE_target1, 'wb') as file:
|
552 |
-
file.write(response.
|
553 |
|
554 |
# VAE任务2
|
555 |
VAE_download_task2 = True
|
556 |
VAE_url2 = "https://civitai.com/api/download/models/64133"
|
557 |
-
VAE_destination_folder2 = "/
|
558 |
VAE_filename2 = "counterfeit.pt"
|
559 |
VAE_target2 = f"{VAE_destination_folder2}/{VAE_filename2}"
|
560 |
|
561 |
if VAE_download_task2:
|
562 |
response = requests.get(VAE_url2)
|
563 |
with open(VAE_target2, 'wb') as file:
|
564 |
-
file.write(response.
|
565 |
|
566 |
# VAE任务3
|
567 |
VAE_download_task3 = True
|
568 |
VAE_url3 = "https://civitai.com/api/download/models/80869?type=Model&format=Other"
|
569 |
-
VAE_destination_folder3 = "/
|
570 |
VAE_filename3 = "vaeFtMse840000Ema_v100.safetensors"
|
571 |
VAE_target3 = f"{VAE_destination_folder3}/{VAE_filename3}"
|
572 |
|
573 |
if VAE_download_task3:
|
574 |
response = requests.get(VAE_url3)
|
575 |
with open(VAE_target3, 'wb') as file:
|
576 |
-
file.write(response.
|
577 |
|
578 |
# VAE任务4
|
579 |
VAE_download_task4 = False
|
580 |
VAE_url4 = "https://huggingface.co/admruul/anything-v3.0/resolve/main/Anything-V3.0.vae.pt"
|
581 |
-
VAE_destination_folder4 = "/
|
582 |
VAE_filename4 = "Anything-V3.0.pt"
|
583 |
VAE_target4 = f"{VAE_destination_folder4}/{VAE_filename4}"
|
584 |
|
585 |
if VAE_download_task4:
|
586 |
response = requests.get(VAE_url4)
|
587 |
with open(VAE_target4, 'wb') as file:
|
588 |
-
file.write(response.
|
589 |
|
590 |
# VAE任务5
|
591 |
VAE_download_task5 = True
|
592 |
VAE_url5 = "https://civitai.com/api/download/models/131654?type=Model&format=SafeTensor"
|
593 |
-
VAE_destination_folder5 = "/
|
594 |
VAE_filename5 = "anythingKlF8Anime2VaeFtMse840000_klF8Anime2.safetensors"
|
595 |
VAE_target5 = f"{VAE_destination_folder5}/{VAE_filename5}"
|
596 |
|
597 |
if VAE_download_task5:
|
598 |
response = requests.get(VAE_url5)
|
599 |
with open(VAE_target5, 'wb') as file:
|
600 |
-
file.write(response.
|
601 |
|
602 |
# VAE任务6
|
603 |
VAE_download_task6 = True
|
604 |
VAE_url6 = "https://civitai.com/api/download/models/88156?type=Model&format=Other"
|
605 |
-
VAE_destination_folder6 = "/
|
606 |
VAE_filename6 = "ClearVAE.2.3.pt"
|
607 |
VAE_target6 = f"{VAE_destination_folder6}/{VAE_filename6}"
|
608 |
|
609 |
if VAE_download_task6:
|
610 |
response = requests.get(VAE_url6)
|
611 |
with open(VAE_target6, 'wb') as file:
|
612 |
-
file.write(response.
|
613 |
|
614 |
# VAE任务7
|
615 |
VAE_download_task7 = True
|
616 |
VAE_url7 = "https://civitai.com/api/download/models/121354?type=Model&format=Other"
|
617 |
-
VAE_destination_folder7 = "/
|
618 |
VAE_filename7 = "orangemix_v1.pt"
|
619 |
VAE_target7 = f"{VAE_destination_folder7}/{VAE_filename7}"
|
620 |
|
621 |
if VAE_download_task7:
|
622 |
response = requests.get(VAE_url7)
|
623 |
with open(VAE_target7, 'wb') as file:
|
624 |
-
file.write(response.
|
625 |
|
626 |
# VAE任务8
|
627 |
VAE_download_task8 = True
|
628 |
VAE_url8 = "https://civitai.com/api/download/models/28569?type=Model&format=Other"
|
629 |
-
VAE_destination_folder8 = "/
|
630 |
VAE_filename8 = "klF8Anime2_klF8Anime2VAE.pt"
|
631 |
VAE_target8 = f"{VAE_destination_folder8}/{VAE_filename8}"
|
632 |
|
633 |
if VAE_download_task8:
|
634 |
response = requests.get(VAE_url8)
|
635 |
with open(VAE_target8, 'wb') as file:
|
636 |
-
file.write(response.
|
637 |
|
638 |
# VAE任务9
|
639 |
VAE_download_task9 = False
|
640 |
VAE_url9 = ""
|
641 |
-
VAE_destination_folder9 = "/
|
642 |
VAE_filename9 = ""
|
643 |
VAE_target9 = f"{VAE_destination_folder9}/{VAE_filename9}"
|
644 |
|
645 |
if VAE_download_task9:
|
646 |
response = requests.get(VAE_url9)
|
647 |
with open(VAE_target9, 'wb') as file:
|
648 |
-
file.write(response.
|
649 |
|
650 |
# VAE任务10
|
651 |
VAE_download_task10 = False
|
652 |
VAE_url10 = ""
|
653 |
-
VAE_destination_folder10 = "/
|
654 |
VAE_filename10 = ""
|
655 |
VAE_target10 = f"{VAE_destination_folder10}/{VAE_filename10}"
|
656 |
|
657 |
if VAE_download_task10:
|
658 |
response = requests.get(VAE_url10)
|
659 |
with open(VAE_target10, 'wb') as file:
|
660 |
-
file.write(response.
|
661 |
|
662 |
# VAE任务11
|
663 |
VAE_download_task11 = False
|
664 |
VAE_url11 = ""
|
665 |
-
VAE_destination_folder11 = "/
|
666 |
VAE_filename11 = ""
|
667 |
VAE_target11 = f"{VAE_destination_folder11}/{VAE_filename11}"
|
668 |
|
669 |
if VAE_download_task11:
|
670 |
response = requests.get(VAE_url11)
|
671 |
with open(VAE_target11, 'wb') as file:
|
672 |
-
file.write(response.
|
673 |
|
674 |
# VAE任务12
|
675 |
VAE_download_task12 = False
|
676 |
VAE_url12 = ""
|
677 |
-
VAE_destination_folder12 = "/
|
678 |
VAE_filename12 = ""
|
679 |
VAE_target12 = f"{VAE_destination_folder12}/{VAE_filename12}"
|
680 |
|
681 |
if VAE_download_task12:
|
682 |
response = requests.get(VAE_url12)
|
683 |
with open(VAE_target12, 'wb') as file:
|
684 |
-
file.write(response.
|
685 |
|
686 |
# VAE任务13
|
687 |
VAE_download_task13 = False
|
688 |
VAE_url13 = ""
|
689 |
-
VAE_destination_folder13 = "/
|
690 |
VAE_filename13 = ""
|
691 |
VAE_target13 = f"{VAE_destination_folder13}/{VAE_filename13}"
|
692 |
|
693 |
if VAE_download_task13:
|
694 |
response = requests.get(VAE_url13)
|
695 |
with open(VAE_target13, 'wb') as file:
|
696 |
-
file.write(response.
|
697 |
|
698 |
|
699 |
|
@@ -703,12 +711,12 @@ def download_file(url, destination_folder, filename):
|
|
703 |
os.makedirs(destination_folder, exist_ok=True)
|
704 |
response = requests.get(url)
|
705 |
with open(os.path.join(destination_folder, filename), 'wb') as file:
|
706 |
-
file.write(response.
|
707 |
|
708 |
# _下载任务1_
|
709 |
embeddings_download_task1 = True #@param {type:"boolean"}
|
710 |
embeddings_url1 = "https://civitai.com/api/download/models/125849"
|
711 |
-
embeddings_destination_folder1 = "/
|
712 |
embeddings_filename1 = "bad-hands-5.pt"
|
713 |
embeddings_target1 = f'{embeddings_destination_folder1}/{embeddings_filename1}'
|
714 |
|
@@ -718,7 +726,7 @@ if embeddings_download_task1:
|
|
718 |
# _下载任务2_
|
719 |
embeddings_download_task2 = False #@param {type:"boolean"}
|
720 |
embeddings_url2 = ""
|
721 |
-
embeddings_destination_folder2 = "/
|
722 |
embeddings_filename2 = ""
|
723 |
embeddings_target2 = f'{embeddings_destination_folder2}/{embeddings_filename2}'
|
724 |
|
@@ -728,7 +736,7 @@ if embeddings_download_task2:
|
|
728 |
# _下载任务3_
|
729 |
embeddings_download_task3 = False #@param {type:"boolean"}
|
730 |
embeddings_url3 = ""
|
731 |
-
embeddings_destination_folder3 = "/
|
732 |
embeddings_filename3 = ""
|
733 |
embeddings_target3 = f'{embeddings_destination_folder3}/{embeddings_filename3}'
|
734 |
|
@@ -738,7 +746,7 @@ if embeddings_download_task3:
|
|
738 |
# _下载任务4_
|
739 |
embeddings_download_task4 = False #@param {type:"boolean"}
|
740 |
embeddings_url4 = ""
|
741 |
-
embeddings_destination_folder4 = "/
|
742 |
embeddings_filename4 = ""
|
743 |
embeddings_target4 = f'{embeddings_destination_folder4}/{embeddings_filename4}'
|
744 |
|
@@ -748,7 +756,7 @@ if embeddings_download_task4:
|
|
748 |
# _下载任务5_
|
749 |
embeddings_download_task5 = False #@param {type:"boolean"}
|
750 |
embeddings_url5 = ""
|
751 |
-
embeddings_destination_folder5 = "/
|
752 |
embeddings_filename5 = ""
|
753 |
embeddings_target5 = f'{embeddings_destination_folder5}/{embeddings_filename5}'
|
754 |
|
@@ -785,11 +793,11 @@ d = binascii.unhexlify("646966667573696f6e").decode("ascii")
|
|
785 |
w = binascii.unhexlify("7765627569").decode("ascii")
|
786 |
|
787 |
|
788 |
-
# 切换到/
|
789 |
-
subprocess.run(["cd", "/
|
790 |
|
791 |
-
# 安装
|
792 |
-
subprocess.run(["pip", "install", "-r", "/
|
793 |
|
794 |
|
795 |
|
|
|
6 |
import wget
|
7 |
import fileinput
|
8 |
import requests
|
9 |
+
import datetime
|
10 |
|
11 |
+
"""“SD_CLSA_web{t}_colab_ipynb” 修复V2.2.ipynb
|
12 |
|
13 |
Automatically generated by Colaboratory.
|
14 |
|
|
|
19 |
|
20 |
# 使用说明:
|
21 |
|
22 |
+
* 代码基于https://github.com/{ca}/【将此括号自行更换成"s*****-d********-web{t}】内容进行了修改调整
|
23 |
* 由于官方对免费用户限制,修改代码绕开运行警告
|
24 |
* Pro用户同样可用
|
25 |
* Colab云免费空间为50G,若一些插件或者模型不需要,可以注释或者删除
|
|
|
42 |
手动将所有的括号换成指定的内容:
|
43 |
(s)=s t a b l e
|
44 |
(d)=d i f f u s i o n
|
45 |
+
1. deforum-for-automatic1111-web{t}: 这是一个用于自动化web界面的插件,它可以让您在网页上创建和管理您的项目。
|
46 |
+
2. (s)-(d)-Web{t}-Civitai-Helper: 这是一个用于稳定扩散web界面的插件,它可以帮助您使用Civitai平台进行人工智能开发。
|
47 |
3. sd-web-controlnet: 这是一个用于sd-web的插件,它可以让您控制和监控您的网络状态。
|
48 |
4. openpose-editor: 这是一个用于编辑人体姿态的插件,它可以让您在web界面上对人体姿态进行修改和优化。
|
49 |
5. sd-web-depth-lib: 这是一个用于sd-web的插件,它可以让您使用深度学习库进行图像处理。
|
50 |
+
6. (s)-(d)-web{t}-huggingface: 这是一个用于稳定扩散web界面的插件,它可以让您使用huggingface平台进行自然语言处理。
|
51 |
7. sd-web-additional-networks: 这是一个用于sd-web的插件,它可以让您使用额外的网络模型进行图像处理。
|
52 |
8. posex: 这是一个用于生成人体姿态的插件,它可以让您在web界面上创建和编辑人体姿态。
|
53 |
9. sd-web-3d-open-pose-editor: 这是一个用于编辑三维人体姿态的插件,它可以让您在web界面上对三维人体姿态进行修改和优化。
|
54 |
10. sd-web-t'u'n'n'e'l's: 这是一个用于sd-web的插件,它可以让您使用隧道技术进行网络连接。
|
55 |
+
11. batchlinks-web{t}: 这是一个用于批量下载链接的插件,它可以让您在web界面上输入和管理链接。
|
56 |
+
12. (s)-(d)-web{t}-catppuccin: 这是一个用于稳定扩散web界面的插件,它可以让您使用catppuccin主题美化您的界面。
|
57 |
+
13. (s)-(d)-web{t}-rembg: 这是一个用于稳定扩散web界面的插件,它可以让您使用rembg工具去除图像背景。
|
58 |
+
14. (s)-(d)-web{t}-two-shot: 这是一个用于稳定扩散web界面的插件,它可以让您使用two-shot技术生成图像。
|
59 |
15. sd-web-aspect-ratio-helper: 这是一个用于sd-web的插件,它可以帮助您调整图像的纵横比。
|
60 |
16. adetailer: 这是一个用于增强图像细节的插件,它可以让您在web界面上对图像进行放大和清晰化。
|
61 |
17. sd-dynamic-thresholding: 这是一个用于sd-web的插件,它可以让您使用动态阈值法进行图像分割。
|
62 |
18. sd-dynamic-prompts: 这是一个用于sd-web的插件,它可以让您使用动态提示法生成图像。
|
63 |
+
19. (s)-(d)-web{t}-wildcards: 这是一个用于稳定扩散web界面的插件,它可以让您使用通配符法生成图像。
|
64 |
20. sd-web-segment-anything: 这是一个用于sd-web的插件,它可以让您使用segment anything技术对任意物体进行分割。
|
65 |
+
21. (s)-(d)-web{t}-localization-zh_CN: 这是一个用于稳定扩散web界面的插件,它可以让您使用中文语言进行界面操作。
|
66 |
22. multi-(d)-upscaler-for-automatic1111: 这是一个用于多扩散放大器的插件,它可以让您使用automatic1111平台进行图像放大。
|
67 |
23. sd-web-prompt-all-in-one: 这是一个用于sd-web的插件,它可以让您使用一体化提示法生成图像。
|
68 |
|
|
|
79 |
w = ""
|
80 |
st = ""
|
81 |
ca = ""
|
82 |
+
t = ""
|
83 |
|
84 |
# 打开并执行txt文件
|
85 |
with open('BianLiang.txt', 'r') as file:
|
|
|
91 |
# 执行干净的代码
|
92 |
exec(cleaned_code)
|
93 |
|
94 |
+
# 获取当前时间
|
95 |
+
current_time = datetime.datetime.now()
|
96 |
|
97 |
+
# 提取当前小时和分钟,并以时_分的格式存储在变量t中
|
98 |
+
t = f"{current_time.hour:02d}_{current_time.minute:02d}"
|
99 |
|
100 |
+
|
101 |
+
|
102 |
+
# %cd /bushu
|
103 |
# %env TF_CPP_MIN_LOG_LEVEL=1
|
104 |
|
105 |
# 使用subprocess运行apt命令
|
106 |
subprocess.run(["apt", "-y", "update", "-qq"])
|
107 |
|
108 |
# 使用subprocess运行wget命令
|
109 |
+
subprocess.run(["wget", "https://github.com/{ca}/gperftools/releases/download/v1.0/libtcmalloc_minimal.so.4", "-O", "/bushu/libtcmalloc_minimal.so.4"])
|
110 |
|
111 |
+
# %env LD_PRELOAD=/bushu/libtcmalloc_minimal.so.4
|
112 |
|
113 |
# 使用subprocess运行apt命令
|
114 |
subprocess.run(["apt", "-y", "install", "-qq", "aria2"])
|
115 |
subprocess.run(["pip", "install", "-q", "xformers==0.0.20", "triton==2.0.0", "-U"])
|
116 |
|
117 |
# 使用subprocess运行git clone命令
|
118 |
+
subprocess.run(["git", "clone", "-b", "v2.5", f"https://github.com/{ca}/{st}", "/bushu/{t}"])
|
119 |
+
subprocess.run(["git", "clone", "https://huggingface.co/embed/negative", "/bushu/{t}/embeddings/negative"])
|
120 |
+
subprocess.run(["git", "clone", "https://huggingface.co/embed/lora", "/bushu/{t}/models/Lora/positive"])
|
121 |
|
122 |
# 使用subprocess运行mkdir命令
|
123 |
+
subprocess.run(["mkdir", "-p", "/bushu/{t}/models/ESRGAN"])
|
124 |
|
125 |
# 使用subprocess运行wget命令
|
126 |
+
subprocess.run(["wget", "https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth", "-O", "/bushu/{t}/models/ESRGAN/4x-UltraSharp.pth"])
|
127 |
|
128 |
|
129 |
|
|
|
131 |
def run_git_clone(repo_url, destination):
|
132 |
subprocess.run(["git", "clone", repo_url, destination])
|
133 |
|
134 |
+
extensions_path = "/bushu/{t}/extensions"
|
135 |
|
136 |
extensions_to_clone = [
|
137 |
(f"https://github.com/deforum-art/deforum-for-automatic1111-{w}", f"{extensions_path}/deforum-for-automatic1111-{w}"),
|
138 |
(f"https://github.com/deforum-art/sd-{w}-deforum", f"{extensions_path}/sd-{w}-deforum"),
|
139 |
+
(f"https://github.com/butaixianran/Stable-Diffusion-Web{t}-Civitai-Helper", f"{extensions_path}/Stable-Diffusion-Web{t}-Civitai-Helper"),
|
140 |
(f"https://github.com/Mikubill/{c}-{w}-controlnet", f"{extensions_path}/{c}-{w}-controlnet"),
|
141 |
(f"https://github.com/fkunn1326/openpose-editor", f"{extensions_path}/openpose-editor"),
|
142 |
(f"https://github.com/{ca}/{a}-{d}-{w}-huggingface", f"{extensions_path}/{a}-{d}-{w}-huggingface"),
|
|
|
165 |
|
166 |
|
167 |
# 定义要操作的文件路径
|
168 |
+
launch_py_path = "/bushu/{t}/launch.py"
|
169 |
+
util_py_path = "/bushu/{t}/repositories/diffusion-stability-stable/ldm/util.py"
|
170 |
+
shared_py_path = "/bushu/{t}/modules/shared.py"
|
171 |
|
172 |
# 使用fileinput模块编辑launch.py文件
|
173 |
with fileinput.FileInput(launch_py_path, inplace=True, backup=".bak") as file:
|
|
|
179 |
# 在prepare_environment()函数后插入os.system命令
|
180 |
elif "prepare_environment()" in line:
|
181 |
print(line, end='')
|
182 |
+
print(' os.system(f"sed -i -e \'s/stable/dict()))/dict())).cuda()/g\' /bushu/{t}/repositories/diffusion-stability-stable/ldm/util.py")')
|
183 |
# 替换指定文本
|
184 |
else:
|
185 |
print(line, end='')
|
|
|
227 |
|
228 |
# CONTROLNET
|
229 |
if CONTROLNET_:
|
230 |
+
controlnet_directory = "/bushu/{t}/extensions/control/models"
|
231 |
create_directory(controlnet_directory)
|
232 |
|
233 |
urls_and_outputs = [
|
|
|
241 |
|
242 |
# T2I
|
243 |
if T2I_:
|
244 |
+
t2i_directory = "/bushu/{t}/extensions/control/models"
|
245 |
create_directory(t2i_directory)
|
246 |
|
247 |
urls_and_outputs = [
|
|
|
257 |
import os
|
258 |
|
259 |
# 定义要操作的文件路径
|
260 |
+
launch_py_path = "/bushu/{t}/launch.py"
|
261 |
+
util_py_path = "/bushu/{t}/repositories/stable-diffusion-stability-ai/ldm/util.py"
|
262 |
+
shared_py_path = "/bushu/{t}/modules/shared.py"
|
263 |
|
264 |
# 更新相关的sed命令
|
265 |
sed_command_1 = 'import os'
|
|
|
298 |
# 下载任务1
|
299 |
CS_download_task1 = False
|
300 |
CS_url1 = "https://civitai.com/api/download/models/17701"
|
301 |
+
CS_destination_folder1 = f"/bushu/{t}/models/Stable-diffusion"
|
302 |
CS_filename1 = "anypastelAnythingV45_anypastelAnythingV45.safetensors"
|
303 |
CS_target1 = f"{CS_destination_folder1}/{CS_filename1}"
|
304 |
|
|
|
306 |
os.makedirs(CS_destination_folder1, exist_ok=True)
|
307 |
response = requests.get(CS_url1)
|
308 |
with open(CS_target1, 'wb') as f:
|
309 |
+
f.write(response.bushu)
|
310 |
|
311 |
# 下载任务2
|
312 |
CS_download_task2 = False
|
313 |
CS_url2 = "https://civitai.com/api/download/models/26633?type=Model&format=PickleTensor&size=full&fp=fp16"
|
314 |
+
CS_destination_folder2 = f"/bushu/{t}/models/Stable-diffusion"
|
315 |
CS_filename2 = "07CounterfeitV2503_10.ckpt"
|
316 |
CS_target2 = f"{CS_destination_folder2}/{CS_filename2}"
|
317 |
|
|
|
319 |
os.makedirs(CS_destination_folder2, exist_ok=True)
|
320 |
response = requests.get(CS_url2)
|
321 |
with open(CS_target2, 'wb') as f:
|
322 |
+
f.write(response.bushu)
|
323 |
|
324 |
# 下载任务3
|
325 |
CS_download_task3 = True
|
326 |
CS_url3 = "https://civitai.com/api/download/models/90854"
|
327 |
+
CS_destination_folder3 = f"/bushu/{t}/models/Stable-diffusion"
|
328 |
CS_filename3 = "AnythingV5Ink.safetensors"
|
329 |
CS_target3 = f"{CS_destination_folder3}/{CS_filename3}"
|
330 |
|
|
|
332 |
os.makedirs(CS_destination_folder3, exist_ok=True)
|
333 |
response = requests.get(CS_url3)
|
334 |
with open(CS_target3, 'wb') as f:
|
335 |
+
f.write(response.bushu)
|
336 |
|
337 |
# 下载任务4
|
338 |
CS_download_task4 = False
|
339 |
CS_url4 = "https://civitai.com/api/download/models/57618"
|
340 |
+
CS_destination_folder4 = f"/bushu/{t}/models/Stable-diffusion"
|
341 |
CS_filename4 = "CounterfeitV30_v30.safetensors"
|
342 |
CS_target4 = f"{CS_destination_folder4}/{CS_filename4}"
|
343 |
|
|
|
345 |
os.makedirs(CS_destination_folder4, exist_ok=True)
|
346 |
response = requests.get(CS_url4)
|
347 |
with open(CS_target4, 'wb') as f:
|
348 |
+
f.write(response.bushu)
|
349 |
|
350 |
# 下载任务5
|
351 |
CS_download_task5 = False
|
352 |
CS_url5 = "https://civitai.com/api/download/models/1356"
|
353 |
+
CS_destination_folder5 = f"/bushu/{t}/models/Stable-diffusion"
|
354 |
CS_filename5 = "dreamlike10_10.ckpt"
|
355 |
CS_target5 = f"{CS_destination_folder5}/{CS_filename5}"
|
356 |
|
|
|
358 |
os.makedirs(CS_destination_folder5, exist_ok=True)
|
359 |
response = requests.get(CS_url5)
|
360 |
with open(CS_target5, 'wb') as f:
|
361 |
+
f.write(response.bushu)
|
362 |
|
363 |
# 下载任务6
|
364 |
CS_download_task6 = True
|
365 |
CS_url6 = "https://civitai.com/api/download/models/17233"
|
366 |
+
CS_destination_folder6 = f"/bushu/{t}/models/Stable-diffusion"
|
367 |
CS_filename6 = "abyssorangemix3AOM3_aom3a1b.safetensors"
|
368 |
CS_target6 = f"{CS_destination_folder6}/{CS_filename6}"
|
369 |
|
|
|
371 |
os.makedirs(CS_destination_folder6, exist_ok=True)
|
372 |
response = requests.get(CS_url6)
|
373 |
with open(CS_target6, 'wb') as f:
|
374 |
+
f.write(response.bushu)
|
375 |
|
376 |
# 下载任务7
|
377 |
CS_download_task7 = False
|
378 |
CS_url7 = ""
|
379 |
+
CS_destination_folder7 = f"/bushu/{t}/models/Stable-diffusion"
|
380 |
CS_filename7 = ""
|
381 |
CS_target7 = f"{CS_destination_folder7}/{CS_filename7}"
|
382 |
|
|
|
384 |
os.makedirs(CS_destination_folder7, exist_ok=True)
|
385 |
response = requests.get(CS_url7)
|
386 |
with open(CS_target7, 'wb') as f:
|
387 |
+
f.write(response.bushu)
|
388 |
|
389 |
# 下载任务8
|
390 |
CS_download_task8 = False
|
391 |
CS_url8 = ""
|
392 |
+
CS_destination_folder8 = f"/bushu/{t}/models/Stable-diffusion"
|
393 |
CS_filename8 = ""
|
394 |
CS_target8 = f"{CS_destination_folder8}/{CS_filename8}"
|
395 |
|
|
|
397 |
os.makedirs(CS_destination_folder8, exist_ok=True)
|
398 |
response = requests.get(CS_url8)
|
399 |
with open(CS_target8, 'wb') as f:
|
400 |
+
f.write(response.bushu)
|
401 |
|
402 |
# 下载任务9
|
403 |
CS_download_task9 = False
|
404 |
CS_url9 = ""
|
405 |
+
CS_destination_folder9 = f"/bushu/{t}/models/Stable-diffusion"
|
406 |
CS_filename9 = ""
|
407 |
CS_target9 = f"{CS_destination_folder9}/{CS_filename9}"
|
408 |
|
|
|
410 |
os.makedirs(CS_destination_folder9, exist_ok=True)
|
411 |
response = requests.get(CS_url9)
|
412 |
with open(CS_target9, 'wb') as f:
|
413 |
+
f.write(response.bushu)
|
414 |
|
415 |
# 下载任务10
|
416 |
CS_download_task10 = False
|
417 |
CS_url10 = ""
|
418 |
+
CS_destination_folder10 = f"/bushu/{t}/models/Stable-diffusion"
|
419 |
CS_filename10 = ""
|
420 |
CS_target10 = f"{CS_destination_folder10}/{CS_filename10}"
|
421 |
|
|
|
423 |
os.makedirs(CS_destination_folder10, exist_ok=True)
|
424 |
response = requests.get(CS_url10)
|
425 |
with open(CS_target10, 'wb') as f:
|
426 |
+
f.write(response.bushu)
|
427 |
|
428 |
# 下载任务11
|
429 |
CS_download_task11 = False
|
430 |
CS_url11 = ""
|
431 |
+
CS_destination_folder11 = f"/bushu/{t}/models/Stable-diffusion"
|
432 |
CS_filename11 = ""
|
433 |
CS_target11 = f"{CS_destination_folder11}/{CS_filename11}"
|
434 |
|
|
|
436 |
os.makedirs(CS_destination_folder11, exist_ok=True)
|
437 |
response = requests.get(CS_url11)
|
438 |
with open(CS_target11, 'wb') as f:
|
439 |
+
f.write(response.bushu)
|
440 |
|
441 |
# 下载任务12
|
442 |
CS_download_task12 = False
|
443 |
CS_url12 = ""
|
444 |
+
CS_destination_folder12 = f"/bushu/{t}/models/Stable-diffusion"
|
445 |
CS_filename12 = ""
|
446 |
CS_target12 = f"{CS_destination_folder12}/{CS_filename12}"
|
447 |
|
|
|
449 |
os.makedirs(CS_destination_folder12, exist_ok=True)
|
450 |
response = requests.get(CS_url12)
|
451 |
with open(CS_target12, 'wb') as f:
|
452 |
+
f.write(response.bushu)
|
453 |
|
454 |
# 下载任务13
|
455 |
CS_download_task13 = False
|
456 |
CS_url13 = ""
|
457 |
+
CS_destination_folder13 = f"/bushu/{t}/models/Stable-diffusion"
|
458 |
CS_filename13 = ""
|
459 |
CS_target13 = f"{CS_destination_folder13}/{CS_filename13}"
|
460 |
|
|
|
462 |
os.makedirs(CS_destination_folder13, exist_ok=True)
|
463 |
response = requests.get(CS_url13)
|
464 |
with open(CS_target13, 'wb') as f:
|
465 |
+
f.write(response.bushu)
|
466 |
|
467 |
|
468 |
|
|
|
470 |
# Lora任务1
|
471 |
Lora_download_task1 = True
|
472 |
Lora_url1 = "https://civitai.com/api/download/models/64842"
|
473 |
+
Lora_destination_folder1 = "/bushu/{t}/models/Lora"
|
474 |
Lora_filename1 = "arona_puranalora_v1.safetensors"
|
475 |
Lora_target1 = os.path.join(Lora_destination_folder1, Lora_filename1)
|
476 |
|
|
|
478 |
response = requests.get(Lora_url1)
|
479 |
if response.status_code == 200:
|
480 |
with open(Lora_target1, 'wb') as f:
|
481 |
+
f.write(response.bushu)
|
482 |
|
483 |
# Lora任务2
|
484 |
Lora_download_task2 = False
|
485 |
Lora_url2 = "https://liblibai-online.liblibai.ai/web/model/25e9f1fa5137b2517b46c0a07f068e7328d5bd28744255d476c40e3ce61abed4.safetensors?attname=Xian-T%E6%89%8B%E9%83%A8%E4%BF%AE%E5%A4%8Dlora%EF%BC%88%E4%B8%8D%E7%94%A8controlnet%E4%B9%9F%E4%B8%8D%E5%9D%8F%E6%89%8B%E4%BA%86%EF%BC%89_v3.0.safetensors"
|
486 |
+
Lora_destination_folder2 = "/bushu/{t}/models/Lora"
|
487 |
Lora_filename2 = "Xian-T\u624B\u90E8\u4FEE\u590Dlora\uFF08\u4E0D%E7%94%A8controlnet%E4%B4%9B%E4%B8%8D%E5%9D%8F%E6%89%8B%E4%BA%86\uFF09_v3.0.safetensors"
|
488 |
Lora_target2 = os.path.join(Lora_destination_folder2, Lora_filename2)
|
489 |
|
|
|
491 |
response = requests.get(Lora_url2)
|
492 |
if response.status_code == 200:
|
493 |
with open(Lora_target2, 'wb') as f:
|
494 |
+
f.write(response.bushu)
|
495 |
|
496 |
# Lora任务3
|
497 |
Lora_download_task3 = True
|
498 |
Lora_url3 = "https://civitai.com/api/download/models/52900"
|
499 |
+
Lora_destination_folder3 = "/bushu/{t}/models/Lora"
|
500 |
Lora_filename3 = "cailaiarona-000007.safetensors"
|
501 |
Lora_target3 = os.path.join(Lora_destination_folder3, Lora_filename3)
|
502 |
|
|
|
504 |
response = requests.get(Lora_url3)
|
505 |
if response.status_code == 200:
|
506 |
with open(Lora_target3, 'wb') as f:
|
507 |
+
f.write(response.bushu)
|
508 |
|
509 |
# Lora任务4
|
510 |
Lora_download_task4 = True
|
|
|
517 |
response = requests.get(Lora_url4)
|
518 |
if response.status_code == 200:
|
519 |
with open(Lora_target4, 'wb') as f:
|
520 |
+
f.write(response.bushu)
|
521 |
|
522 |
# Lora任务5
|
523 |
Lora_download_task5 = False
|
|
|
530 |
response = requests.get(Lora_url5)
|
531 |
if response.status_code == 200:
|
532 |
with open(Lora_target5, 'wb') as f:
|
533 |
+
f.write(response.bushu)
|
534 |
|
535 |
# Lora任务6
|
536 |
Lora_download_task6 = False
|
|
|
543 |
response = requests.get(Lora_url6)
|
544 |
if response.status_code == 200:
|
545 |
with open(Lora_target6, 'wb') as f:
|
546 |
+
f.write(response.bushu)
|
547 |
|
548 |
|
549 |
# VAE下载
|
550 |
# VAE任务1
|
551 |
VAE_download_task1 = True
|
552 |
VAE_url1 = "https://civitai.com/api/download/models/25986"
|
553 |
+
VAE_destination_folder1 = "/bushu/{t}/models/VAE"
|
554 |
VAE_filename1 = "anypastelAnythingV45_anypastelAnythingV45.zip"
|
555 |
VAE_target1 = f"{VAE_destination_folder1}/{VAE_filename1}"
|
556 |
|
557 |
if VAE_download_task1:
|
558 |
response = requests.get(VAE_url1)
|
559 |
with open(VAE_target1, 'wb') as file:
|
560 |
+
file.write(response.bushu)
|
561 |
|
562 |
# VAE任务2
|
563 |
VAE_download_task2 = True
|
564 |
VAE_url2 = "https://civitai.com/api/download/models/64133"
|
565 |
+
VAE_destination_folder2 = "/bushu/{t}/models/VAE"
|
566 |
VAE_filename2 = "counterfeit.pt"
|
567 |
VAE_target2 = f"{VAE_destination_folder2}/{VAE_filename2}"
|
568 |
|
569 |
if VAE_download_task2:
|
570 |
response = requests.get(VAE_url2)
|
571 |
with open(VAE_target2, 'wb') as file:
|
572 |
+
file.write(response.bushu)
|
573 |
|
574 |
# VAE任务3
|
575 |
VAE_download_task3 = True
|
576 |
VAE_url3 = "https://civitai.com/api/download/models/80869?type=Model&format=Other"
|
577 |
+
VAE_destination_folder3 = "/bushu/{t}/models/VAE"
|
578 |
VAE_filename3 = "vaeFtMse840000Ema_v100.safetensors"
|
579 |
VAE_target3 = f"{VAE_destination_folder3}/{VAE_filename3}"
|
580 |
|
581 |
if VAE_download_task3:
|
582 |
response = requests.get(VAE_url3)
|
583 |
with open(VAE_target3, 'wb') as file:
|
584 |
+
file.write(response.bushu)
|
585 |
|
586 |
# VAE任务4
|
587 |
VAE_download_task4 = False
|
588 |
VAE_url4 = "https://huggingface.co/admruul/anything-v3.0/resolve/main/Anything-V3.0.vae.pt"
|
589 |
+
VAE_destination_folder4 = "/bushu/{t}/models/VAE"
|
590 |
VAE_filename4 = "Anything-V3.0.pt"
|
591 |
VAE_target4 = f"{VAE_destination_folder4}/{VAE_filename4}"
|
592 |
|
593 |
if VAE_download_task4:
|
594 |
response = requests.get(VAE_url4)
|
595 |
with open(VAE_target4, 'wb') as file:
|
596 |
+
file.write(response.bushu)
|
597 |
|
598 |
# VAE任务5
|
599 |
VAE_download_task5 = True
|
600 |
VAE_url5 = "https://civitai.com/api/download/models/131654?type=Model&format=SafeTensor"
|
601 |
+
VAE_destination_folder5 = "/bushu/{t}/models/VAE"
|
602 |
VAE_filename5 = "anythingKlF8Anime2VaeFtMse840000_klF8Anime2.safetensors"
|
603 |
VAE_target5 = f"{VAE_destination_folder5}/{VAE_filename5}"
|
604 |
|
605 |
if VAE_download_task5:
|
606 |
response = requests.get(VAE_url5)
|
607 |
with open(VAE_target5, 'wb') as file:
|
608 |
+
file.write(response.bushu)
|
609 |
|
610 |
# VAE任务6
|
611 |
VAE_download_task6 = True
|
612 |
VAE_url6 = "https://civitai.com/api/download/models/88156?type=Model&format=Other"
|
613 |
+
VAE_destination_folder6 = "/bushu/{t}/models/VAE"
|
614 |
VAE_filename6 = "ClearVAE.2.3.pt"
|
615 |
VAE_target6 = f"{VAE_destination_folder6}/{VAE_filename6}"
|
616 |
|
617 |
if VAE_download_task6:
|
618 |
response = requests.get(VAE_url6)
|
619 |
with open(VAE_target6, 'wb') as file:
|
620 |
+
file.write(response.bushu)
|
621 |
|
622 |
# VAE任务7
|
623 |
VAE_download_task7 = True
|
624 |
VAE_url7 = "https://civitai.com/api/download/models/121354?type=Model&format=Other"
|
625 |
+
VAE_destination_folder7 = "/bushu/{t}/models/VAE"
|
626 |
VAE_filename7 = "orangemix_v1.pt"
|
627 |
VAE_target7 = f"{VAE_destination_folder7}/{VAE_filename7}"
|
628 |
|
629 |
if VAE_download_task7:
|
630 |
response = requests.get(VAE_url7)
|
631 |
with open(VAE_target7, 'wb') as file:
|
632 |
+
file.write(response.bushu)
|
633 |
|
634 |
# VAE任务8
|
635 |
VAE_download_task8 = True
|
636 |
VAE_url8 = "https://civitai.com/api/download/models/28569?type=Model&format=Other"
|
637 |
+
VAE_destination_folder8 = "/bushu/{t}/models/VAE"
|
638 |
VAE_filename8 = "klF8Anime2_klF8Anime2VAE.pt"
|
639 |
VAE_target8 = f"{VAE_destination_folder8}/{VAE_filename8}"
|
640 |
|
641 |
if VAE_download_task8:
|
642 |
response = requests.get(VAE_url8)
|
643 |
with open(VAE_target8, 'wb') as file:
|
644 |
+
file.write(response.bushu)
|
645 |
|
646 |
# VAE任务9
|
647 |
VAE_download_task9 = False
|
648 |
VAE_url9 = ""
|
649 |
+
VAE_destination_folder9 = "/bushu/{t}/models/VAE"
|
650 |
VAE_filename9 = ""
|
651 |
VAE_target9 = f"{VAE_destination_folder9}/{VAE_filename9}"
|
652 |
|
653 |
if VAE_download_task9:
|
654 |
response = requests.get(VAE_url9)
|
655 |
with open(VAE_target9, 'wb') as file:
|
656 |
+
file.write(response.bushu)
|
657 |
|
658 |
# VAE任务10
|
659 |
VAE_download_task10 = False
|
660 |
VAE_url10 = ""
|
661 |
+
VAE_destination_folder10 = "/bushu/{t}/models/VAE"
|
662 |
VAE_filename10 = ""
|
663 |
VAE_target10 = f"{VAE_destination_folder10}/{VAE_filename10}"
|
664 |
|
665 |
if VAE_download_task10:
|
666 |
response = requests.get(VAE_url10)
|
667 |
with open(VAE_target10, 'wb') as file:
|
668 |
+
file.write(response.bushu)
|
669 |
|
670 |
# VAE任务11
|
671 |
VAE_download_task11 = False
|
672 |
VAE_url11 = ""
|
673 |
+
VAE_destination_folder11 = "/bushu/{t}/models/VAE"
|
674 |
VAE_filename11 = ""
|
675 |
VAE_target11 = f"{VAE_destination_folder11}/{VAE_filename11}"
|
676 |
|
677 |
if VAE_download_task11:
|
678 |
response = requests.get(VAE_url11)
|
679 |
with open(VAE_target11, 'wb') as file:
|
680 |
+
file.write(response.bushu)
|
681 |
|
682 |
# VAE任务12
|
683 |
VAE_download_task12 = False
|
684 |
VAE_url12 = ""
|
685 |
+
VAE_destination_folder12 = "/bushu/{t}/models/VAE"
|
686 |
VAE_filename12 = ""
|
687 |
VAE_target12 = f"{VAE_destination_folder12}/{VAE_filename12}"
|
688 |
|
689 |
if VAE_download_task12:
|
690 |
response = requests.get(VAE_url12)
|
691 |
with open(VAE_target12, 'wb') as file:
|
692 |
+
file.write(response.bushu)
|
693 |
|
694 |
# VAE任务13
|
695 |
VAE_download_task13 = False
|
696 |
VAE_url13 = ""
|
697 |
+
VAE_destination_folder13 = "/bushu/{t}/models/VAE"
|
698 |
VAE_filename13 = ""
|
699 |
VAE_target13 = f"{VAE_destination_folder13}/{VAE_filename13}"
|
700 |
|
701 |
if VAE_download_task13:
|
702 |
response = requests.get(VAE_url13)
|
703 |
with open(VAE_target13, 'wb') as file:
|
704 |
+
file.write(response.bushu)
|
705 |
|
706 |
|
707 |
|
|
|
711 |
os.makedirs(destination_folder, exist_ok=True)
|
712 |
response = requests.get(url)
|
713 |
with open(os.path.join(destination_folder, filename), 'wb') as file:
|
714 |
+
file.write(response.bushu)
|
715 |
|
716 |
# _下载任务1_
|
717 |
embeddings_download_task1 = True #@param {type:"boolean"}
|
718 |
embeddings_url1 = "https://civitai.com/api/download/models/125849"
|
719 |
+
embeddings_destination_folder1 = "/bushu/{t}/embeddings" #@ param {type:"string"}
|
720 |
embeddings_filename1 = "bad-hands-5.pt"
|
721 |
embeddings_target1 = f'{embeddings_destination_folder1}/{embeddings_filename1}'
|
722 |
|
|
|
726 |
# _下载任务2_
|
727 |
embeddings_download_task2 = False #@param {type:"boolean"}
|
728 |
embeddings_url2 = ""
|
729 |
+
embeddings_destination_folder2 = "/bushu/{t}/embeddings" #@ param {type:"string"}
|
730 |
embeddings_filename2 = ""
|
731 |
embeddings_target2 = f'{embeddings_destination_folder2}/{embeddings_filename2}'
|
732 |
|
|
|
736 |
# _下载任务3_
|
737 |
embeddings_download_task3 = False #@param {type:"boolean"}
|
738 |
embeddings_url3 = ""
|
739 |
+
embeddings_destination_folder3 = "/bushu/{t}/embeddings" #@ param {type:"string"}
|
740 |
embeddings_filename3 = ""
|
741 |
embeddings_target3 = f'{embeddings_destination_folder3}/{embeddings_filename3}'
|
742 |
|
|
|
746 |
# _下载任务4_
|
747 |
embeddings_download_task4 = False #@param {type:"boolean"}
|
748 |
embeddings_url4 = ""
|
749 |
+
embeddings_destination_folder4 = "/bushu/{t}/embeddings" #@ param {type:"string"}
|
750 |
embeddings_filename4 = ""
|
751 |
embeddings_target4 = f'{embeddings_destination_folder4}/{embeddings_filename4}'
|
752 |
|
|
|
756 |
# _下载任务5_
|
757 |
embeddings_download_task5 = False #@param {type:"boolean"}
|
758 |
embeddings_url5 = ""
|
759 |
+
embeddings_destination_folder5 = "/bushu/{t}/embeddings" #@ param {type:"string"}
|
760 |
embeddings_filename5 = ""
|
761 |
embeddings_target5 = f'{embeddings_destination_folder5}/{embeddings_filename5}'
|
762 |
|
|
|
793 |
w = binascii.unhexlify("7765627569").decode("ascii")
|
794 |
|
795 |
|
796 |
+
# 切换到/bushu/{t}目录
|
797 |
+
subprocess.run(["cd", "/bushu/{t}"], shell=True)
|
798 |
|
799 |
+
# 安装req{t}rements.txt中的依赖项
|
800 |
+
subprocess.run(["pip", "install", "-r", "/bushu/{t}/requirements.txt"])
|
801 |
|
802 |
|
803 |
|