allow loading embeddings from subdirectories
This commit is contained in:
parent
310b71f669
commit
81133d4168
|
@ -149,19 +149,20 @@ class EmbeddingDatabase:
|
||||||
else:
|
else:
|
||||||
self.skipped_embeddings[name] = embedding
|
self.skipped_embeddings[name] = embedding
|
||||||
|
|
||||||
for fn in os.listdir(self.embeddings_dir):
|
for root, dirs, fns in os.walk(self.embeddings_dir):
|
||||||
try:
|
for fn in fns:
|
||||||
fullfn = os.path.join(self.embeddings_dir, fn)
|
try:
|
||||||
|
fullfn = os.path.join(root, fn)
|
||||||
|
|
||||||
if os.stat(fullfn).st_size == 0:
|
if os.stat(fullfn).st_size == 0:
|
||||||
|
continue
|
||||||
|
|
||||||
|
process_file(fullfn, fn)
|
||||||
|
except Exception:
|
||||||
|
print(f"Error loading embedding {fn}:", file=sys.stderr)
|
||||||
|
print(traceback.format_exc(), file=sys.stderr)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
process_file(fullfn, fn)
|
|
||||||
except Exception:
|
|
||||||
print(f"Error loading embedding {fn}:", file=sys.stderr)
|
|
||||||
print(traceback.format_exc(), file=sys.stderr)
|
|
||||||
continue
|
|
||||||
|
|
||||||
print(f"Textual inversion embeddings loaded({len(self.word_embeddings)}): {', '.join(self.word_embeddings.keys())}")
|
print(f"Textual inversion embeddings loaded({len(self.word_embeddings)}): {', '.join(self.word_embeddings.keys())}")
|
||||||
if len(self.skipped_embeddings) > 0:
|
if len(self.skipped_embeddings) > 0:
|
||||||
print(f"Textual inversion embeddings skipped({len(self.skipped_embeddings)}): {', '.join(self.skipped_embeddings.keys())}")
|
print(f"Textual inversion embeddings skipped({len(self.skipped_embeddings)}): {', '.join(self.skipped_embeddings.keys())}")
|
||||||
|
|
Loading…
Reference in New Issue