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

I encountered some problems while debugging the code on baseline. At that time, I reported an error and couldn’t find the reason repeatedly. Later, inspired by the following blog, I finally solved the problem. I will summarize this problem again

https://blog.csdn.net/xnmc2014/article/details/85557384

The problem may be the following: pay attention to the parameters when calling dataloder

self.train_dataloader = DataLoader(train_dataset, batch_size=TrainOption.train_batch_size, shuffle=TRUE, num_workers=TrainOption.data_load_worker_num)

The parameter setting of shuffle is wrong, because there is already a batch_ Sample, there is no need to shuffle for random sample, so shuffle here should be set to false.

Read More: