pere
1
I am using startup scripts on my TPU, and need to authenticate for access to my datasets with “huggingface-cli cli” as part of the script.
Typically something like this should work:
printf "myaccesstoken\n" | huggingface-cli login
However, this does not work. Any idea how to authenticate as part of a batch script?
1 Like
You can probably just call HfFolder.save_token()
which will save your token to ~/.huggingface/token
Let us know if it worked (also cc @lysandre)
pere
3
Great. Thanks. This seems to work perfectly in my bash script:
python -c “from huggingface_hub.hf_api import HfFolder; HfFolder.save_token(‘my_token’)”
1 Like