Better error handling when unable to extract contents of embedding/TI file

This commit is contained in:
Brendan Hoar 2024-04-26 06:57:32 -04:00 committed by GitHub
parent 8dc920228e
commit c5b7559856
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -181,12 +181,16 @@ class EmbeddingDatabase:
else: else:
return return
embedding = create_embedding_from_data(data, name, filename=filename, filepath=path) if data is not None:
embedding = create_embedding_from_data(data, name, filename=filename, filepath=path)
if self.expected_shape == -1 or self.expected_shape == embedding.shape: if self.expected_shape == -1 or self.expected_shape == embedding.shape:
self.register_embedding(embedding, shared.sd_model) self.register_embedding(embedding, shared.sd_model)
else:
self.skipped_embeddings[name] = embedding
else: else:
self.skipped_embeddings[name] = embedding print(f"Unable to load Textual inversion embedding due to data issue: '{name}'.")
def load_from_dir(self, embdir): def load_from_dir(self, embdir):
if not os.path.isdir(embdir.path): if not os.path.isdir(embdir.path):