如何将文件夹上传到Google Colab? [英] How to upload folders to Google Colab?
问题描述
我想运行一个笔记本,该笔记本使用目录中定义的许多头文件。所以基本上我想将整个目录上传到Google Colab,以便我可以运行笔记本。但是我找不到任何此类选项,只能上传文件而不是完整的文件夹。有人可以告诉我如何将整个目录上传到google colab吗?
I want to run a notebook that uses many header files defined in the directory. So basically I want to upload the entire directory to Google Colab so that I can run the notebook. But I am unable to find any such options and only able to upload files not complete folders. So can someone tell me how to upload entire directory to google colab?
推荐答案
我建议您不要仅在Colab中上传它们,因为重新启动运行时会丢失它们(只需要重新上传它们,但是对于非常大的数据集来说可能是个问题)。
我建议您使用 google.colab
包来管理Colab中的文件和文件夹。只需将所需的所有内容上传到google驱动器,然后导入:
I suggest you not to upload them just in Colab, since when you're restarting the runtime you will lose them (just need to re-upload them, but it can be an issue with very big datasets).
I suggest you to use the google.colab
package to manage files and folders in Colab. Just upload everything you need to your google drive, then import:
from google.colab import drive
drive.mount('/content/gdrive')
这样,您只需需要通过Google身份验证API登录到您的Google帐户,然后您就可以使用文件/文件夹了,就像它们是在Colab上上传的一样。
In this way, you just need to login to your google account through google authentication API, and you can use files/folders as if they were uploaded on Colab.
这篇关于如何将文件夹上传到Google Colab?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!