From bde456f9fa2579910717566eed031e55da5b450d Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Wed, 30 Nov 2022 19:48:17 -0500 Subject: [PATCH] fix startup messages and a startup crash - make the warnings about patchmatch less redundant - only warn about being unable to load concepts from Hugging Face library once - do not crash when unable to load concepts from Hugging Face due to network connectivity issues --- ldm/invoke/concepts_lib.py | 2 +- ldm/invoke/generator/inpaint.py | 2 +- ldm/invoke/readline.py | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ldm/invoke/concepts_lib.py b/ldm/invoke/concepts_lib.py index 3b6d9e9bad..dcbfb4c9c0 100644 --- a/ldm/invoke/concepts_lib.py +++ b/ldm/invoke/concepts_lib.py @@ -36,7 +36,7 @@ class Concepts(object): models = self.hf_api.list_models(filter=ModelFilter(model_name='sd-concepts-library/')) self.concept_list = [a.id.split('/')[1] for a in models] except Exception as e: - print(' ** WARNING: Hugging Face textual inversion concepts libraries could not be loaded. The error was {str(e)}.') + print(f' ** WARNING: Hugging Face textual inversion concepts libraries could not be loaded. The error was {str(e)}.') print(' ** You may load .bin and .pt file(s) manually using the --embedding_directory argument.') return self.concept_list diff --git a/ldm/invoke/generator/inpaint.py b/ldm/invoke/generator/inpaint.py index 7798ed00c5..7b4d151265 100644 --- a/ldm/invoke/generator/inpaint.py +++ b/ldm/invoke/generator/inpaint.py @@ -27,7 +27,7 @@ if Globals.try_patchmatch: print('>> Patchmatch initialized') infill_methods.append('patchmatch') else: - print('>> Patchmatch not loaded, please see https://github.com/invoke-ai/InvokeAI/blob/patchmatch-install-docs/docs/installation/INSTALL_PATCHMATCH.md') + print('>> Patchmatch not loaded (nonfatal)') else: print('>> Patchmatch loading disabled') diff --git a/ldm/invoke/readline.py b/ldm/invoke/readline.py index af7a2f1f9b..aacddfb034 100644 --- a/ldm/invoke/readline.py +++ b/ldm/invoke/readline.py @@ -101,7 +101,7 @@ class Completer(object): self.linebuffer = None self.auto_history_active = True self.extensions = None - self.concepts = Concepts().list_concepts() + self.concepts = None return def complete(self, text, state): @@ -271,7 +271,8 @@ class Completer(object): def add_embedding_terms(self, terms:list[str]): self.concepts = Concepts().list_concepts() - self.concepts.extend(terms) + if self.concepts: + self.concepts.extend(terms) def _concept_completions(self, text, state): partial = text[1:] # this removes the leading '<'