From 5b69d1e62229dfe28943b26679073926c6267c44 Mon Sep 17 00:00:00 2001 From: Symbiomatrix Date: Sun, 20 Aug 2023 18:51:37 +0300 Subject: [PATCH 1/3] Embedding forced reload. --- scripts/tag_autocomplete_helper.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index 2d71dde..5b5ef45 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -17,6 +17,12 @@ write_model_keyword_path) from scripts.shared_paths import * +# Attempt to get embedding load function, using the same call as api. +try: + load_textual_inversion_embeddings = sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings +except Exception as e: # Not supported. + load_textual_inversion_embeddings = lambda *args, **kwargs: None + print("Cannot load embeddings instantly: ", e) def get_wildcards(): """Returns a list of all wildcards. Works on nested folders.""" @@ -280,6 +286,7 @@ def update_json_files(): def refresh_temp_files(): global WILDCARD_EXT_PATHS WILDCARD_EXT_PATHS = find_ext_wildcard_paths() + load_textual_inversion_embeddings(force_reload = True) # Instant embedding reload. write_temp_files() get_embeddings(shared.sd_model) @@ -505,4 +512,4 @@ async def get_thumb_preview_blob(filename, type): -script_callbacks.on_app_started(api_tac) \ No newline at end of file +script_callbacks.on_app_started(api_tac) From 79bab04fd2cba663c1d7ac16f39497d46ce38285 Mon Sep 17 00:00:00 2001 From: Symbiomatrix Date: Sun, 20 Aug 2023 18:59:12 +0300 Subject: [PATCH 2/3] Typo. --- scripts/tag_autocomplete_helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index 5b5ef45..4d10d0c 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -22,7 +22,7 @@ load_textual_inversion_embeddings = sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings except Exception as e: # Not supported. load_textual_inversion_embeddings = lambda *args, **kwargs: None - print("Cannot load embeddings instantly: ", e) + print("Cannot load embeddings instantly:", e) def get_wildcards(): """Returns a list of all wildcards. Works on nested folders.""" From 6f93d19a2bff662cf96c0f1950536568841c8e53 Mon Sep 17 00:00:00 2001 From: Symbiomatrix Date: Sun, 20 Aug 2023 20:02:57 +0300 Subject: [PATCH 3/3] Edit error message. --- scripts/tag_autocomplete_helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index 4d10d0c..3002058 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -22,7 +22,7 @@ load_textual_inversion_embeddings = sd_hijack.model_hijack.embedding_db.load_textual_inversion_embeddings except Exception as e: # Not supported. load_textual_inversion_embeddings = lambda *args, **kwargs: None - print("Cannot load embeddings instantly:", e) + print("Tag Autocomplete: Cannot reload embeddings instantly:", e) def get_wildcards(): """Returns a list of all wildcards. Works on nested folders."""