【问题解决】diffusers 模型下载 Could not open a connection to your authentication agent.

问题描述:

  1. 在下载特定模型(sd3、flux等)时,需要链接 Linux 服务器与 huggingface 来进行验证
  2. 具体的 ssh 连接方式在:https://huggingface.co/docs/hub/en/security-git-ssh
  3. 其中生成好 ssh 的 public key 之后,发现无法被 add

具体报错如下:

(env) user@xxx:/path/to/download_models# ssh-add ~/.ssh/id_ed25519
Could not open a connection to your authentication agent.

解决方案:

  • 定位问题:当尝试使用 ssh-add ~/.ssh/id_ed25519 命令时,出现了 “Could not open a connection to your authentication agent.” 的错误,这表明 SSH 代理没有运行或者 SSH 客户端没有正确连接到 SSH 代理。
  • 对应方案:
    1. 确保 SSH 代理正在运行。如果使用的是 ssh-agent,可以通过 eval “$(ssh-agent -s)” 启动它。
    2. 通过命令 eval "$(ssh-agent -s)"echo $SSH_AUTH_SOCK 来确认 ssh agent 已经启动。
(env) user@xxx:/path/to/download_models#  eval "$(ssh-agent -s)"
Agent pid 28xxx13
(env) user@xxx:/path/to/download_models#  echo $SSH_AUTH_SOCK
/tmp/ssh-eh6QgsQLd13u/agent.28xxx12

验证是否成功解决问题

  • ssh agent 启动后,再次执行 ssh-add ~/.ssh/id_ed25519,得到如下结果,说明 ssh key 被正常 add
(env) user@xxx:/path/to/download_models# ssh-add ~/.ssh/id_ed25519
Identity added: /root/.ssh/id_ed25519 (xxx@xmail.com)
  • 此外,还可以使用 cat ~/.ssh/config 来查看是否有 IdentityFile 这一行,如果没有也需要启动 ssh agent。

  • 成功 add 后可以通过 ssh -T git@hf.co 命令来测试是否接通 huggingface,如果类似下面输出了你的 huggingface 用户名,就可以开始正常下载啦🎉

(env) user@xxx:/path/to/download_models# ssh -T git@hf.co
Hi UserName, welcome to Hugging Face.

如果是 anonymous 说明还可能存在其他问题😭

(env) user@xxx:/path/to/download_models# ssh -T git@hf.co
Hi anonymous, welcome to Hugging Face.
  • 7
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值