Hi! Just wondering if there was a way to login without the notebook_login or 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.
Hi @sachin, the preferred way to login is to use notebook_login() or huggingface-cli login. For now, hf_api.set_access_token(hf_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 in GitHub - 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 value
as token or use_auth_token arguments in the HfApi methods.
@osanseviero As far as I know, there is no HfApi().login() method implemented (yet?)
This will be part of next huggingface_hub release. Otherwise you can also install from the main branch with pip uninstall huggingface_hub && pip install git+https://github.com/huggingface/huggingface_hub.