Judging from the error message, it is possible that the token is really invalid. Or perhaps the necessary permissions have not been granted to the token…?
Mine is just a READ token.
from huggingface_hub import get_inference_endpoint
url = "https://huggingface.co/"
endpoint_name = 'Qwen/QwQ-32B'
HF_TOKEN = "hf_my_pro_token"
try:
endpoint = get_inference_endpoint(endpoint_name, token=HF_TOKEN)
except Exception as e:
print(e)
# 404 Client Error: Not Found for url: https://api.endpoints.huggingface.cloud/v2/endpoint/John6666/Qwen/QwQ-32B (Request ID:
HF_TOKEN = "foobar"
endpoint = get_inference_endpoint(endpoint_name, token=HF_TOKEN)
# raise HTTPError(error_message, request=e.request, response=e.response) from e
# requests.exceptions.HTTPError: Invalid user token.