Inference API - Gated Model - 401 Client Error

Hello,

Since July 2023, I got a NER Model based on XLMR Roberta working perfectly. The model is gated, I gave myself the access. The model was working perfectly on Google Collab, VS studio code, and Inference API.

Since one week, the Inference API is throwing the following long red error…

Could not load model AkimfromParis/NER-Luxury with any of the following classes: (<class 'transformers.models.xlm_roberta.modeling_xlm_roberta.XLMRobertaForTokenClassification'>, <class 'transformers.models.xlm_roberta.modeling_tf_xlm_roberta.TFXLMRobertaForTokenClassification'>). See the original errors: while loading with XLMRobertaForTokenClassification, an error is thrown: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/huggingface_hub/utils/_errors.py", line 286, in hf_raise_for_status response.raise_for_status() File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/AkimfromParis/NER-Luxury/resolve/cf11426099f350c646f06c998aafd77471f3a29f/model.safetensors The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/transformers/utils/hub.py", line 629, in has_file hf_raise_for_status(r) File "/usr/local/lib/python3.11/site-packages/huggingface_hub/utils/_errors.py", line 302, in hf_raise_for_status raise GatedRepoError(message, response) from e huggingface_hub.utils._errors.GatedRepoError: 401 Client Error. (Request ID: Root=1-6655f276-17dcbe2436c5f6c4376536c0) Cannot access gated repo for url https://huggingface.co/AkimfromParis/NER-Luxury/resolve/cf11426099f350c646f06c998aafd77471f3a29f/model.safetensors. Access to model AkimfromParis/NER-Luxury is restricted. You must be authenticated to access it. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/transformers/pipelines/base.py", line 283, in infer_framework_load_model model = model_class.from_pretrained(model, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/transformers/modeling_utils.py", line 3370, in from_pretrained if not has_file(pretrained_model_name_or_path, safe_weights_name, **has_file_kwargs): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/transformers/utils/hub.py", line 633, in has_file raise EnvironmentError( OSError: AkimfromParis/NER-Luxury is a gated repository. Make sure to request access at https://huggingface.co/AkimfromParis/NER-Luxury and pass a token having permission to this repo either by logging in with `huggingface-cli login` or by passing `token=<your_token>`. while loading with TFXLMRobertaForTokenClassification, an error is thrown: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/huggingface_hub/utils/_errors.py", line 286, in hf_raise_for_status response.raise_for_status() File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/AkimfromParis/NER-Luxury/resolve/cf11426099f350c646f06c998aafd77471f3a29f/model.safetensors.index.json The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/transformers/utils/hub.py", line 629, in has_file hf_raise_for_status(r) File "/usr/local/lib/python3.11/site-packages/huggingface_hub/utils/_errors.py", line 302, in hf_raise_for_status raise GatedRepoError(message, response) from e huggingface_hub.utils._errors.GatedRepoError: 401 Client Error. (Request ID: Root=1-6655f276-3ed7241a2a1ff7844e9cafb3) Cannot access gated repo for url https://huggingface.co/AkimfromParis/NER-Luxury/resolve/cf11426099f350c646f06c998aafd77471f3a29f/model.safetensors.index.json. Access to model AkimfromParis/NER-Luxury is restricted. You must be authenticated to access it. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/transformers/pipelines/base.py", line 283, in infer_framework_load_model model = model_class.from_pretrained(model, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/transformers/modeling_tf_utils.py", line 2868, in from_pretrained if has_file(pretrained_model_name_or_path, SAFE_WEIGHTS_INDEX_NAME, **has_file_kwargs): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/transformers/utils/hub.py", line 633, in has_file raise EnvironmentError( OSError: AkimfromParis/NER-Luxury is a gated repository. Make sure to request access at https://huggingface.co/AkimfromParis/NER-Luxury and pass a token having permission to this repo either by logging in with `huggingface-cli login` or by passing `token=<your_token>`. 

I tried to remove my access. The message “Gated model: You have been granted access to this model” is stuck. I apply back the access. I deleted my cookies. I changed the browser. I reboot my computer.

I changed for a new token. I tried to huggingface cli whoiam/logout. Nothing… Google Collab is working fine. The Inference Widget is still lost in the red. :smile:

How can I fix the Inference API/Widget on Hugging Face?

Thank you in advance!
Akim