fix call signature of import_diffuser_model() (#2871)

This fixes the borked #2867 PR.
This commit is contained in:
Lincoln Stein 2023-03-05 23:58:08 -05:00 committed by GitHub
commit a305b6adbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 7 deletions

View File

@ -6,5 +6,4 @@ from .convert_ckpt_to_diffusers import (
load_pipeline_from_original_stable_diffusion_ckpt,
)
from .model_manager import ModelManager
from invokeai.frontend.merge import merge_diffusion_models

View File

@ -538,7 +538,7 @@ class ModelManager(object):
self,
repo_or_path: Union[str, Path],
model_name: str = None,
model_description: str = None,
description: str = None,
vae: dict = None,
commit_to_conf: Path = None,
) -> bool:
@ -941,7 +941,7 @@ class ModelManager(object):
"openai/clip-vit-large-patch14/models--openai--clip-vit-large-patch14"
),
]
legacy_locations.extend(list(Path(models_dir,"diffusers").glob('*')))
legacy_locations.extend(list(global_cache_dir("diffusers").glob('*')))
legacy_layout = False
for model in legacy_locations:
@ -950,9 +950,17 @@ class ModelManager(object):
return
print(
"** Old model directory layout (< v3.0) detected. Reorganizing."
"""
>> ALERT:
>> The location of your previously-installed diffusers models needs to move from
>> invokeai/models/diffusers to invokeai/models/hub due to a change introduced by
>> diffusers version 0.14. InvokeAI will now move all models from the "diffusers" directory
>> into "hub" and then remove the diffusers directory. This is a quick, safe, one-time
>> operation. However if you have customized either of these directories and need to
>> make adjustments, please press ctrl-C now to abort and relaunch InvokeAI when you are ready.
>> Otherwise press <enter> to continue."""
)
print("** This is a quick one-time operation.")
input('continue> ')
# transformer files get moved into the hub directory
if cls._is_huggingface_hub_directory_present():
@ -971,7 +979,10 @@ class ModelManager(object):
if dest.is_symlink():
print(f"** Found symlink at {dest.name}. Not migrating.")
elif dest.exists():
rmtree(source)
if source.is_dir():
rmtree(source)
else:
source.unlink()
else:
move(source, dest)

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
cd invokeai/frontend/ && npm run lint-staged
cd invokeai/frontend/web && npm run lint-staged