diff options
author | guaneec <guaneec@users.noreply.github.com> | 2022-10-20 14:21:12 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2022-10-21 06:54:09 +0000 |
commit | b69c37d25e4ffc56e8f8c247fa2c38b4648cefb7 (patch) | |
tree | e3caf8b925c86003e25e5eb4f11dbaf9fc5352f8 /modules/textual_inversion/dataset.py | |
parent | 7157e5d064741fa57ca81a2c6432a651f21ee82f (diff) | |
download | stable-diffusion-webui-gfx803-b69c37d25e4ffc56e8f8c247fa2c38b4648cefb7.tar.gz stable-diffusion-webui-gfx803-b69c37d25e4ffc56e8f8c247fa2c38b4648cefb7.tar.bz2 stable-diffusion-webui-gfx803-b69c37d25e4ffc56e8f8c247fa2c38b4648cefb7.zip |
Allow datasets with only 1 image in TI
Diffstat (limited to 'modules/textual_inversion/dataset.py')
-rw-r--r-- | modules/textual_inversion/dataset.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/textual_inversion/dataset.py b/modules/textual_inversion/dataset.py index 23bb4b6a..5b1c5002 100644 --- a/modules/textual_inversion/dataset.py +++ b/modules/textual_inversion/dataset.py @@ -83,7 +83,7 @@ class PersonalizedBase(Dataset): self.dataset.append(entry)
- assert len(self.dataset) > 1, "No images have been found in the dataset."
+ assert len(self.dataset) > 0, "No images have been found in the dataset."
self.length = len(self.dataset) * repeats // batch_size
self.initial_indexes = np.arange(len(self.dataset))
@@ -91,7 +91,7 @@ class PersonalizedBase(Dataset): self.shuffle()
def shuffle(self):
- self.indexes = self.initial_indexes[torch.randperm(self.initial_indexes.shape[0])]
+ self.indexes = self.initial_indexes[torch.randperm(self.initial_indexes.shape[0]).numpy()]
def create_text(self, filename_text):
text = random.choice(self.lines)
|