diff --git a/parakeet/data/datacargo.py b/parakeet/data/datacargo.py index 07f9d37d47fcdf70c3d2038f287f1696d362c03e..da6bc9aa3d18b9b52d74725aa8adf0e68300007b 100644 --- a/parakeet/data/datacargo.py +++ b/parakeet/data/datacargo.py @@ -39,18 +39,13 @@ class DataCargo(object): @property def _index_sampler(self): - # The actual sampler used for generating indices for `_DatasetFetcher` - # (see _utils/fetch.py) to read data at each time. This would be - # `.batch_sampler` if in auto-collation mode, and `.sampler` otherwise. - # We can't change `.sampler` and `.batch_sampler` attributes for BC - # reasons. if self._auto_collation: return self.batch_sampler else: return self.sampler def __len__(self): - return len(self._index_sampler) # with iterable-style dataset, this will error + return len(self._index_sampler) class DataIterator(object): def __init__(self, loader): diff --git a/parakeet/data/sampler.py b/parakeet/data/sampler.py index ff6d5d71cc6a2e8d959a3e2bec3bb447e549af43..097cc0322202a52bb0363398bfa865562df64ca0 100644 --- a/parakeet/data/sampler.py +++ b/parakeet/data/sampler.py @@ -63,7 +63,7 @@ class RandomSampler(Sampler): return iter(np.random.permutation(n).tolist()) def __len__(self): - return len(self.data_source) + return self.num_samples class SubsetRandomSampler(Sampler): diff --git a/tests/test_ljspeech.py b/test/test_ljspeech.py similarity index 100% rename from tests/test_ljspeech.py rename to test/test_ljspeech.py diff --git a/tests/test_vctk.py b/test/test_vctk.py similarity index 100% rename from tests/test_vctk.py rename to test/test_vctk.py