Commit
·
a3bb004
1
Parent(s):
7b8cfd8
Update Scripts/mainpaperspaceA1111.py
Browse files
Scripts/mainpaperspaceA1111.py
CHANGED
@@ -5,6 +5,8 @@ import time
|
|
5 |
import sys
|
6 |
import fileinput
|
7 |
import ipywidgets as widgets
|
|
|
|
|
8 |
|
9 |
|
10 |
def Deps(force_reinstall):
|
@@ -120,6 +122,10 @@ def mdl(Original_Model_Version, Path_to_MODEL, MODEL_LINK, safetensors, Temporar
|
|
120 |
else:
|
121 |
model=""
|
122 |
print('[1;31mWrong model version')
|
|
|
|
|
|
|
|
|
123 |
|
124 |
return model
|
125 |
|
@@ -149,6 +155,7 @@ def CN(ControlNet_Model):
|
|
149 |
call('git pull', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
|
150 |
os.chdir('/notebooks')
|
151 |
|
|
|
152 |
mdldir="/notebooks/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/models"
|
153 |
|
154 |
call('wget -q -O CN_models.txt https://github.com/TheLastBen/fast-stable-diffusion/raw/main/AUTOMATIC1111_files/CN_models.txt', shell=True)
|
@@ -170,7 +177,7 @@ def CN(ControlNet_Model):
|
|
170 |
|
171 |
|
172 |
|
173 |
-
def sd(User, Password, Use_localtunnel):
|
174 |
|
175 |
auth=f"--gradio-auth {User}:{Password}"
|
176 |
if User =="" or Password=="":
|
@@ -209,7 +216,7 @@ def sd(User, Password, Use_localtunnel):
|
|
209 |
line = ''
|
210 |
sys.stdout.write(line)
|
211 |
|
212 |
-
call('rm srv.txt srvr.txt', shell=True)
|
213 |
|
214 |
os.chdir('/notebooks/sd/stable-diffusion-webui/modules')
|
215 |
call('wget -q -O paths.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/paths.py', shell=True)
|
@@ -217,7 +224,14 @@ def sd(User, Password, Use_localtunnel):
|
|
217 |
os.chdir('/notebooks/sd/stable-diffusion-webui')
|
218 |
clear_output()
|
219 |
|
220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
221 |
|
222 |
return configf
|
223 |
|
|
|
5 |
import sys
|
6 |
import fileinput
|
7 |
import ipywidgets as widgets
|
8 |
+
from torch.hub import download_url_to_file
|
9 |
+
from urllib.parse import urlparse
|
10 |
|
11 |
|
12 |
def Deps(force_reinstall):
|
|
|
122 |
else:
|
123 |
model=""
|
124 |
print('[1;31mWrong model version')
|
125 |
+
try:
|
126 |
+
model
|
127 |
+
except:
|
128 |
+
model="/notebooks/sd/stable-diffusion-webui/models/Stable-diffusion"
|
129 |
|
130 |
return model
|
131 |
|
|
|
155 |
call('git pull', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
|
156 |
os.chdir('/notebooks')
|
157 |
|
158 |
+
call('cp /notebooks/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/models/*.yaml /notebooks/sd/stable-diffusion-webui/models', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
|
159 |
mdldir="/notebooks/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/models"
|
160 |
|
161 |
call('wget -q -O CN_models.txt https://github.com/TheLastBen/fast-stable-diffusion/raw/main/AUTOMATIC1111_files/CN_models.txt', shell=True)
|
|
|
177 |
|
178 |
|
179 |
|
180 |
+
def sd(User, Password, Use_localtunnel, model):
|
181 |
|
182 |
auth=f"--gradio-auth {User}:{Password}"
|
183 |
if User =="" or Password=="":
|
|
|
216 |
line = ''
|
217 |
sys.stdout.write(line)
|
218 |
|
219 |
+
call('rm srv.txt srvr.txt', shell=True)
|
220 |
|
221 |
os.chdir('/notebooks/sd/stable-diffusion-webui/modules')
|
222 |
call('wget -q -O paths.py https://raw.githubusercontent.com/TheLastBen/fast-stable-diffusion/main/AUTOMATIC1111_files/paths.py', shell=True)
|
|
|
224 |
os.chdir('/notebooks/sd/stable-diffusion-webui')
|
225 |
clear_output()
|
226 |
|
227 |
+
|
228 |
+
if os.path.isfile(model):
|
229 |
+
mdlpth="--ckpt "+model
|
230 |
+
else:
|
231 |
+
mdlpth="--ckpt-dir "+model
|
232 |
+
|
233 |
+
|
234 |
+
configf="--disable-console-progressbars --no-half-vae --disable-safe-unpickle --api --no-download-sd-model --xformers --enable-insecure-extension-access --skip-version-check "+auth+" "+share+" "+mdlpth
|
235 |
|
236 |
return configf
|
237 |
|