recurrent-interface-network-pytorch icon indicating copy to clipboard operation
recurrent-interface-network-pytorch copied to clipboard

ValueError: num_samples should be a positive integer value, but got num_samples=0

Open ad48hp opened this issue 10 months ago • 1 comments

When running the Trainer example script from readme, the program fails to run with the following error: Traceback (most recent call last): File "RIN.py", line 20, in <module> trainer = Trainer( File "<@beartype(rin_pytorch.rin_pytorch.Trainer.__init__) at 0x2c1dc307d30>", line 32, in __init__ File "C:\Python38\lib\site-packages\rin_pytorch\rin_pytorch.py", line 973, in __init__ dl = DataLoader(self.ds, batch_size = train_batch_size, shuffle = True, pin_memory = True, num_workers = cpu_count()) File "C:\Python38\lib\site-packages\torch\utils\data\dataloader.py", line 350, in __init__ sampler = RandomSampler(dataset, generator=generator) # type: ignore[arg-type] File "C:\Python38\lib\site-packages\torch\utils\data\sampler.py", line 143, in __init__ raise ValueError(f"num_samples should be a positive integer value, but got num_samples={self.num_samples}") ValueError: num_samples should be a positive integer value, but got num_samples=0

Any idea on how to fix ?

More information torch 2.2.0+cu121 The image folder contains 71 images in PNG format.

All packages packages.txt

ad48hp avatar Apr 05 '24 12:04 ad48hp

I had the same error however it was an easy fix in my case, as the path to the images was wrong and thus num_samples=0

eml-and avatar Apr 16 '24 07:04 eml-and