ValueError: Error 400: {'error': 'Authorization header is correct, but the token seems invalid'}
Hi there very new to huggingface and I am trying to run transformers agent however, I keep getting the error below. Any help on this would be greatly appreciated.import os
from scripts.global_var import config

default_home = os.path.join(os.getcwd(), ".cache")
REDACTED_TOKEN_home = os.path.join(default_home, "huggingface")
os.environ["HF_HOME"] = REDACTED_TOKEN_home
os.environ["HF_TOKEN_PATH"] = os.path.join(REDACTED_TOKEN_home, "token")
from huggingface_hub import login

login(config["huggingface_api"])
from transformers import HfAgent

agent_star = HfAgent(
    "https://api-inference.huggingface.co/models/bigcode/starcoder"
)
text = "this is new building with 14 storeys painted green."
storey_1 = agent_star.run("What is the number of storeys?", text=text)Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\Users\tolu.olusooto\Documents\Nakina\.venv\lib\site-packages\transformers\tools\agents.py", line 341, in run
    result = self.generate_one(prompt, stop=["Task:"])
  File "c:\Users\tolu.olusooto\Documents\Nakina\.venv\lib\site-packages\transformers\tools\agents.py", line 649, in generate_one
    raise ValueError(f"Error {response.status_code}: {response.json()}")
ValueError: Error 400: {'error': 'Authorization header is correct, but the token seems invalid'}
2024-05-20T01:06:46Z
Please update the permissions of the token to write/read, which can solve the problem.