TheLastBen
commited on
Commit
·
4a0108e
1
Parent(s):
ea27184
Update Scripts/mainpaperspaceA1111.py
Browse files
Scripts/mainpaperspaceA1111.py
CHANGED
@@ -214,6 +214,10 @@ def mdls(Original_Model_Version, Path_to_MODEL, MODEL_LINK, Temporary_Storage):
|
|
214 |
return filenm
|
215 |
|
216 |
|
|
|
|
|
|
|
|
|
217 |
if Path_to_MODEL !='':
|
218 |
if os.path.exists(str(Path_to_MODEL)):
|
219 |
print('[1;32mUsing the custom model.')
|
@@ -229,26 +233,36 @@ def mdls(Original_Model_Version, Path_to_MODEL, MODEL_LINK, Temporary_Storage):
|
|
229 |
model=f'/models/{modelname}'
|
230 |
else:
|
231 |
model=f'/notebooks/sd/stable-diffusion-webui/models/Stable-diffusion/{modelname}'
|
232 |
-
|
|
|
|
|
|
|
233 |
elif src=='gdrive':
|
234 |
modelname=get_name(MODEL_LINK, True)
|
235 |
if Temporary_Storage:
|
236 |
model=f'/models/{modelname}'
|
237 |
else:
|
238 |
model=f'/notebooks/sd/stable-diffusion-webui/models/Stable-diffusion/{modelname}'
|
239 |
-
|
|
|
|
|
|
|
240 |
else:
|
241 |
modelname=os.path.basename(MODEL_LINK)
|
242 |
if Temporary_Storage:
|
243 |
model=f'/models/{modelname}'
|
244 |
else:
|
245 |
model=f'/notebooks/sd/stable-diffusion-webui/models/Stable-diffusion/{modelname}'
|
246 |
-
|
|
|
|
|
|
|
247 |
|
248 |
if os.path.exists(model) and os.path.getsize(model) > 1810671599:
|
249 |
clear_output()
|
250 |
print('[1;32mModel downloaded, using the custom model.')
|
251 |
else:
|
|
|
252 |
print('[1;31mWrong link, check that the link is valid')
|
253 |
|
254 |
else:
|
|
|
214 |
return filenm
|
215 |
|
216 |
|
217 |
+
call('ln -s /datasets/stable-diffusion-classic/SDv1.5.ckpt /notebooks/sd/stable-diffusion-webui/models/Stable-diffusion', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
|
218 |
+
call('ln -s /datasets/stable-diffusion-v2-1-base-diffusers/stable-diffusion-2-1-base/v2-1_512-nonema-pruned.safetensors /notebooks/sd/stable-diffusion-webui/models/Stable-diffusion', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
|
219 |
+
call('ln -s /datasets/stable-diffusion-v2-1/stable-diffusion-2-1/v2-1_768-nonema-pruned.safetensors /notebooks/sd/stable-diffusion-webui/models/Stable-diffusion', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
|
220 |
+
|
221 |
if Path_to_MODEL !='':
|
222 |
if os.path.exists(str(Path_to_MODEL)):
|
223 |
print('[1;32mUsing the custom model.')
|
|
|
233 |
model=f'/models/{modelname}'
|
234 |
else:
|
235 |
model=f'/notebooks/sd/stable-diffusion-webui/models/Stable-diffusion/{modelname}'
|
236 |
+
if not os.path.exists(model):
|
237 |
+
dwn(MODEL_LINK, model, 'Downloading the custom model')
|
238 |
+
else:
|
239 |
+
print('[1;33mModel already exists')
|
240 |
elif src=='gdrive':
|
241 |
modelname=get_name(MODEL_LINK, True)
|
242 |
if Temporary_Storage:
|
243 |
model=f'/models/{modelname}'
|
244 |
else:
|
245 |
model=f'/notebooks/sd/stable-diffusion-webui/models/Stable-diffusion/{modelname}'
|
246 |
+
if not os.path.exists(model):
|
247 |
+
gdown.download(url=MODEL_LINK, output=model, quiet=False, fuzzy=True)
|
248 |
+
else:
|
249 |
+
print('[1;33mModel already exists')
|
250 |
else:
|
251 |
modelname=os.path.basename(MODEL_LINK)
|
252 |
if Temporary_Storage:
|
253 |
model=f'/models/{modelname}'
|
254 |
else:
|
255 |
model=f'/notebooks/sd/stable-diffusion-webui/models/Stable-diffusion/{modelname}'
|
256 |
+
if not os.path.exists(model):
|
257 |
+
gdown.download(url=MODEL_LINK, output=model, quiet=False, fuzzy=True)
|
258 |
+
else:
|
259 |
+
print('[1;33mModel already exists')
|
260 |
|
261 |
if os.path.exists(model) and os.path.getsize(model) > 1810671599:
|
262 |
clear_output()
|
263 |
print('[1;32mModel downloaded, using the custom model.')
|
264 |
else:
|
265 |
+
call('rm model', shell=True, stdout=open('/dev/null', 'w'), stderr=open('/dev/null', 'w'))
|
266 |
print('[1;31mWrong link, check that the link is valid')
|
267 |
|
268 |
else:
|