Google合作实验室:OSError:[Errno 5]输入/输出错误 [英] Google Colaboratory : OSError: [Errno 5] Input/output error

查看:87
本文介绍了Google合作实验室:OSError:[Errno 5]输入/输出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google合作实验室,并正在安装Google云端硬盘.当我访问csv文件时,出现以下错误:

I am using Google Colaboratory, and mounting Google Drive. When I access a csv file, it gets me the following error:

OSError:[错误5]输入/输出错误.

OSError: [Errno 5] Input/output error.

以前没有发生过.

如何像以前一样访问csv文件?

How can I access to the csv file as I used to?

我已经尝试过了,但是没有用:

I have tried this, but did not work:

将google colab与谷歌驱动器

这是在执行以下代码之后发生的.

This happened after conducting the following code.

for segment_id in tqdm(range(segment_num)):
  with h5py.File(os.path.join(INPUT_PATH, "train.h5"), "r") as f:
    train_answers.append(f['time_to_failure'][segment_id*segment_interval + SEGMENT_LENGTH])

tqdm条前进到37%,然后出现以下错误.

The tqdm bar progressed until 37%, and than gave the following error.

OSError:无法打开文件(文件读取失败:时间= 2019年5月2日星期四14:14:09,文件名='./驱动器/我的驱动器/凝视/LANL-地震-预测/input/train.h5',文件描述符= 74,错误号= 5,错误消息='输入/输出错误',buf = 0x7ffc31926d00,总计读取大小= 8,此子读取的字节= 8,实际读取的字节= 18446744073709551615,偏移量= 0)

OSError: Unable to open file (file read failed: time = Thu May 2 14:14:09 2019 , filename = './drive/My Drive/Kaggle/LANL-Earthquake-Prediction/input/train.h5', file descriptor = 74, errno = 5, error message = 'Input/output error', buf = 0x7ffc31926d00, total read size = 8, bytes this sub-read = 8, bytes actually read = 18446744073709551615, offset = 0)

从那时起,无法从Google合作实验室读取Google云端硬盘上的诸如train.csv(9GB)之类的大文件.它给出以下错误.

Since then, large files like train.csv(9GB), which is on Google Drive cannot be read from Google Colaboratory. It gives the following error.

OSError:[Errno 5]输入/输出错误

OSError: [Errno 5] Input/output error

有人有同样的问题吗?

有人知道如何解决这个问题吗?

Does anyone know how to solve this?

推荐答案

我遇到了相同的错误(在对迁移学习进行过于密集的测试期间).根据Google的说法,其原因可能是文件过多,I/O操作过多,或者是由于共享资源和使用资源更加密集-每个原因都与Google驱动器的使用有关.通常在1天后,应该刷新配额.

I've encounter the same error (during too intensive testing of transfer learning). According to Google the reason may be in too many I/O operations with small files or due to shared and more intensively used resources - every reason related to usage of Google drive. Mostly after 1 day the quota should be refreshed.

您还可以尝试另一种解决方案(针对像我这样不耐烦的用户)-复制资源(在我的情况下,该文件为包含文件夹 train validation的压缩文件夹 data (带有图片)作为压缩文件到您的Google驱动器,然后使用以下方法将其直接解压缩到Colab VM中:

You may also try another solution (for impatient users like me) - copy your resources (in my case a zipped folder data containing folders train and validation with images) as a zip file to your Google drive and then unzip it directly into Colab VM by use of:

!unzip -qq '/content/grive/My Drive/CNN/Datafiles/data.zip'  

然后您可以从/content/data/...文件夹访问数据(并说再见,I/O错误;))

You can then access the data from folder /content/data/... (and say Goodbye to the I/O Error ;) )

这篇关于Google合作实验室:OSError:[Errno 5]输入/输出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆