Google colab深度学习python

2024-06-16 16:50:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我有兴趣用Google colab尝试GPU深度学习,我在下面的教程博客中使用Google drive设置深度学习环境: https://medium.com/deep-learning-turkey/google-colab-free-gpu-tutorial-e113627b9f5d

我已经设置了Google驱动器和相应的文件夹目录,并且我在blog“运行或导入.py文件与googlecolab”的要点 首先运行这些代码以安装必要的库并执行授权,然后我应该在Google Ipython编辑器中运行此代码:

!apt-get install -y -qq software-properties-common python-software-properties module-init-tools
!add-apt-repository -y ppa:alessandro-strada/ppa 2>&1 > /dev/null
!apt-get update -qq 2>&1 > /dev/null
!apt-get -y install -qq google-drive-ocamlfuse fuse
from google.colab import auth
auth.authenticate_user()
from oauth2client.client import GoogleCredentials
creds = GoogleCredentials.get_application_default()
import getpass
!google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret} < /dev/null 2>&1 | grep URL
vcode = getpass.getpass()
!echo {vcode} | google-drive-ocamlfuse -headless -id={creds.client_id} -secret={creds.client_secret}

代码也按预期执行,然后会出现一个超链接框,在那里我可以复制和粘贴授权密钥。当我把钥匙贴上时,什么事都没有发生。图标如果Python是忙碌的只是旋转和旋转(忙碌)永远。。。按enter似乎删除了授权密钥,我认为这也不合适。在

重新启动虚拟机似乎也不会对!kill -9 -1执行任何操作,然后重新运行代码。。。任何提示都有帮助谢谢!!!在


Tags: 代码devclientidgetsecretgoogleapt