Skip to content

Commit

Permalink
load layerdiffuse models from model manager
Browse files Browse the repository at this point in the history
  • Loading branch information
db0 committed Jun 27, 2024
1 parent 1ba356d commit 2fd77cf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
26 changes: 13 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ repos:
- id: mypy
exclude: ^examples/.*$ # FIXME
additional_dependencies: [
pydantic,
strenum,
types-colorama,
types-docutils,
types-Pillow, types-psutil,
types-Pygments,
types-pywin32,
types-PyYAML,
types-regex,
types-requests,
types-setuptools,
types-tabulate,
pydantic,
strenum,
types-colorama,
types-docutils,
types-Pillow, types-psutil,
types-Pygments,
types-pywin32,
types-PyYAML,
types-regex,
types-requests,
types-setuptools,
types-tabulate,
types-tqdm,
types-urllib3,
types-urllib3,
horde_sdk==0.12.0,
]
14 changes: 1 addition & 13 deletions hordelib/nodes/comfyui_layerdiffuse/lib_layerdiffusion/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,7 @@ def load_file_from_url(
Returns the path to the downloaded file.
"""
from loguru import logger # Debug
logger.error(SharedModelManager.manager.miscellaneous.is_file_available(file_name))
os.makedirs(model_dir, exist_ok=True)
if not file_name:
parts = urlparse(url)
file_name = os.path.basename(parts.path)
cached_file = os.path.abspath(os.path.join(model_dir, file_name))
if not os.path.exists(cached_file):
print(f'Downloading: "{url}" to {cached_file}\n')
from torch.hub import download_url_to_file

download_url_to_file(url, cached_file, progress=progress)
return cached_file
return str(SharedModelManager.manager.miscellaneous.model_folder_path / file_name)


def to_lora_patch_dict(state_dict: dict) -> dict:
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def shared_model_manager(
assert SharedModelManager.manager is not None
assert SharedModelManager.manager.codeformer is not None
assert SharedModelManager.manager.codeformer.download_all_models()
assert SharedModelManager.manager.miscellaneous is not None
assert SharedModelManager.manager.miscellaneous.download_all_models()
assert SharedModelManager.manager.compvis is not None

assert SharedModelManager.manager.download_model("Deliberate")
Expand Down

0 comments on commit 2fd77cf

Please sign in to comment.