huggingface / speechbox

Apache License 2.0
342 stars 33 forks source link

TypeError: AutomaticSpeechRecognitionPipeline._sanitize_parameters() got an unexpected keyword argument 'use_auth_token' #39

Open alvynabranches opened 2 months ago

alvynabranches commented 2 months ago
from speechbox import ASRDiarizationPipeline
from pyannote.audio.pipelines.utils.hook import ProgressHook

pipe = ASRDiarizationPipeline.from_pretrained(asr_model="openai/whisper-base", diarizer_model="pyannote/speaker-diarization-3.1")

with ProgressHook() as hook:
    output = pipe("audio.mp3", hook=hook)

Error

/opt/homebrew/lib/python3.12/site-packages/pyannote/audio/core/io.py:43: UserWarning: torchaudio._backend.set_audio_backend has been deprecated. With dispatcher enabled, this function is no-op. You can remove the function call.
  torchaudio.set_audio_backend("soundfile")
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
Traceback (most recent call last):
  File "/Users/user/asr/main.py", line 21, in <module>
    pipe = ASRDiarizationPipeline.from_pretrained(asr_model="openai/whisper-base", diarizer_model="pyannote/speaker-diarization-3.1")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/speechbox/diarize.py", line 33, in from_pretrained
    asr_pipeline = pipeline(
                   ^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/transformers/pipelines/__init__.py", line 1107, in pipeline
    return pipeline_class(model=model, framework=framework, task=task, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.12/site-packages/transformers/pipelines/automatic_speech_recognition.py", line 220, in __init__
    super().__init__(model, tokenizer, feature_extractor, device=device, torch_dtype=torch_dtype, **kwargs)
  File "/opt/homebrew/lib/python3.12/site-packages/transformers/pipelines/base.py", line 886, in __init__
    self._preprocess_params, self._forward_params, self._postprocess_params = self._sanitize_parameters(**kwargs)
                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: AutomaticSpeechRecognitionPipeline._sanitize_parameters() got an unexpected keyword argument 'use_auth_token'
Pikauba commented 2 months ago

You got to pass a string to use_auth_token that is your personal huggingface token.

Go accept the agreements too on pyannote's huggingface repo to be able to download the models.

pipe = ASRDiarizationPipeline.from_pretrained(asr_model="openai/whisper-base",
diarizer_model="pyannote/speaker-diarization-3.1",
use_auth_token="***your_huggingface_token****")