root
commited on
Commit
·
a83a0d3
1
Parent(s):
256a090
more directory updates
Browse files- src/utils/download_models.py +14 -4
src/utils/download_models.py
CHANGED
|
@@ -5,8 +5,13 @@ from huggingface_hub import hf_hub_download
|
|
| 5 |
|
| 6 |
|
| 7 |
def prepare_base_model():
|
| 8 |
-
|
| 9 |
-
os.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
for hub_file in ["unet/config.json", "unet/diffusion_pytorch_model.bin"]:
|
| 11 |
path = Path(hub_file)
|
| 12 |
saved_path = local_dir / path
|
|
@@ -21,8 +26,13 @@ def prepare_base_model():
|
|
| 21 |
|
| 22 |
|
| 23 |
def prepare_image_encoder():
|
| 24 |
-
|
| 25 |
-
os.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
for hub_file in ["image_encoder/config.json", "image_encoder/pytorch_model.bin"]:
|
| 27 |
path = Path(hub_file)
|
| 28 |
saved_path = local_dir / path
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
def prepare_base_model():
|
| 8 |
+
base_dir = os.path.dirname(os.path.abspath(__file__))
|
| 9 |
+
config_path = os.path.join(base_dir, 'pretrained_weights', 'stable-diffusion-v1-5')
|
| 10 |
+
|
| 11 |
+
if not os.path.exists(config_path):
|
| 12 |
+
raise FileNotFoundError(f"The stable-diffusion-v1-5 folder was not found at: {config_path}")
|
| 13 |
+
|
| 14 |
+
os.makedirs(config_path, exist_ok=True)
|
| 15 |
for hub_file in ["unet/config.json", "unet/diffusion_pytorch_model.bin"]:
|
| 16 |
path = Path(hub_file)
|
| 17 |
saved_path = local_dir / path
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
def prepare_image_encoder():
|
| 29 |
+
base_dir = os.path.dirname(os.path.abspath(__file__))
|
| 30 |
+
config_path = os.path.join(base_dir, 'pretrained_weights')
|
| 31 |
+
|
| 32 |
+
if not os.path.exists(config_path):
|
| 33 |
+
raise FileNotFoundError(f"The pretrained_weights folder was not found at: {config_path}")
|
| 34 |
+
|
| 35 |
+
os.makedirs(config_path, exist_ok=True)
|
| 36 |
for hub_file in ["image_encoder/config.json", "image_encoder/pytorch_model.bin"]:
|
| 37 |
path = Path(hub_file)
|
| 38 |
saved_path = local_dir / path
|