'Input/output error while using google colab to read Google dirve files

I am training my model with colab. I have encountered this error more than once, when I use the enumeration function in colab to iterate my training data on Google Drive. The time when the error occurred is uncertain. The error may be after training a few epoch, or it may happen in several iterations.

I tried to modify the path of the dataset in Google Drive, or reduce the batchsize, these have no effect.

   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'


Solution 1:[1]

My recommendation is to first copy data out of Drive to the ephemeral VM machine before training. That may also speed things up.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Bob Smith