我正在使用 colab 训练我的模型。 我不止一次遇到过这个错误,当我使用 colab 中的枚举函数在 Google Drive 上迭代我的训练数据时。 错误发生的时间不确定。错误可能是在训练了几个 epoch 之后,也可能是在几次迭代中发生的。
我试过修改数据集在Google Drive中的路径,或者减小batchsize,这些都没有效果。
192 batch_time = AverageMeter()
193 losses = AverageMeter()
--> 194 for i, sample in enumerate(train_loader):
195 start = time.time()
196 input = sample['image'].cuda()
File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 2530, in open
fp = builtins.open(filename, "rb")
OSError: [Errno 5] Input/output error: './nyud_cropped/train_labels/001187.png'
请您参考如下方法:
我的建议是在训练前先将数据从 Drive 复制到临时 VM 机器。这也可能会加快速度。
