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
This commit is contained in:
Lincoln Stein 2022-11-30 19:48:17 -05:00
parent 9ee83380e6
commit bde456f9fa
3 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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')

View File

@ -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 '<'