Pyannote.speaker_diarization giving 401 Client Error

Hi,

I created a user access token with write permissions. Using that token and able to use the model pipeline = Pipeline.from_pretrained(“pyannote/speaker-diarization”, use_auth_token=access_token). But I am getting the following Error.

raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://huggingface.co/pyannote/segmentation/resolve/2022.07/pytorch_model.bin

I have been getting a variety of errors when trying to get this model the past ~24 hours. I’m going to keep trying periodically, will report back if things go green.

EDIT @artificialintelligen @smarterbizomkar

I was able to fix this by accepting the terms at pyannote/segmentation · Hugging Face


I’m also getting the error in a Google Colab notebook when using a write access token (though a 403 error instead of 401).

HTTPError: 403 Client Error: Forbidden for url: 
https://huggingface.co/pyannote/segmentation/resolve/2022.07/pytorch_model.bin

I tried creating new tokens (both read and write) with no luck. This was working yesterday, for the record.

1 Like

I had the same problem :face_with_monocle:

Traceback (most recent call last):
  File "/home/dg/anaconda3/envs/pyannote/lib/python3.8/site-packages/huggingface_hub/utils/_errors.py", line 213, in hf_raise_for_status
    response.raise_for_status()
  File "/home/dg/anaconda3/envs/pyannote/lib/python3.8/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://huggingface.co/pyannote/segmentation/resolve/2022.07/pytorch_model.bin

anyone else know how to fix it?

@Zpadger I edited my post to give a fix

this fixed it for me, thanks!

I also get an authentification error:

huggingface_hub.utils._errors.RepositoryNotFoundError: 401 Client Error: Repository Not Found for url: https://huggingface.co/pyannote/segmentation/resolve/2022.07/pytorch_model.bin. If the repo is private, make sure you are authenticated.

however i only get it at one computer, even though the code and authentification token are exactly the same
any idea why it works differently on different machines?
thank you

I also get the authentication error, even after accepting the terms at pyannote/segmentation · Hugging Face and providing an access token.

Any ideas on how to fix this?

Even I had the same problem. I followed the below steps to solve the problem.

  1. Update the PyAnnote version to ‘2.1.1’ using ‘pip install --upgrade pyannote.audio’
  2. visit “pyannote/speaker-diarization · Hugging Face” and accept user conditions
  3. visit “pyannote/segmentation · Hugging Face” and accept user conditions
  4. Generate, only ‘READ’ token using your Huggingface account settings–>access Tokens
  5. Login to Huggingface through the command line using the command “huggingface-cli login”. This will ask you the token created in step 4 and then append this token under your ‘.huggingface’ folder.

From now, you may either instantiate the ‘use_auth_token’ option of the pipeline with your token or give only the ‘True’ option.

4 Likes

Thank you. This is what solved my issue. I needed to login with: huggingface-cli login

1 Like

I’ve accepted the terms for all of pyannote’s models and still getting this error. See below.

Hi, By any chance have you fixed this issue?

Hello everyone,

I’m facing a persistent authorization issue when trying to use the pyannote/speaker-diarization model — even though I’ve carefully followed all steps:

:white_check_mark: What I’ve already done:

  1. :key: Generated a token with WRITE permissions (includes READ)
  2. :white_check_mark: Explicitly accepted access conditions for:
    • pyannote/speaker-diarization
    • pyannote/segmentation
  3. :white_check_mark: Cleared local Hugging Face cache (~/.cache/huggingface)
  4. :white_check_mark: Tried both login via huggingface-cli login and direct token usage in code

:cross_mark: Result:
Whether I try:

pipeline = Pipeline.from_pretrained(
    "pyannote/speaker-diarization",
    use_auth_token="hf_..."
)

or :
huggingface-cli login

→ I systematically get:
401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2
Invalid credentials in Authorization header

🔍 Notes:
    The token is newly generated and works for other models.
    My access is confirmed as "accepted" in the Gated Repositories page.
    No environment variable conflicts (e.g., HF_TOKEN), and Git credentials are clean.
    No clear documentation mentioning that both diarization and segmentation terms must be accepted to make the pipeline work.

➡️ Has anyone faced the same issue? Is there a known workaround?

Thanks in advance 🙏

Update :

I carefully followed the official procedure described by Hervé Bredin, the author of pyannote.audio. Here’s what I did:

    ✅ Installed pyannote.audio version ≥ 2.1.1
    ✅ Accepted terms for both pyannote/speaker-diarization and pyannote/segmentation
    ✅ Created a fresh WRITE token (which includes READ)
    ✅ Logged in using huggingface-cli login (declined git credential prompt)
    ✅ Cleared cache and checked for leftover HF_TOKEN environment variable
    ✅ Tried both use_auth_token="hf_..." and use_auth_token=True
    ✅ Still getting 401 Unauthorized error

Despite all that, I consistently get the same Invalid credentials in Authorization header response when calling the pipeline.

Could this be a backend propagation issue or an unexpected token validation bug?
1 Like

If you do that and still get an error, it might be a special bug like this.
https://stackoverflow.com/questions/78805545/error-downloading-pyannote-speaker-diarization-pipeline-despite-having-read-ac

Changing the code to
pipeline = Pipeline.from_pretrained(“pyannote/speaker-diarization-3.1”,use_auth_token=True)
fixed the issue.

Thanks for the suggestion :folded_hands:

Unfortunately, this workaround requires a successful huggingface-cli login, which consistently fails on my end with:

401 Client Error: Unauthorized for url: https://huggingface.co/api/whoami-v2
→ Invalid credentials in Authorization header

Even with a freshly created WRITE token, the login and all authenticated API calls fail—whether passing the token inline or via CLI. The token is valid and visible in my account.

It seems to be an authentication bug on Hugging Face’s side. Happy to provide more details or test any workaround.

1 Like

Hmm… If it’s a library-level bug, it would be best to raise an issue on GitHub, but if it’s not a library-level bug, it might be more reliable to email Hugging Face directly. They should be able to tell you how the token was handled from their server side. [email protected]

1 Like

Thanks again for the follow-up.

I agree — at this point it’s hard to tell whether the issue is client-side or server-side. Since huggingface-cli login fails consistently despite a valid token, I’ll try reaching out directly to Hugging Face at [email protected] to clarify how the token is processed on their end.

If it turns out to be a bug in the huggingface_hub library, I’ll open a GitHub issue with a detailed report.

Thanks again for your help — much appreciated!

1 Like