m-bain / whisperX

WhisperX: Automatic Speech Recognition with Word-level Timestamps (& Diarization)
BSD 2-Clause "Simplified" License
12.49k stars 1.31k forks source link

missing 2 required positional arguments: 'repetition_penalty' and 'prompt_reset_on_temperature' when upgrade faster-whisper #444

Open fseasy opened 1 year ago

fseasy commented 1 year ago

when I install faster-whisper by hand and version changed from 0.7.0 -> 0.7.1, then the whisperX will raise error

File "xxx.py", line 321, in _do_transcribe
    model = whisperx.load_model(whisper_arch="large-v2", device=self.device, compute_type=self.compute_type)
  File "xxxx/.miniconda3/envs/vdub/lib/python3.9/site-packages/whisperx/asr.py", line 89, in load_model
    default_asr_options = faster_whisper.transcribe.TranscriptionOptions(**default_asr_options)
TypeError: <lambda>() missing 2 required positional arguments: 'repetition_penalty' and 'prompt_reset_on_temperature'

It's because un-compatibility upgrade of faster-whisper. But could we fix it? I can handly add this two params as

  asr_options={
      "repetition_penalty": 1, 
      "prompt_reset_on_temperature": 0.5
  }

but it's better to upgrade the code for compatibility

pinballelectronica commented 1 year ago

Thanks. I was banging my head on the wall for a half hour trying to understand where this issue came in from.

hammad26 commented 1 year ago

Now there is a 3rd one as well:

lib/python3.8/site-packages/whisperx/asr.py:62, in load_model(whisper_arch, device, compute_type, asr_options, language, vad_options, model, task)
     60 if asr_options is not None:
     61     default_asr_options.update(asr_options)
---> 62 default_asr_options = faster_whisper.transcribe.TranscriptionOptions(**default_asr_options)
     64 default_vad_options = {
     65     "vad_onset": 0.500,
     66     "vad_offset": 0.363
     67 }
     69 if vad_options is not None:

TypeError: __new__() missing 3 required positional arguments: 'repetition_penalty', 'no_repeat_ngram_size', and 'prompt_reset_on_temperature'

Fix with default value:

asr_options={
    "repetition_penalty": 1, 
    "prompt_reset_on_temperature": 0.5,
    "no_repeat_ngram_size": 0
}