Google协作-如何刷新Google驱动器? [英] Google-Colaboratory - How to Refresh google-drive?

查看:78
本文介绍了Google协作-如何刷新Google驱动器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google协作型GPU来训练NN模型.我的python/pytorch代码存储在Google驱动器中.我可以将其安装在协作模型和火车模型中.但是即使重新启动PC并重新启动后,我的驱动器"中的任何python代码更改也不会更新为google-colaboratory.

I am using google-colaboratory GPU to train NN models. My python/pytorch code is stored in google-drive. I am able to mount my drive in colaboratory and train models. But any python code changes in the "my drive" is not updated to google-colaboratory even after rebooting my PC and start all again.

要清除我尝试过的Google相似性缓存,

To clear the google-colaboratory cache I tried :

!google-drive-ocamlfuse -cc

但是它不起作用:

/bin/bash: google-drive-ocamlfuse: command not found

如何清理此缓存并避免等待google-colaboratory考虑我的代码?预先感谢

How to clean this cache and avoid waiting hours before my code being taken into account by google-colaboratory ? Thanks in advance

PS:我过去用来挂载的方法:

PS : the method I used to mount:

from google.colab import drive
drive.mount('/content/drive/')

推荐答案

google-drive-ocamlfuse 与使用 google.colab.drive.mount 进行的安装无关,如所述在PS中,因此-cc调用对您没有帮助也就不足为奇了.我怀疑发生了什么事,您在Google云端硬盘中存储了 .py 文件,您正在笔记本中对其进行 import 导入,并且您想查看对进行的更改.py 文件会反映在您的运行时中,但这不是因为python的 import 系统是幂等的(如果python认为 import 语句已经被加载,则会忽略该声明该模块使用该名称,即使基础文件已更改).您可以使用类似 https://stackoverflow.com/a/437591/8755609 的方法来强制重新加载,例如:

google-drive-ocamlfuse is irrelevant to mounts using google.colab.drive.mount as described in the PS, so not surprising the -cc invocation is not helping you. I suspect what's happening is you have .py files stored in Google Drive, which you're importing in your notebook, and you want to see changes to the .py files reflected in your runtime, but they're not because python's import system is idempotent (an import statement is ignored if python thinks it's already loaded a module by that name, even if the underlying file has changed). You can force a reload using something like https://stackoverflow.com/a/437591/8755609 e.g.:

from importlib import reload  # Py3 only; unneeded in py2.
foo = reload(foo)

(用模块名称替换 foo ).

这篇关于Google协作-如何刷新Google驱动器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆