Skip to content

[Bug] Pipeline.from_pretrained() got an unexpected keyword argument token #24

Closed

Description

@Tiritibambix

Disclaimer: I got out of my depth pretty quickly with this one, and I'm not a coder at all. I used AI assistance to help me isolate the issue, so please take my analysis with a grain of salt. Happy to be corrected!

I ran into an issue with speaker diarization. Transcription works fine, but as soon as diarization kicks in, the job fails with this error:

TypeError: Pipeline.from_pretrained() got an unexpected keyword argument 'token'

Full traceback from the logs:

ERROR Job failed | ts=2026-05-14T11:07:56.642051+00:00 logger=amicoscript.worker job_id=79dbceb0-ee46-44e8-b5d5-131921ad781e traceback=Traceback (most recent call last):
  File "/app/backend/core/transcription.py", line 406, in _process_job
    speakers = _run_diarization_phase(job_id, segments_list, job)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/backend/core/diarization.py", line 60, in _run_diarization_phase
    pipeline = _Pipeline.from_pretrained(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Pipeline.from_pretrained() got an unexpected keyword argument 'token'
ERROR error: Pipeline.from_pretrained() got an unexpected keyword argument 'token' | ts=2026-05-14T11:07:56.642472+00:00 logger=amicoscript.worker job_id=79dbceb0-ee46-44e8-b5d5-131921ad781e 

My setup

What I found

The code in backend/core/diarization.py calls:

pipeline = _Pipeline.from_pretrained(
    "pyannote/speaker-diarization-3.1",
    token=opts["hf_token"],
)

But when I checked the actual signature of Pipeline.from_pretrained in the installed version of pyannote.audio (3.4.0), I got this:

(checkpoint_path, hparams_file=None, use_auth_token=None, cache_dir=...)

So pyannote 3.4.0 expects use_auth_token= and does not accept token= at all, which explains the error.

The fix would be to replace token= with use_auth_token= in diarization.py. Again, I may be wrong, but that's what the AI and I came up with!

Thanks for the great tool regardless.

Activity

  1. Tiritibambix commented on May 14, 2026

    @Tiritibambix
    Author

    Hey, just a quick follow-up on my previous issue.

    After digging deeper, the real problem is a dependency conflict: pyannote.audio 3.4.0 calls hf_hub_download() internally with use_auth_token=, but huggingface_hub 1.14.0 (which your requirements.txt pulls in) has dropped that argument entirely. The two deps are incompatible with each other.

    No workaround seems to stick. Swapping argument names just moves the error around. Needs a fix on the dependency side.

  2. sim186 commented on May 15, 2026

    @sim186
    Owner

    Thanks a lot for the precise reporting @Tiritibambix . Will take soon a look. In general how felt so far the experience with the software? Not considering of course the diarization issue?

  3. Tiritibambix commented on May 15, 2026

    @Tiritibambix
    Author

    Hey, glad you're looking into it!

    For what it's worth, I managed to get diarization working by manually forcing these versions and changing one line:

    • pyannote.audio == 3.4.0
    • huggingface_hub == 0.24.7
    • torch == 2.5.1
    • torchaudio == 2.5.1
    • diarization.py line 62: use_auth_token= instead of token=

    As for the overall experience, honestly, I love it. I take remote classes, I record the videos, and being able to search directly through the transcripts saves me an incredible amount of time. It's exactly the kind of tool I was looking for. Thanks so much for building it, and I hope sorting out the dependency mess won't be too painful!

  4. sim186 commented on May 16, 2026

    @sim186
    Owner

    nice to hear 😄 . If you pull the latest main hopefully should get the fix.

  5. added a commit that references this issue on May 16, 2026
  6. Tiritibambix commented on May 17, 2026

    @Tiritibambix
    Author

    Hey, diarization is still broken out of the box. After a clean clone + docker-compose build --no-cache, I get a chain of errors that only go away by manually forcing specific versions inside the running container.

    The errors come in sequence:

    1. hf_hub_download() got an unexpected keyword argument 'use_auth_token' — huggingface_hub latest drops that argument, so pyannote fails internally
    2. Weights only load failed / TorchVersion was not an allowed global — PyTorch 2.6 changed the default of torch.load(weights_only=...) and the pyannote checkpoints aren't compatible with it

    The combination that actually works for me:

    • huggingface_hub==0.24.7
    • torch==2.5.1
    • torchaudio==2.5.1

    These need to be pinned in requirements.txt (or capped with < constraints) so the build pulls compatible versions. Right now the unpinned build pulls versions that break pyannote internally regardless of what the app code does.

    Hope that helps!

  7. sim186 commented on May 17, 2026

    @sim186
    Owner

    @Tiritibambix I think the issue should be fixed by now. Tested both in docker and venv.

    I also took the chance to clean-up a bit the interface I hope is a little clearer now.

  8. Tiritibambix commented on May 18, 2026

    @Tiritibambix
    Author

    Hey, thanks for the fix, tested and working!

    One small thing though: I notice you're now using speaker-diarization-community-1 but the "Accept license" link in the UI still points to pyannote/speaker-diarization-3.1. It should be updated to https://huggingface.co/pyannote/speaker-diarization-community-1

    Thanks for the great work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions