1. pytorch 的 dataloader 在读取数据时,设置了较大的 batchsize 和 num_workers. 然后训练一段时间报错:
RuntimeError: Too many open files. Communication with the workers is no longer possible. Please increase the limit using ulimit -n in the shell or change the sharing strategy by calling torch.multiprocessing.se t_sharing_strategy('file_system') at the beginning of your code
解决办法1:
import torch.multiprocessing
torch.multiprocessing.set_sharing_strategy('file_system')
解决办法2:
可能是__getitem__()出问题了,找到出问题的数据;