run train.py meets ValueError: `Dataloader` returned 0 length.
See original GitHub issueHello!
I am studying the recipe of /asteroid-master/egs/dns_challenge/ and trying to run it for practice. But I met error and I failed to train the model. I run it in my laptop in Linux, I installed pytorch_lightning version 0.9.0 from PyPI. But when I run /asteroid-master/egs/dns_challenge/baseline/run.sh at Stage 3 : Train, it will throw error at pytorch_lightning. The error is as shown below. Train_error_log.txt For more detail please find the attached Train_error_log.txt.
Traceback (most recent call last):
File “train.py”, line 121, in <module>
main(arg_dic)
File “train.py”, line 94, in main
trainer.fit(system)
File “/home/elen/anaconda3/lib/python3.8/site-packages/pytorch_lightning-0.9.1rc4-py3.8.egg/pytorch_lightning/trainer/states.py”, line 48, in wrapped_fn
result = fn(self, *args, **kwargs)
File “/home/elen/anaconda3/lib/python3.8/site-packages/pytorch_lightning-0.9.1rc4-py3.8.egg/pytorch_lightning/trainer/trainer.py”, line 1084, in fit
results = self.accelerator_backend.train(model)
File “/home/elen/anaconda3/lib/python3.8/site-packages/pytorch_lightning-0.9.1rc4-py3.8.egg/pytorch_lightning/accelerators/cpu_backend.py”, line 39, in train
results = self.trainer.run_pretrain_routine(model)
File “/home/elen/anaconda3/lib/python3.8/site-packages/pytorch_lightning-0.9.1rc4-py3.8.egg/pytorch_lightning/trainer/trainer.py”, line 1224, in run_pretrain_routine
self._run_sanity_check(ref_model, model)
File “/home/elen/anaconda3/lib/python3.8/site-packages/pytorch_lightning-0.9.1rc4-py3.8.egg/pytorch_lightning/trainer/trainer.py”, line 1249, in _run_sanity_check
self.reset_val_dataloader(ref_model)
File “/home/elen/anaconda3/lib/python3.8/site-packages/pytorch_lightning-0.9.1rc4-py3.8.egg/pytorch_lightning/trainer/data_loading.py”, line 337, in reset_val_dataloader
self.num_val_batches, self.val_dataloaders = self._reset_eval_dataloader(model, ‘val’)
File “/home/elen/anaconda3/lib/python3.8/site-packages/pytorch_lightning-0.9.1rc4-py3.8.egg/pytorch_lightning/trainer/data_loading.py”, line 299, in _reset_eval_dataloader
num_batches = len(dataloader) if _has_len(dataloader) else float(‘inf’)
File “/home/elen/anaconda3/lib/python3.8/site-packages/pytorch_lightning-0.9.1rc4-py3.8.egg/pytorch_lightning/trainer/data_loading.py”, line 70, in _has_len
raise ValueError(‘Dataloader
returned 0 length.’
ValueError: Dataloader
returned 0 length. Please make sure that your Dataloader at least returns 1 batch
I have successfully run it for Stage 1 and 2, and the file_infos.json already created at location ./data.
I don’t know what cause this Dataloader
to return 0 length.
Can you help me to point out what maybe the cause?
How can I solve this problem?
Thanks in advance!
Best Regards, Elen
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top GitHub Comments
I downloaded the default master Branch code just last week. From the Changelog I found its version is [0.3.3] - 2020-08-25. Now after removing the argument ‘train’ from common_step() in the code of /asteroid/engine/system.py, I can successfully run the Stage 3 to train the model.
Please, try debugging before posting the issue, if you solve your problems, you’ll be better after it.