From e29c9a7d9e359df3bee2ab0fd2eebfcd9054071a Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Thu, 23 Feb 2023 01:00:14 -0500 Subject: [PATCH] fix CLI import of diffusers by repo_id - Fix a bug in the CLI which prevented diffusers imported by their repo_ids from being correctly registered in the current session (though they install correctly) - Capitalize the "i" in Imported in the autogenerated descriptions. --- ldm/invoke/CLI.py | 2 +- ldm/invoke/model_manager.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ldm/invoke/CLI.py b/ldm/invoke/CLI.py index 19115dab0b..1d76b68a66 100644 --- a/ldm/invoke/CLI.py +++ b/ldm/invoke/CLI.py @@ -672,7 +672,7 @@ def import_model(model_path: str, gen, opt, completer, convert=False) -> str: gen.model_manager.commit(opt.conf) completer.update_models(gen.model_manager.list_models()) - print(f">> {model_name} successfully installed") + print(f">> {imported_name} successfully installed") def _verify_load(model_name: str, gen) -> bool: print(">> Verifying that new model loads...") diff --git a/ldm/invoke/model_manager.py b/ldm/invoke/model_manager.py index 923c08fd68..2efe494a19 100644 --- a/ldm/invoke/model_manager.py +++ b/ldm/invoke/model_manager.py @@ -640,7 +640,7 @@ class ModelManager(object): models.yaml file. """ model_name = model_name or Path(repo_or_path).stem - model_description = model_description or f"imported diffusers model {model_name}" + model_description = model_description or f"Imported diffusers model {model_name}" new_config = dict( description=model_description, vae=vae, @@ -699,7 +699,7 @@ class ModelManager(object): model_name or Path(weights).stem ) # note this gives ugly pathnames if used on a URL without a Content-Disposition header model_description = ( - model_description or f"imported stable diffusion weights file {model_name}" + model_description or f"Imported stable diffusion weights file {model_name}" ) new_config = dict( weights=str(weights_path), @@ -835,7 +835,7 @@ class ModelManager(object): thing, commit_to_conf=commit_to_conf ) pipeline, _, _, _ = self._load_diffusers_model(self.config[model_name]) - + return model_name else: print( f"** {thing}: Unknown thing. Please provide a URL, file path, directory or HuggingFace repo_id"