如何将巨大的hdf5文件上传到谷歌colab?



我有一个大小为17GB的hdf5文件(图像数据集(,我需要在Google Colab中上传和使用,并在此数据集上训练我的模型。但是,当我使用以下代码从我的驱动器上传时,运行时在身份验证过程后会自动断开连接。是因为文件大小还是其他问题?有什么解决方案可以克服这个问题吗?

代码片段如下:

from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from google.colab import auth
from oauth2client.client import GoogleCredentials
#Authenticate and create the PyDrive client.
auth.authenticate_user()
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
# Get the file
downloaded = drive.CreateFile({'id': 'my_id'}) #replace the my_id with id of file you want to access
downloaded.GetContentFile('dataset.hdf5')

如果数据集来自kaggle,则向Colab提供git url,它将自动下载它。否则,您将受到互联网连接的摆布。

最新更新