我有一个大小为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')
答案 0 :(得分:0)
如果数据集来自kaggle,则为Colab提供git url,它会自动下载。否则,您将受到互联网连接的支配。