【问题标题】:How to preserve session data when switching from cpu to gpu in google colab?在google colab中从cpu切换到gpu时如何保留会话数据?
【发布时间】:2021-05-13 04:06:57
【问题描述】:

当我们在 google colab 中从 CPU 切换到 GPU 硬件时,我们会丢失会话中的所有数据,这意味着我们需要再次将所有数据上传到新的 GPU 会话,这是一个非常耗时的过程,因为我们还需要重新运行数据处理。

有没有办法或任何解决方法/黑客将 CPU 会话更改为 GPU 会话,同时保留我们的会话数据?

我在某处读到我们可以将其推送到 git,然后在新的 GPU 会话中克隆数据。我知道如何克隆 git 数据,但不知道如何将 google colab 会话数据推送到 git。非常感谢这方面的任何帮助。

【问题讨论】:

    标签: git google-colaboratory


    【解决方案1】:

    我所做的是将我的文件上传到谷歌驱动器并安装它,如下所示:

    from google.colab import drive
    drive.mount('/gdrive')
    
    %cd /gdrive/MyDrive/somefolder/anotherfolder/
    
    

    然后我可以使用/somefolder/anotherfolder/上的文件,无论是python文件还是数据导入

    【讨论】:

      【解决方案2】:

      是的,这是真的,因为您正在更改 . 要克服这个问题,您必须按如下方式安装驱动器

      from google.colab import drive
      drive.mount('/gdrive')
      
      %cd /gdrive/MyDrive/face/image
      

      【讨论】:

        猜你喜欢
        • 2018-12-07
        • 2018-10-25
        • 1970-01-01
        • 2017-12-06
        • 1970-01-01
        • 2019-06-01
        • 2019-11-06
        • 1970-01-01
        • 2012-08-04
        相关资源
        最近更新 更多