allow loading embeddings from subdirectories

This commit is contained in:
Faber 2023-01-06 03:38:37 +07:00 committed by GitHub
parent 310b71f669
commit 81133d4168
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 10 deletions

View File

@ -149,9 +149,10 @@ class EmbeddingDatabase:
else:
self.skipped_embeddings[name] = embedding
for fn in os.listdir(self.embeddings_dir):
for root, dirs, fns in os.walk(self.embeddings_dir):
for fn in fns:
try:
fullfn = os.path.join(self.embeddings_dir, fn)
fullfn = os.path.join(root, fn)
if os.stat(fullfn).st_size == 0:
continue