目前,我正在处理400+图像,并使用
from google.colab import files
uploaded = files.upload()
这个运行得很好,但是每次我离开我的合作者的时候,我都要重新上传所有的图片。非常烦人,因为上传需要5-10分钟。
有没有可能防止这种情况发生?看起来Colaboratory只是暂时保存文件。
我必须使用谷歌协作,因为我需要他们的GPU。
提前感谢:)
发布于 2018-10-09 18:55:15
据我所知,没有办法将数据永久存储在Google Colab VM上,但有比files.upload()更快的方法将数据上传到Colab上。
例如,您可以将您的镜像上传到Google Drive上一次,然后1)将Google Drive直接挂载到您的VM中,或者2)使用PyDrive将您的镜像下载到VM上。这两个选项都应该比从本地驱动器上传图像快得多。
VM中的挂载驱动器
从google.colab导入驱动器drive.mount('/gdrive')
foo.txt
的内容:使用open('/gdrive/foo.txt')作为f: for line in f: print(line)
使用PyDrive的
看一下这个question的第一个答案。
发布于 2020-04-06 18:18:15
首先,挂载你的Google Drive:
# Load the Drive helper and mount
from google.colab import drive
# This will prompt for authorization.
drive.mount('/content/drive')
结果是:
Mounted at /content/drive
要检查已装载的目录,请运行以下命令:
# After executing the cell above, Drive
# files will be present in "/content/drive/My Drive".
!ls "/content/drive/My Drive"
结果如下所示:
07_structured_data.ipynb Sample Excel file.xlsx
BigQuery recipes script.ipynb
Colab Notebooks TFGan tutorial in Colab.txt
Copy of nima colab.ipynb to_upload (1).ipynb
created.txt to_upload (2).ipynb
Exported DataFrame sheet.gsheet to_upload (3).ipynb
foo.txt to_upload.ipynb
Pickle + Drive FUSE example.ipynb variables.pickle
Sample Excel file.gsheet
https://stackoverflow.com/questions/52717164
复制相似问题