jhj0517
commited on
Commit
•
feac218
1
Parent(s):
c30ec73
refactor function
Browse files- downloading_weights.py +22 -18
downloading_weights.py
CHANGED
@@ -2,9 +2,13 @@ import os
|
|
2 |
import wget
|
3 |
from tqdm import tqdm
|
4 |
|
5 |
-
os.makedirs('pretrained_weights', exist_ok=True)
|
6 |
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
8 |
'https://huggingface.co/yzd-v/DWPose/resolve/main/dw-ll_ucoco_384.pth',
|
9 |
'https://huggingface.co/TMElyralab/MusePose/resolve/main/MusePose/denoising_unet.pth',
|
10 |
'https://huggingface.co/TMElyralab/MusePose/resolve/main/MusePose/motion_module.pth',
|
@@ -13,26 +17,26 @@ urls = ['https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_l_8x8_300e_
|
|
13 |
'https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/unet/diffusion_pytorch_model.bin',
|
14 |
'https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/image_encoder/pytorch_model.bin',
|
15 |
'https://huggingface.co/stabilityai/sd-vae-ft-mse/resolve/main/diffusion_pytorch_model.bin'
|
16 |
-
|
17 |
|
18 |
-
paths = ['dwpose', 'dwpose', 'MusePose', 'MusePose', 'MusePose', 'MusePose', 'sd-image-variations-diffusers/unet', 'image_encoder', 'sd-vae-ft-mse']
|
19 |
|
20 |
-
for path in paths:
|
21 |
-
|
22 |
|
23 |
-
# saving weights
|
24 |
-
for url, path in tqdm(zip(urls, paths)):
|
25 |
-
|
26 |
|
27 |
-
config_urls = ['https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/unet/config.json',
|
28 |
-
|
29 |
-
|
30 |
|
31 |
-
config_paths = ['sd-image-variations-diffusers/unet', 'image_encoder', 'sd-vae-ft-mse']
|
32 |
|
33 |
-
# saving config files
|
34 |
-
for url, path in tqdm(zip(config_urls, config_paths)):
|
35 |
-
|
36 |
|
37 |
-
# renaming model name as given in readme
|
38 |
-
os.rename('pretrained_weights/dwpose/yolox_l_8x8_300e_coco_20211126_140236-d3bd2b23.pth', 'pretrained_weights/dwpose/yolox_l_8x8_300e_coco.pth')
|
|
|
2 |
import wget
|
3 |
from tqdm import tqdm
|
4 |
|
|
|
5 |
|
6 |
+
def download_models(
|
7 |
+
models_dir:str = os.makedirs('pretrained_weights', exist_ok=True)
|
8 |
+
):
|
9 |
+
os.makedirs(models_dir, exist_ok=True)
|
10 |
+
|
11 |
+
urls = ['https://download.openmmlab.com/mmdetection/v2.0/yolox/yolox_l_8x8_300e_coco/yolox_l_8x8_300e_coco_20211126_140236-d3bd2b23.pth',
|
12 |
'https://huggingface.co/yzd-v/DWPose/resolve/main/dw-ll_ucoco_384.pth',
|
13 |
'https://huggingface.co/TMElyralab/MusePose/resolve/main/MusePose/denoising_unet.pth',
|
14 |
'https://huggingface.co/TMElyralab/MusePose/resolve/main/MusePose/motion_module.pth',
|
|
|
17 |
'https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/unet/diffusion_pytorch_model.bin',
|
18 |
'https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/image_encoder/pytorch_model.bin',
|
19 |
'https://huggingface.co/stabilityai/sd-vae-ft-mse/resolve/main/diffusion_pytorch_model.bin'
|
20 |
+
]
|
21 |
|
22 |
+
paths = ['dwpose', 'dwpose', 'MusePose', 'MusePose', 'MusePose', 'MusePose', 'sd-image-variations-diffusers/unet', 'image_encoder', 'sd-vae-ft-mse']
|
23 |
|
24 |
+
for path in paths:
|
25 |
+
os.makedirs(f'pretrained_weights/{path}', exist_ok=True)
|
26 |
|
27 |
+
# saving weights
|
28 |
+
for url, path in tqdm(zip(urls, paths)):
|
29 |
+
filename = wget.download(url, f'pretrained_weights/{path}')
|
30 |
|
31 |
+
config_urls = ['https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/unet/config.json',
|
32 |
+
'https://huggingface.co/lambdalabs/sd-image-variations-diffusers/resolve/main/image_encoder/config.json',
|
33 |
+
'https://huggingface.co/stabilityai/sd-vae-ft-mse/resolve/main/config.json']
|
34 |
|
35 |
+
config_paths = ['sd-image-variations-diffusers/unet', 'image_encoder', 'sd-vae-ft-mse']
|
36 |
|
37 |
+
# saving config files
|
38 |
+
for url, path in tqdm(zip(config_urls, config_paths)):
|
39 |
+
filename = wget.download(url, f'pretrained_weights/{path}')
|
40 |
|
41 |
+
# renaming model name as given in readme
|
42 |
+
os.rename('pretrained_weights/dwpose/yolox_l_8x8_300e_coco_20211126_140236-d3bd2b23.pth', 'pretrained_weights/dwpose/yolox_l_8x8_300e_coco.pth')
|