StableSR icon indicating copy to clipboard operation
StableSR copied to clipboard

It seems to be a val_dataloader issue

Open lazywu170101 opened this issue 1 year ago • 1 comments

Hello Dear Author! The following problem occurs while reproducing your work:

Traceback (most recent call last): File "/home/code/StableSR-main/main.py", line 738, in trainer.fit(model, data) File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 553, in fit self._run(model) File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 918, in _run self._dispatch() File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 986, in _dispatch self.accelerator.start_training(self) File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/accelerators/accelerator.py", line 92, in start_training self.training_type_plugin.start_training(trainer) File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 161, in start_training self._results = trainer.run_stage() File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 996, in run_stage return self._run_train() File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 1031, in _run_train self._run_sanity_check(self.lightning_module) File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/trainer/trainer.py", line 1111, in _run_sanity_check self._evaluation_loop.reload_evaluation_dataloaders() File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/loops/dataloader/evaluation_loop.py", line 173, in reload_evaluation_dataloaders self.trainer.reset_val_dataloader(model) File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/trainer/data_loading.py", line 437, in reset_val_dataloader self.num_val_batches, self.val_dataloaders = self._reset_eval_dataloader(model, "val") File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/trainer/data_loading.py", line 398, in _reset_eval_dataloader num_batches = len(dataloader) if has_len(dataloader) else float("inf") File "/home/anaconda3/envs/stable/lib/python3.10/site-packages/pytorch_lightning/utilities/data.py", line 63, in has_len raise ValueError("Dataloader returned 0 length. Please make sure that it returns at least 1 batch") ValueError: Dataloader returned 0 length. Please make sure that it returns at least 1 batch

After a longer period of debugging, I still haven't been able to figure out what the problem is.

Can you please give me some advice? My training dataset is DIV2K_train and validation dataset is DIV2K_val.

lazywu170101 avatar Apr 27 '24 04:04 lazywu170101

Hi. It seems that your path to the dataset is not correct. The code did not find related images under the folder so the length of the dataset is 0.

IceClear avatar May 09 '24 14:05 IceClear

How did you fix this issue?

How to correctly mention the path ?

ManuBN786 avatar Oct 16 '24 03:10 ManuBN786