diff --git a/scripts/model_keyword_support.py b/scripts/model_keyword_support.py index 43c8f38..eaf7d99 100644 --- a/scripts/model_keyword_support.py +++ b/scripts/model_keyword_support.py @@ -16,6 +16,8 @@ hash_dict = {} def load_hash_cache(): + if not known_hashes_file.exists(): + known_hashes_file.touch() with open(known_hashes_file, "r", encoding="utf-8") as file: reader = csv.reader( file.readlines(), delimiter=",", quotechar='"', skipinitialspace=True @@ -28,6 +30,8 @@ def load_hash_cache(): def update_hash_cache(): global file_needs_update if file_needs_update: + if not known_hashes_file.exists(): + known_hashes_file.touch() with open(known_hashes_file, "w", encoding="utf-8", newline='') as file: writer = csv.writer(file) for name, (hash, mtime) in hash_dict.items(): diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index 994ce02..a11d645 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -277,6 +277,8 @@ def get_lora(): valid_loras = _get_lora() loras_with_hash = [] for l in valid_loras: + if not l.exists() or not l.is_file(): + continue name = l.relative_to(LORA_PATH).as_posix() if model_keyword_installed: hash = get_lora_simple_hash(l) @@ -293,6 +295,8 @@ def get_lyco(): valid_lycos = _get_lyco() lycos_with_hash = [] for ly in valid_lycos: + if not ly.exists() or not ly.is_file(): + continue name = ly.relative_to(LYCO_PATH).as_posix() if model_keyword_installed: hash = get_lora_simple_hash(ly)