Merge pull request #3803 from FlameLaw/master
Fixed proper dataset shuffling
This commit is contained in:
commit
3019452927
1 changed files with 2 additions and 2 deletions
|
@ -86,12 +86,12 @@ class PersonalizedBase(Dataset):
|
||||||
assert len(self.dataset) > 0, "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.length = len(self.dataset) * repeats // batch_size
|
||||||
|
|
||||||
self.initial_indexes = np.arange(len(self.dataset))
|
self.dataset_length = len(self.dataset)
|
||||||
self.indexes = None
|
self.indexes = None
|
||||||
self.shuffle()
|
self.shuffle()
|
||||||
|
|
||||||
def shuffle(self):
|
def shuffle(self):
|
||||||
self.indexes = self.initial_indexes[torch.randperm(self.initial_indexes.shape[0]).numpy()]
|
self.indexes = np.random.permutation(self.dataset_length)
|
||||||
|
|
||||||
def create_text(self, filename_text):
|
def create_text(self, filename_text):
|
||||||
text = random.choice(self.lines)
|
text = random.choice(self.lines)
|
||||||
|
|
Loading…
Reference in a new issue