Update v2_3.py
Browse files
v2_3.py
CHANGED
@@ -164,25 +164,25 @@ for repo_url, destination in extensions_to_clone:
|
|
164 |
|
165 |
|
166 |
# 修改 launch.py 文件
|
167 |
-
with open('/
|
168 |
lines = file.readlines()
|
169 |
|
170 |
-
with open('/
|
171 |
for line in lines:
|
172 |
if 'from modules import launch_utils' in line:
|
173 |
file.write('import os\n')
|
174 |
elif 'prepare_environment()' in line:
|
175 |
-
file.write(' os.system(f\'sed -i -e \'\'\'s/stable/dict()))/dict())).cuda()/g\'\'\' /
|
176 |
else:
|
177 |
file.write(line)
|
178 |
|
179 |
# 修改 shared.py 文件
|
180 |
-
with open('/
|
181 |
content = file.read()
|
182 |
|
183 |
content = content.replace('["sd_model_checkpoint"]', '["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"]')
|
184 |
|
185 |
-
with open('/
|
186 |
file.write(content)
|
187 |
|
188 |
|
@@ -219,62 +219,62 @@ T2I_ = True
|
|
219 |
|
220 |
# CN
|
221 |
if CONTROLNET_:
|
222 |
-
os.makedirs('/
|
223 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors', '/
|
224 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors', '/
|
225 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors', '/
|
226 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors', '/
|
227 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors', '/
|
228 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors', '/
|
229 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors', '/
|
230 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_normalbae_fp16.safetensors', '/
|
231 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_openpose_fp16.safetensors', '/
|
232 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_scribble_fp16.safetensors', '/
|
233 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_seg_fp16.safetensors', '/
|
234 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/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', '/
|
236 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_tile_fp16.yaml', '/
|
237 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_ip2p_fp16.yaml', '/
|
238 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_shuffle_fp16.yaml', '/
|
239 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_canny_fp16.yaml', '/
|
240 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1p_sd15_depth_fp16.yaml', '/
|
241 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_inpaint_fp16.yaml', '/
|
242 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_lineart_fp16.yaml', '/
|
243 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_mlsd_fp16.yaml', '/
|
244 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_normalbae_fp16.yaml', '/
|
245 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_openpose_fp16.yaml', '/
|
246 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_scribble_fp16.yaml', '/
|
247 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_seg_fp16.yaml', '/
|
248 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_softedge_fp16.yaml', '/
|
249 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15s2_lineart_anime_fp16.yaml', '/
|
250 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1e_sd15_tile_fp16.yaml', '/
|
251 |
|
252 |
# T2I
|
253 |
if T2I_:
|
254 |
-
os.makedirs('/
|
255 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_style_sd14v1.pth', '/
|
256 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd14v1.pth', '/
|
257 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_seg_sd14v1.pth', '/
|
258 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_openpose_sd14v1.pth', '/
|
259 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_keypose_sd14v1.pth', '/
|
260 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd14v1.pth', '/
|
261 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_color_sd14v1.pth', '/
|
262 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd14v1.pth', '/
|
263 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd15v2.pth', '/
|
264 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd15v2.pth', '/
|
265 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd15v2.pth', '/
|
266 |
-
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_zoedepth_sd15v1.pth', '/
|
267 |
|
268 |
# 修改文件
|
269 |
-
with fileinput.FileInput('/
|
270 |
for line in file:
|
271 |
print(line.replace('from modules import launch_utils', 'import os'), end='')
|
272 |
|
273 |
-
with fileinput.FileInput('/
|
274 |
for line in file:
|
275 |
-
print(line.replace('prepare_environment()', 'os.system(f"""sed -i -e \'\'\'s/dict()))/dict())).cuda()/g\"\'\' /
|
276 |
|
277 |
-
with fileinput.FileInput('/
|
278 |
for line in file:
|
279 |
print(line.replace('["sd_model_checkpoint"]', '["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"]'), end='')
|
280 |
|
|
|
164 |
|
165 |
|
166 |
# 修改 launch.py 文件
|
167 |
+
with open('/bushu/ui/launch.py', 'r') as file:
|
168 |
lines = file.readlines()
|
169 |
|
170 |
+
with open('/bushu/ui/launch.py', 'w') as file:
|
171 |
for line in lines:
|
172 |
if 'from modules import launch_utils' in line:
|
173 |
file.write('import os\n')
|
174 |
elif 'prepare_environment()' in line:
|
175 |
+
file.write(' os.system(f\'sed -i -e \'\'\'s/stable/dict()))/dict())).cuda()/g\'\'\' /bushu/ui/repositories/diffusion-stability-stable/ldm/util.py\')\n')
|
176 |
else:
|
177 |
file.write(line)
|
178 |
|
179 |
# 修改 shared.py 文件
|
180 |
+
with open('/bushu/ui/modules/shared.py', 'r') as file:
|
181 |
content = file.read()
|
182 |
|
183 |
content = content.replace('["sd_model_checkpoint"]', '["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"]')
|
184 |
|
185 |
+
with open('/bushu/ui/modules/shared.py', 'w') as file:
|
186 |
file.write(content)
|
187 |
|
188 |
|
|
|
219 |
|
220 |
# CN
|
221 |
if CONTROLNET_:
|
222 |
+
os.makedirs('/bushu/ui/extensions/control/models', exist_ok=True)
|
223 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_ip2p_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11e_sd15_ip2p_fp16.safetensors')
|
224 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11e_sd15_shuffle_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11e_sd15_shuffle_fp16.safetensors')
|
225 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_canny_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_canny_fp16.safetensors')
|
226 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11f1p_sd15_depth_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11f1p_sd15_depth_fp16.safetensors')
|
227 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_inpaint_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_inpaint_fp16.safetensors')
|
228 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_lineart_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_lineart_fp16.safetensors')
|
229 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/control_v11p_sd15_mlsd_fp16.safetensors', '/bushu/ui/extensions/control/models/control_v11p_sd15_mlsd_fp16.safetensors')
|
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')
|
237 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_ip2p_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11e_sd15_ip2p_fp16.yaml')
|
238 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11e_sd15_shuffle_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11e_sd15_shuffle_fp16.yaml')
|
239 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_canny_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11p_sd15_canny_fp16.yaml')
|
240 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1p_sd15_depth_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11f1p_sd15_depth_fp16.yaml')
|
241 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_inpaint_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11p_sd15_inpaint_fp16.yaml')
|
242 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_lineart_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11p_sd15_lineart_fp16.yaml')
|
243 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_mlsd_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11p_sd15_mlsd_fp16.yaml')
|
244 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_normalbae_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11p_sd15_normalbae_fp16.yaml')
|
245 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_openpose_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11p_sd15_openpose_fp16.yaml')
|
246 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_scribble_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11p_sd15_scribble_fp16.yaml')
|
247 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_seg_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11p_sd15_seg_fp16.yaml')
|
248 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15_softedge_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11p_sd15_softedge_fp16.yaml')
|
249 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11p_sd15s2_lineart_anime_fp16.yaml', '/bushu/ui/extensions/control/models/control_v11p_sd15s2_lineart_anime_fp16.yaml')
|
250 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/raw/main/control_v11f1e_sd15_tile_fp16.yaml', '/bushu/ui/extensions/control/models')
|
251 |
|
252 |
# T2I
|
253 |
if T2I_:
|
254 |
+
os.makedirs('/bushu/ui/extensions/control/models', exist_ok=True)
|
255 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_style_sd14v1.pth', '/bushu/ui/extensions/control/models/t2iadapter_style_sd14v1.pth')
|
256 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd14v1.pth', '/bushu/ui/extensions/control/models/t2iadapter_sketch_sd14v1.pth')
|
257 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_seg_sd14v1.pth', '/bushu/ui/extensions/control/models/t2iadapter_seg_sd14v1.pth')
|
258 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_openpose_sd14v1.pth', '/bushu/ui/extensions/control/models/t2iadapter_openpose_sd14v1.pth')
|
259 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_keypose_sd14v1.pth', '/bushu/ui/extensions/control/models/t2iadapter_keypose_sd14v1.pth')
|
260 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd14v1.pth', '/bushu/ui/extensions/control/models/t2iadapter_depth_sd14v1.pth')
|
261 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_color_sd14v1.pth', '/bushu/ui/extensions/control/models/t2iadapter_color_sd14v1.pth')
|
262 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd14v1.pth', '/bushu/ui/extensions/control/models/t2iadapter_canny_sd14v1.pth')
|
263 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_canny_sd15v2.pth', '/bushu/ui/extensions/control/models/t2iadapter_canny_sd15v2.pth')
|
264 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_depth_sd15v2.pth', '/bushu/ui/extensions/control/models/t2iadapter_depth_sd15v2.pth')
|
265 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_sketch_sd15v2.pth', '/bushu/ui/extensions/control/models/t2iadapter_sketch_sd15v2.pth')
|
266 |
+
wget.download('https://huggingface.co/ckpt/ControlNet-v1-1/resolve/main/t2iadapter_zoedepth_sd15v1.pth', '/bushu/ui/extensions/control/models/t2iadapter_zoedepth_sd15v1.pth')
|
267 |
|
268 |
# 修改文件
|
269 |
+
with fileinput.FileInput('/bushu/ui/launch.py', inplace=True, backup='.bak') as file:
|
270 |
for line in file:
|
271 |
print(line.replace('from modules import launch_utils', 'import os'), end='')
|
272 |
|
273 |
+
with fileinput.FileInput('/bushu/ui/launch.py', inplace=True, backup='.bak') as file:
|
274 |
for line in file:
|
275 |
+
print(line.replace('prepare_environment()', 'os.system(f"""sed -i -e \'\'\'s/dict()))/dict())).cuda()/g\"\'\' /bushu/ui/repositories/stable-diffusion-stability-ai/ldm/util.py\"")'), end='')
|
276 |
|
277 |
+
with fileinput.FileInput('/bushu/ui/modules/shared.py', inplace=True, backup='.bak') as file:
|
278 |
for line in file:
|
279 |
print(line.replace('["sd_model_checkpoint"]', '["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"]'), end='')
|
280 |
|