pytorch-domain-adaptation icon indicating copy to clipboard operation
pytorch-domain-adaptation copied to clipboard

ValueError: a must be greater than 0 unless no samples are taken

Open magnum-zx opened this issue 4 years ago • 3 comments

Hello! guys. Has anyone ever encountered such mistakes? How the errors fix?

Traceback (most recent call last): File "wdgrl.py", line 134, in main(args) File "wdgrl.py", line 76, in main (source_x, source_y), (target_x, _) = next(batch_iterator) File "H:\anaconda3\envs\torch1.4\lib\site-packages\torch\utils\data\dataloader.py", line 517, in next data = self._next_data() File "H:\anaconda3\envs\torch1.4\lib\site-packages\torch\utils\data\dataloader.py", line 557, in _next_data data = self._dataset_fetcher.fetch(index) # may raise StopIteration File "H:\anaconda3\envs\torch1.4\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "H:\anaconda3\envs\torch1.4\lib\site-packages\torch\utils\data_utils\fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "G:\pytorch-domain-adaptation\data.py", line 38, in getitem bsds_image = self._random_bsds_image() File "G:\pytorch-domain-adaptation\data.py", line 51, in _random_bsds_image i = self.rng.choice(len(self.bsds)) File "mtrand.pyx", line 902, in numpy.random.mtrand.RandomState.choice ValueError: a must be greater than 0 unless no samples are taken

magnum-zx avatar Jul 28 '21 06:07 magnum-zx

The cause of the error is that you don't follow the first step of the "Instructions". If you download the BSDS500 dataset and extract it at the right folder, this error will not happen. Because you have to use the BSDS500 dataset to generate the images of MNISTM.

Learn2Ln avatar Sep 17 '21 08:09 Learn2Ln