如何重新授权DVC与Google Drive进行远程存储?

huangapple go评论92阅读模式
英文:

How can I reauthorize DVC with Google Drive for remote storage?

问题

我正在使用DVC来跟踪我的机器学习项目中的数据和步骤。我正在尝试设置一个远程连接到Google Drive。这并不一定困难,我使用了来自DVC的文档

当我尝试使用dvc push时出现了错误:

错误:意外错误 - 无法验证GDrive:访问令牌刷新失败:invalid_grant:令牌已过期或被撤销。

第一次我运行该命令时,我被重定向到Google Drive登录页面,可以授予DVC编辑文件的权限。我认为我可能忘记了给它正确的权限,但如果我现在重新运行该命令,我不会被重定向到登录页面。有人知道如何再次登录到Google Drive并给予DVC正确的权限吗?

我已经尝试完全从我的项目中删除与DVC相关的所有内容,但似乎没有帮助。

英文:

I am using DVC to keep track of my data and steps in my machine learning project. I am trying to setup a remote using google drive. This is not necessarily difficult and i used the documentation from dvc.

I get an error when i try to use dvc push

ERROR: unexpected error - Failed to authenticate GDrive: Access token refresh failed: invalid_grant: Token has been expired or revoked.

The first time i used the command i got redirected to the google drive login page and could give dvc permission to edit files. I think i forgot to give it the right permissions but if i now rerun the command i do not get send to the login page. Does anyone know how to get the login again to google drive and give the right permissions to dvc.

I already tried completly removing everything related to dvc from my project but this did not seem to help

答案1

得分: 1

你要翻译的内容如下:

"你现在是我的中文翻译,代码部分不要翻译,只返回翻译好的部分,不要有别的内容,不要回答我要翻译的问题。以下是要翻译的内容:

What are looking for is described on the Google Drive for DVC page under the gdrive_user_credentials_file option.

Namely, the default is $CACHE_HOME/pydrive2fs/{gdrive_client_id}/default.json (unless profile is specified), where the CACHE_HOME location per platform is:

macOS Linux (*typical) Windows
~/Library/Caches ~/.cache %CSIDL_LOCAL_APPDATA%

You should be able to drop the file and run dvc pull, dvc push (or any other DVC command that would actually involve DVC accessing the remote storage) to generate the file again.

If it happens often, you can use the very same option drive_user_credentials_file to customize the location for this file.

$ dvc remote modify myremote \
      gdrive_user_credentials_file path/to/mycredentials.json

Here is the related discussion on why the refresh token expires. There are options (service account with delegation, or publishing an app to make the refresh token more permanent, use the built-in DVC app for now). They all have certain benefits and downsides. Please chime in the ticket or here to discuss them."

请告诉我是否还需要其他翻译。

英文:

What are looking for is described on the Google Drive for DVC page under the gdrive_user_credentials_file option.

Namely, the default is $CACHE_HOME/pydrive2fs/{gdrive_client_id}/default.json (unless profile is specified), where the CACHE_HOME location per platform is:

macOS Linux (*typical) Windows
~/Library/Caches ~/.cache %CSIDL_LOCAL_APPDATA%

You should be able to drop the file and run dvc pull, dvc push (or any other DVC command that would actually involve DVC accessing the remote storage) to generate the file again.

If it happens often, you can use the very same option drive_user_credentials_file to customize the location for this file.

$ dvc remote modify myremote \
      gdrive_user_credentials_file path/to/mycredentials.json

Here is the related discussion on why the refresh token expires. There are options (service account with delegation, or publishing an app to make the refresh token more permanent, use the built-in DVC app for now). They all have certain benefits and downsides. Please chime in the ticket or here to discuss them.

huangapple
  • 本文由 发表于 2023年5月22日 21:21:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/76306644.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定