Skip to content

Commit

Permalink
Merge pull request #223 from Symbiomatrix/embload
Browse files Browse the repository at this point in the history
  • Loading branch information
DominikDoom authored Aug 20, 2023
2 parents 651cf5f + 6f93d19 commit b2a663f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion scripts/tag_autocomplete_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("Tag Autocomplete: Cannot reload embeddings instantly:", e)

def get_wildcards():
"""Returns a list of all wildcards. Works on nested folders."""
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -505,4 +512,4 @@ async def get_thumb_preview_blob(filename, type):



script_callbacks.on_app_started(api_tac)
script_callbacks.on_app_started(api_tac)

0 comments on commit b2a663f

Please sign in to comment.