Spaces:
Running
on
A10G
Running
on
A10G
File size: 1,658 Bytes
96a9519 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
import os, json, gdown
def custom_makedirs(path):
if not os.access(path, os.F_OK):
os.makedirs(path)
custom_makedirs('checkpoints/drag')
custom_makedirs('checkpoints/diffusion_body')
custom_makedirs('checkpoints/i2i/lora')
custom_makedirs('checkpoints/i2v/unet')
custom_makedirs('checkpoints/i2v/dreambooth')
FILE_JS = [
# 'scripts/i2i_lora.json',
# 'scripts/i2v_dreambooth.json',
# 'scripts/i2v_unet.json',
# 'scripts/drag.json'
'scripts/simple.json'
]
DIR_JS = [
'scripts/kohaku-v2.1.json',
'scripts/stable-diffusion-v1-5.json'
]
# download diffusion models
for js in DIR_JS:
with open(js, 'r', encoding='utf-8') as f:
dir_dict = json.load(f)
for file_url, file_out in dir_dict.items():
file_dir = os.path.dirname(file_out)
if not os.access(file_dir, os.F_OK):
os.makedirs(file_dir)
try:
if 'drive.google.com' in file_url:
gdown.download(url=file_url, output=file_out)
else:
os.system(f'wget --show-progress --progress=dot:giga -c {file_url} -O {file_out}')
except:
print(f'{file_url} download error')
# download single files
for js in FILE_JS:
with open(js, 'r', encoding='utf-8') as f:
file_dict = json.load(f)
for file_url, file_out in file_dict.items():
try:
if 'drive.google.com' in file_url:
gdown.download(url=file_url, output=file_out)
else:
os.system(f'wget --show-progress --progress=dot:giga -c {file_url} -O {file_out}')
except:
print(f'{file_url} download error')
|