I am learning lang chain and hugging face. I’m using vs code as my IDE for test purposes. I am using the huggingfaceendpoint library and chathugging face libraries. I store the hugging face token in my .env file. Every time I run my python script and invoke the model in the script. I get the authorization header invalid.
the same code when I run on google colab by saving the access token in the secret key, It works fine. Can somebody please help or let me know if you need any other information?
If it works in Colab, then you’re probably just failing to pass the token. In that case, set the HF_TOKEN environment variable or write login() in the Python code to be sure. Don’t forget to install the library beforehand.