Login without `notebook_login`
Hi! Just wondering if there was a way to login without thenotebook_loginor the cli option. So far I tried this, but I’m not sure if it is logging in as it’s meant to.The aim is to upload the trained model after I’ve logged in.import huggingface_hub

REDACTED_TOKEN = huggingface_hub.HfApi()
REDACTED_TOKEN.set_access_token(REDACTED_TOKEN)
2022-09-23T14:10:49Z
Hey there! There are 3 waysUsenotebook_loginUsehuggingface-cli loginin the terminalUse theHfApi().login()methodI hope this helpscc@Wauplin
2022-09-23T14:46:08Z
Hi@sachin, the preferred way to login is to usenotebook_login()orhuggingface-cli login. For now,REDACTED_TOKEN.set_access_token(REDACTED_TOKEN)sets the token only for git credentials (this is more a legacy feature). It would really make sense if this method was also used to send the token in HTTP requests. Could you open an issue for that inGitHub - huggingface/huggingface_hub: All the open source things related to the Hugging Face Hub.describing how you would like this feature to work ?In the meantime, if you want to use your account programmatically, you have to pass the token valueastokenoruse_auth_tokenarguments in theHfApimethods.@osansevieroAs far as I know, there is noHfApi().login()method implemented (yet?)
2022-09-23T15:00:26Z
I know rememberedlogin()was deprecated in favor ofset_access_tokenin v0.7.
2022-10-21T14:10:45Z
Hi@sachin, this was a quite requested feature so we implemented it inUnified login/logout methods by Wauplin · Pull Request #1111 · huggingface/huggingface_hub · GitHub. See PR description for how to use it.This will be part of nexthuggingface_hubrelease. Otherwise you can also install from themainbranch withpip uninstall huggingface_hub && pip install git+https://github.com/huggingface/huggingface_hub.