首先需要去官网申请一个 Access Token:https://huggingface.co/settings/tokens,申请的 token 为:
然后在需要登陆 hugginface 的虚拟环境中使用命令:
3.1.1 登录一个账户:
(lerobot-env) root@93162817432b:~# hf auth login _| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| _|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_| _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| _| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_| To log in, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens . Enter your token (input will not be visible):(这里复制申请好的 Access Token) Add token as git credential? [y/N]: y Token is valid (permission: fineGrained). The token `token` has been saved to /root/.cache/huggingface/stored_tokens Cannot authenticate through git-credential as no helper is defined on your machine. You might have to re-authenticate when pushing to the Hugging Face Hub. Run the following command in your terminal in case you want to set the 'store' credential helper as default. git config --global credential.helper store Read https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage for more details. Token has not been saved to git credential helper. Your token has been saved to /root/.cache/huggingface/token Login successful. The current active token is: `token`最后输出 Your token has been saved to /root/.cache/huggingface/token 和 Login successful. 就说明登录成功了!
报错:如果一直没反应,即输出如下:
(lerobot-env) root@93162817432b:~# hf auth login _| _| _| _| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _|_|_|_| _|_| _|_|_| _|_|_|_| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| _|_|_|_| _| _| _| _|_| _| _|_| _| _| _| _| _| _|_| _|_|_| _|_|_|_| _| _|_|_| _| _| _| _| _| _| _| _| _| _| _|_| _| _| _| _| _| _| _| _| _| _|_| _|_|_| _|_|_| _|_|_| _| _| _|_|_| _| _| _| _|_|_| _|_|_|_| To log in, `huggingface_hub` requires a token generated from https://huggingface.co/settings/tokens . Enter your token (input will not be visible): Add token as git credential? [y/N]: y 等待中... 等待中... 等待中... 等待中... 2000 years later... 还是等待中...,说明网络连不上,在终端输入:
export HF_ENDPOINT=https://hf-mirror.com即可 Login successful.--------------------------------------------------------------
3.1.2 列出已登录的账户:
(lerobot-env) root@93162817432b:~# hf auth list name | token ---------|--------------- * token | hf_****yamW3.1.3 切换用户:
(lerobot-env) root@93162817432b:~# hf auth switch Available stored tokens: 1. token Enter the number of the token to switch to (or 'q' to quit):注意:这里我只登录了一个用户,所以只列出了1. token,登陆多个才可以切换用户;
3.1.4 查看已登录的用户:
(lerobot-env) root@93162817432b:~# hf auth whoami user: xiaoarong Authenticated through private endpoint: https://hf-mirror.com3.1.5 注销登录
hf auth logout # 效果不展示了,知道命令即可!