Spaces:
Runtime error
Runtime error
add SD weights
Browse files
app.py
CHANGED
@@ -32,6 +32,7 @@ import torchvision
|
|
32 |
import pdb
|
33 |
os.environ['CUDA_VISIBLE_DEVICES']='1'
|
34 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
|
|
35 |
##
|
36 |
|
37 |
# load safety model
|
@@ -344,8 +345,12 @@ if os.path.exists(opt.ckpt):
|
|
344 |
model = load_model_from_config(config, f"{opt.ckpt}")
|
345 |
else:
|
346 |
print('No pretrained weights found in ', opt.ckpt)
|
347 |
-
print('Falling back to random weights...')
|
348 |
-
model = instantiate_from_config(config.model)
|
|
|
|
|
|
|
|
|
349 |
|
350 |
model = model.to(device)
|
351 |
|
|
|
32 |
import pdb
|
33 |
os.environ['CUDA_VISIBLE_DEVICES']='1'
|
34 |
device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
|
35 |
+
import subprocess
|
36 |
##
|
37 |
|
38 |
# load safety model
|
|
|
345 |
model = load_model_from_config(config, f"{opt.ckpt}")
|
346 |
else:
|
347 |
print('No pretrained weights found in ', opt.ckpt)
|
348 |
+
# print('Falling back to random weights...')
|
349 |
+
# model = instantiate_from_config(config.model)
|
350 |
+
|
351 |
+
print('Downloading stable diffusion pretrained weights')
|
352 |
+
SD_PRETRAINED_PATH = 'https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt'
|
353 |
+
subprocess.call(['sh', './download.sh'])
|
354 |
|
355 |
model = model.to(device)
|
356 |
|
stable-diffusion/models/ldm/stable-diffusion-v1/download.sh β download.sh
RENAMED
@@ -1,2 +1,2 @@
|
|
1 |
wget https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt
|
2 |
-
|
|
|
1 |
wget https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt
|
2 |
+
mv v1-5-pruned-emaonly.ckpt ./stable-diffusion/models/ldm/stable-diffusion-v1/model.ckpt
|