我正在使用 Kaggle 来训练模型,训练完成后,我想将训练好的模型上传到谷歌驱动器,因为我无法找到在本地下载模型的方法。我研究过使用https://pythonhosted.org/PyDrive/执行 pip install pydrive 后,我尝试进行身份验证
import os
from pydrive.auth import GoogleAuth
from pydrive.drive import GoogleDrive
from oauth2client.client import GoogleCredentials
then
gauth = GoogleAuth()
gauth.credentials = GoogleCredentials.get_application_default()
drive = GoogleDrive(gauth)
我收到这个错误
ApplicationDefaultCredentialsError:应用程序默认凭据不可用。如果在 Google Compute Engine 中运行,则它们可用。否则,必须定义环境变量 GOOGLE_APPLICATION_CREDENTIALS 指向定义凭据的文件。看https://developers.google.com/accounts/docs/application-default-credentials了解更多信息。
还有其他方法可以做到这一点吗?
另外,我还没有在 Kaggle 中提交我的文件,因为我手动停止训练,因此提交将永远持续下去,并且在我尝试提交并停止输出区域中的提交后,我收到了超过 6 个子目录错误
我遇到了同样的问题,并且能够从以下位置下载文件Kaggle
to Colab
然后移动到Google Drive
。例如,如果当前目录是/kaggle/working
要移动的文件是processed_file.zip
then,
来自卡格尔
from IPython.display import FileLink
FileLink(r'processed_file.zip')
这将生成一个链接,
https://....kaggle.net/...../processed_file.zip
来自科拉布
!wget "https://....kaggle.net/...../processed_file.zip"
挂载 Google 云端硬盘
from google.colab import drive
drive.mount('/content/drive')
将文件复制到 Google 云端硬盘
!cp "/content/processed_file.zip" "/content/drive/My Drive/workspace"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)