Skip to content

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

@Tiritibambix

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.

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