Update “sd_clsa_webui_colab_ipynb”_修复v2_3.py
Browse files
“sd_clsa_webui_colab_ipynb”_修复v2_3.py
CHANGED
@@ -188,9 +188,22 @@ for repo_url, destination in extensions_to_clone:
|
|
188 |
run_git_clone(repo_url, destination)
|
189 |
|
190 |
# 使用subprocess运行sed命令
|
191 |
-
|
192 |
-
|
193 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
|
195 |
# 汉化
|
196 |
run_git_clone(f"https://github.com/dtlnor/{st}-localization-zh_CN", f"{extensions_path}/{st}-localization-zh_CN-main")
|
|
|
188 |
run_git_clone(repo_url, destination)
|
189 |
|
190 |
# 使用subprocess运行sed命令
|
191 |
+
|
192 |
+
# 定义要执行的sed命令
|
193 |
+
sed_command_1 = '''/from modules import launch_utils/a\\import os'''
|
194 |
+
sed_command_2 = '''/prepare_environment()/a\\ os.system(f"sed -i -e 's/stable/dict()))/dict())).cuda()/g' /content/ui/repositories/diffusion-stability-stable/ldm/util.py")'''
|
195 |
+
sed_command_3 = 's/\\["sd_model_checkpoint"\\]/\\["sd_model_checkpoint","sd_vae","CLIP_stop_at_last_layers"\\]/g'
|
196 |
+
|
197 |
+
# 定义要操作的文件路径
|
198 |
+
launch_py_path = "/content/ui/launch.py"
|
199 |
+
util_py_path = "/content/ui/repositories/diffusion-stability-stable/ldm/util.py"
|
200 |
+
shared_py_path = "/content/ui/modules/shared.py"
|
201 |
+
|
202 |
+
# 执行sed命令
|
203 |
+
subprocess.run(["sed", "-i", "-e", sed_command_1, launch_py_path])
|
204 |
+
subprocess.run(["sed", "-i", "-e", sed_command_2, launch_py_path])
|
205 |
+
subprocess.run(["sed", "-i", "-e", sed_command_3, shared_py_path])
|
206 |
+
|
207 |
|
208 |
# 汉化
|
209 |
run_git_clone(f"https://github.com/dtlnor/{st}-localization-zh_CN", f"{extensions_path}/{st}-localization-zh_CN-main")
|