Update v2_3.py
Browse files
v2_3.py
CHANGED
@@ -125,6 +125,8 @@ subprocess.run(["mkdir", "-p", "/bushu/ui/models/ESRGAN"])
|
|
125 |
subprocess.run(["wget", "https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth", "-O", "/bushu/ui/models/ESRGAN/4x-UltraSharp.pth"])
|
126 |
|
127 |
|
|
|
|
|
128 |
|
129 |
# 使用subprocess运行git clone命令
|
130 |
def run_git_clone(repo_url, destination):
|
@@ -162,6 +164,7 @@ extensions_to_clone = [
|
|
162 |
for repo_url, destination in extensions_to_clone:
|
163 |
run_git_clone(repo_url, destination)
|
164 |
|
|
|
165 |
|
166 |
# 修改 launch.py 文件
|
167 |
with open('/bushu/ui/launch.py', 'r') as file:
|
@@ -212,6 +215,8 @@ def create_directory(directory):
|
|
212 |
subprocess.run(mkdir_command, check=True)
|
213 |
|
214 |
|
|
|
|
|
215 |
|
216 |
# 其它基本配置
|
217 |
CONTROLNET_ = True
|
@@ -230,7 +235,7 @@ if CONTROLNET_:
|
|
230 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_normalbae_fp16.safetensors')
|
231 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_openpose_fp16.safetensors')
|
232 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_scribble_fp16.safetensors')
|
233 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_seg_fp16.safetensors')
|
234 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_softedge_fp16.safetensors')
|
235 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15s2_lineart_anime_fp16.safetensors')
|
236 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_tile_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11e_sd15_tile_fp16.yaml')
|
@@ -285,6 +290,7 @@ with fileinput.FileInput('/bushu/ui/modules/shared.py', inplace=True, backup='.b
|
|
285 |
|
286 |
"""# 模型下载"""
|
287 |
|
|
|
288 |
# Checkpoints/safetensors等大模型下载
|
289 |
# 下载任务1
|
290 |
CS_download_task1 = False
|
@@ -458,6 +464,7 @@ if CS_download_task13:
|
|
458 |
|
459 |
|
460 |
#Lora模型下载
|
|
|
461 |
# Lora任务1
|
462 |
Lora_download_task1 = True
|
463 |
Lora_url1 = "https://civitai.com/api/download/models/64842"
|
@@ -538,6 +545,7 @@ if Lora_download_task6:
|
|
538 |
|
539 |
|
540 |
# VAE下载
|
|
|
541 |
# VAE任务1
|
542 |
VAE_download_task1 = True
|
543 |
VAE_url1 = "https://civitai.com/api/download/models/25986"
|
@@ -697,6 +705,7 @@ if VAE_download_task13:
|
|
697 |
|
698 |
|
699 |
# embeddings模型下载
|
|
|
700 |
# 下载函数
|
701 |
def download_file(url, destination_folder, filename):
|
702 |
os.makedirs(destination_folder, exist_ok=True)
|
@@ -756,33 +765,7 @@ if embeddings_download_task5:
|
|
756 |
|
757 |
|
758 |
|
759 |
-
|
760 |
-
|
761 |
-
|
762 |
-
#开始运行
|
763 |
-
|
764 |
-
# 初始化变量a、b、c和w的初始值
|
765 |
-
a = ""
|
766 |
-
b = ""
|
767 |
-
c = ""
|
768 |
-
d = ""
|
769 |
-
w = ""
|
770 |
-
|
771 |
-
# 构建变量a
|
772 |
-
a = binascii.unhexlify("737461626c65").decode("ascii")
|
773 |
-
|
774 |
-
# 构建变量b,使其等于a的首字母大写版本
|
775 |
-
b = binascii.unhexlify("537461626c65").decode("ascii")
|
776 |
-
|
777 |
-
# 构建变量c
|
778 |
-
c = binascii.unhexlify("7364").decode("ascii")
|
779 |
-
|
780 |
-
# 构建变量d
|
781 |
-
d = binascii.unhexlify("646966667573696f6e").decode("ascii")
|
782 |
-
|
783 |
-
# 构建变量w
|
784 |
-
w = binascii.unhexlify("7765627569").decode("ascii")
|
785 |
-
|
786 |
|
787 |
# 切换到/bushu/ui目录
|
788 |
subprocess.run(["cd", "/bushu/ui"], shell=True)
|
|
|
125 |
subprocess.run(["wget", "https://huggingface.co/embed/upscale/resolve/main/4x-UltraSharp.pth", "-O", "/bushu/ui/models/ESRGAN/4x-UltraSharp.pth"])
|
126 |
|
127 |
|
128 |
+
# 安装插件
|
129 |
+
print ("开始安装插件...")
|
130 |
|
131 |
# 使用subprocess运行git clone命令
|
132 |
def run_git_clone(repo_url, destination):
|
|
|
164 |
for repo_url, destination in extensions_to_clone:
|
165 |
run_git_clone(repo_url, destination)
|
166 |
|
167 |
+
print ("修改启动文件...")
|
168 |
|
169 |
# 修改 launch.py 文件
|
170 |
with open('/bushu/ui/launch.py', 'r') as file:
|
|
|
215 |
subprocess.run(mkdir_command, check=True)
|
216 |
|
217 |
|
218 |
+
# 安装可选模块
|
219 |
+
print ("安装可选模块...")
|
220 |
|
221 |
# 其它基本配置
|
222 |
CONTROLNET_ = True
|
|
|
235 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_normalbae_fp16.safetensors')
|
236 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_openpose_fp16.safetensors')
|
237 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_scribble_fp16.safetensors')
|
238 |
+
#wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_seg_fp16.safetensors')
|
239 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_softedge_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_softedge_fp16.safetensors')
|
240 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15s2_lineart_anime_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15s2_lineart_anime_fp16.safetensors')
|
241 |
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_tile_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11e_sd15_tile_fp16.yaml')
|
|
|
290 |
|
291 |
"""# 模型下载"""
|
292 |
|
293 |
+
print ("开始下载Checkpoints/safetensors等大模型")
|
294 |
# Checkpoints/safetensors等大模型下载
|
295 |
# 下载任务1
|
296 |
CS_download_task1 = False
|
|
|
464 |
|
465 |
|
466 |
#Lora模型下载
|
467 |
+
print("开始下载Lora模型")
|
468 |
# Lora任务1
|
469 |
Lora_download_task1 = True
|
470 |
Lora_url1 = "https://civitai.com/api/download/models/64842"
|
|
|
545 |
|
546 |
|
547 |
# VAE下载
|
548 |
+
print ("开始下载VAE模型")
|
549 |
# VAE任务1
|
550 |
VAE_download_task1 = True
|
551 |
VAE_url1 = "https://civitai.com/api/download/models/25986"
|
|
|
705 |
|
706 |
|
707 |
# embeddings模型下载
|
708 |
+
print ("开始下载embeddings模型")
|
709 |
# 下载函数
|
710 |
def download_file(url, destination_folder, filename):
|
711 |
os.makedirs(destination_folder, exist_ok=True)
|
|
|
765 |
|
766 |
|
767 |
|
768 |
+
print ("开始安装依赖")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
769 |
|
770 |
# 切换到/bushu/ui目录
|
771 |
subprocess.run(["cd", "/bushu/ui"], shell=True)
|