无法检测到此笔记本名称,可以通过 WANDB_NOTEBOOK_NAME 环境变量手动设置

0 投票
1 回答
85 浏览
提问于 2025-04-14 17:28

在Visual Studio Code中,我第一次遇到登录wandb的问题。我尝试把实体指定为‘myusername’,但问题还是没有解决。我还确认我使用的是最新版本的wandb。我的项目文件夹在桌面上。

os.environ["WANDB_API_KEY"] = 'API_KEY'

!wandb login API_KEY
/Users/myname/.netrc

machine api.wandb.ai
  login user
  password API_KEY

当我运行wandb.init时,我收到了这个错误

Changes to your `wandb` environment variables will be ignored because your `wandb` session has already started. For more information on how to modify your settings with `wandb.init()` arguments, please refer to [the W&B docs](https://wandb.me/wandb-init).
wandb: ERROR Error while calling W&B API: user is not logged in (<Response [401]>)

然后我决定在终端上运行,而不是在jupyter notebook的单元格中,但我得到了这个错误

Failed to detect the name of this notebook, you can set it manually with the WANDB_NOTEBOOK_NAME environment variable to enable code saving.

1 个回答

0

你可以试试以下步骤来解决这个问题:

  1. 检查一下你的API。
  2. 查看你的 .netrc 文件。确保这个文件里有正确的登录名和密码。
  3. 设置一下 WANDB_API_KEY 这个环境变量。
  4. 通过命令 pip install --upgrade wandb 安装最新版本的 Wandb

撰写回答