mirror of
https://github.com/openvinotoolkit/stable-diffusion-webui.git
synced 2024-12-14 22:53:25 +03:00
Merge pull request #9484 from infinitewarp/sort-embeddings
sort embeddings by name (case insensitive)
This commit is contained in:
commit
fdac486835
@ -233,6 +233,12 @@ class EmbeddingDatabase:
|
||||
self.load_from_dir(embdir)
|
||||
embdir.update()
|
||||
|
||||
# re-sort word_embeddings because load_from_dir may not load in alphabetic order.
|
||||
# using a temporary copy so we don't reinitialize self.word_embeddings in case other objects have a reference to it.
|
||||
sorted_word_embeddings = {e.name: e for e in sorted(self.word_embeddings.values(), key=lambda e: e.name.lower())}
|
||||
self.word_embeddings.clear()
|
||||
self.word_embeddings.update(sorted_word_embeddings)
|
||||
|
||||
displayed_embeddings = (tuple(self.word_embeddings.keys()), tuple(self.skipped_embeddings.keys()))
|
||||
if self.previously_displayed_embeddings != displayed_embeddings:
|
||||
self.previously_displayed_embeddings = displayed_embeddings
|
||||
|
Loading…
Reference in New Issue
Block a user