Skip to content

Commit

Permalink
allow embeddings download
Browse files Browse the repository at this point in the history
  • Loading branch information
lllyasviel committed Oct 13, 2023
1 parent 2f6843d commit 9efa4ec
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from build_launcher import build_launcher
from modules.launch_util import is_installed, run, python, run_pip, requirements_met
from modules.model_loader import load_file_from_url
from modules.path import modelfile_path, lorafile_path, vae_approx_path, fooocus_expansion_path, checkpoint_downloads
from modules.path import modelfile_path, lorafile_path, vae_approx_path, fooocus_expansion_path, \
checkpoint_downloads, embeddings_path, embeddings_downloads


REINSTALL_ALL = False
Expand Down Expand Up @@ -63,6 +64,8 @@ def prepare_environment():
def download_models():
for file_name, url in checkpoint_downloads.items():
load_file_from_url(url=url, model_dir=modelfile_path, file_name=file_name)
for file_name, url in embeddings_downloads.items():
load_file_from_url(url=url, model_dir=embeddings_path, file_name=file_name)
for file_name, url in lora_filenames:
load_file_from_url(url=url, model_dir=lorafile_path, file_name=file_name)
for file_name, url in vae_approx_filenames:
Expand Down
5 changes: 5 additions & 0 deletions modules/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ def get_config_item_or_set_default(key, default_value, validator, disable_empty_
},
validator=lambda x: isinstance(x, dict) and all(isinstance(k, str) and isinstance(v, str) for k, v in x.items())
)
embeddings_downloads = get_config_item_or_set_default(
key='embeddings_downloads',
default_value={},
validator=lambda x: isinstance(x, dict) and all(isinstance(k, str) and isinstance(v, str) for k, v in x.items())
)
default_aspect_ratio = get_config_item_or_set_default(
key='default_aspect_ratio',
default_value='1152*896',
Expand Down
1 change: 1 addition & 0 deletions presets/anime.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"sd_xl_base_1.0_0.9vae.safetensors": "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors",
"sd_xl_refiner_1.0_0.9vae.safetensors": "https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0_0.9vae.safetensors"
},
"embeddings_downloads": {},
"default_aspect_ratio": "1152*896"
}
1 change: 1 addition & 0 deletions presets/realistic.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"sd_xl_base_1.0_0.9vae.safetensors": "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors",
"sd_xl_refiner_1.0_0.9vae.safetensors": "https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0_0.9vae.safetensors"
},
"embeddings_downloads": {},
"default_aspect_ratio": "1152*896"
}
1 change: 1 addition & 0 deletions presets/sdxl.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"sd_xl_base_1.0_0.9vae.safetensors": "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0_0.9vae.safetensors",
"sd_xl_refiner_1.0_0.9vae.safetensors": "https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0_0.9vae.safetensors"
},
"embeddings_downloads": {},
"default_aspect_ratio": "1152*896"
}

0 comments on commit 9efa4ec

Please sign in to comment.