Closed ghost closed 1 year ago
I found that my train_loader length is 0, but train_dataset length is 966.Debugging in progress.
I finally have solved this problem:
In file 'pytorch_lightning/trainer/data_loading.py' line 341 function: TrainerDataLoadingMixin._update_dataloader:
change:
@staticmethod
def _update_dataloader(dataloader: DataLoader, sampler: Sampler, mode: Optional[RunningStage] = None) -> DataLoader:
dl_kwargs = TrainerDataLoadingMixin._get_dataloader_init_kwargs(dataloader, sampler, mode=mode)
dl_cls = type(dataloader)
dataloader = dl_cls(**dl_kwargs)
return dataloader
to
@staticmethod
def _update_dataloader(dataloader: DataLoader, sampler: Sampler, mode: Optional[RunningStage] = None) -> DataLoader:
dl_kwargs = TrainerDataLoadingMixin._get_dataloader_init_kwargs(dataloader, sampler, mode=mode)
dl_kwargs["drop_last"] = False
dl_cls = type(dataloader)
dataloader = dl_cls(**dl_kwargs)
return dataloader
Sorry for the delay, but I'm glad you found a solution.
That said, I think 900 is likely too few images to train on. drop_last = False
will mean that one training iteration completes per epoch, but such a small training set may not result in a useful representation. It would likely be better to use one of the provided models, rather than training on a small dataset.
Do you mind sharing what you're trying to do by training in this way?
Thank you for your feedback, @edpizzi . We are exploring robust models with the aim of achieving Open World Object Detection (OWOD) using a minimal number of training samples. While we understand the limitations of training on a small dataset, our goal is to see how well these models can generalize with limited data. We appreciate any insights or recommendations you might have on this matter.
I encountered a pytorch_lightning error while using SSCD to train my own data:
Training command:
The error message is as follows:
Python 3.10 environment packages:
After debugging, it was found that the length of self.train_dataloader obtained at
line 365
inpytorch_lightning/trainer/data_loading.py
was0
, which caused this error. What is the reason for this error?