kadirnar / whisper-plus

WhisperPlus: Faster, Smarter, and More Capable 🚀
Apache License 2.0
1.71k stars 137 forks source link

Error: ImportError: 'speechbrain' must be installed to use 'speechbrain/spkrec-ecapa-voxceleb' embeddings. #93

Closed PiotrEsse closed 6 months ago

PiotrEsse commented 6 months ago

I am trying to use Diarization example from Your readme. Ive hardcoded path to a file (tested .mp3 and .wav). I am always getting Error: ImportError: 'speechbrain' must be installed to use 'speechbrain/spkrec-ecapa-voxceleb' embeddings. This is the code I use: ` from whisperplus import ( ASRDiarizationPipeline, download_and_convert_to_mp3, format_speech_to_dialogue, )

audio_path = download_and_convert_to_mp3("https://www.youtube.com/watch?v=mRB14sFHw2E")

audio_path = "/home/piotr/WhisperPlus/Tutorial/zycie.mp3"

device = "cuda" # cpu or mps pipeline = ASRDiarizationPipeline.from_pretrained( asr_model="openai/whisper-large-v3", diarizer_model="pyannote/speaker-diarization", use_auth_token=False,

use_auth_token="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",

chunk_length_s=30,
device=device,

)

output_text = pipeline(audio_path, num_speakers=2, min_speaker=1, max_speaker=2) dialogue = format_speech_to_dialogue(output_text) print(dialogue)

` This is traceback:

` (WhisperPlus38) (base) piotr@Legion7:~/WhisperPlus/Tutorial$ /home/piotr/anaconda3/envs/WhisperPlus38/bin/python /home/piotr/WhisperPlus/Tutorial/diarizoation.py 2024-05-07 13:00:27,424 - WARNING - /home/piotr/anaconda3/envs/WhisperPlus38/lib/python3.8/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. 2024-05-07 13:00:32,154 - INFO - Lightning automatically upgraded your loaded checkpoint from v1.5.4 to v2.2.4. To apply the upgrade to your files permanently, run python -m pytorch_lightning.utilities.upgrade_checkpoint ../../.cache/torch/pyannote/models--pyannote--segmentation/snapshots/c4c8ceafcbb3a7a280c2d357aee9fbc9b0be7f9b/pytorch_model.bin Model was trained with pyannote.audio 0.0.1, yours is 3.1.1. Bad things might happen unless you revert pyannote.audio to 0.x. Model was trained with torch 1.10.0+cu102, yours is 2.3.0+cu121. Bad things might happen unless you revert torch to 1.x. Traceback (most recent call last): File "/home/piotr/WhisperPlus/Tutorial/diarizoation.py", line 11, in pipeline = ASRDiarizationPipeline.from_pretrained( File "/home/piotr/anaconda3/envs/WhisperPlus38/lib/python3.8/site-packages/whisperplus/pipelines/whisper_diarize.py", line 43, in from_pretrained diarization_pipeline = Pipeline.from_pretrained(diarizer_model, use_auth_token=use_auth_token) File "/home/piotr/anaconda3/envs/WhisperPlus38/lib/python3.8/site-packages/pyannote/audio/core/pipeline.py", line 136, in from_pretrained pipeline = Klass(**params) File "/home/piotr/anaconda3/envs/WhisperPlus38/lib/python3.8/site-packages/pyannote/audio/pipelines/speaker_diarization.py", line 167, in init self._embedding = PretrainedSpeakerEmbedding( File "/home/piotr/anaconda3/envs/WhisperPlus38/lib/python3.8/site-packages/pyannote/audio/pipelines/speaker_verification.py", line 754, in PretrainedSpeakerEmbedding return SpeechBrainPretrainedSpeakerEmbedding( File "/home/piotr/anaconda3/envs/WhisperPlus38/lib/python3.8/site-packages/pyannote/audio/pipelines/speaker_verification.py", line 245, in init raise ImportError( ImportError: 'speechbrain' must be installed to use 'speechbrain/spkrec-ecapa-voxceleb' embeddings. Visit https://speechbrain.github.io for installation instructions.

`

kadirnar commented 6 months ago

Thank you for your interest in the WhisperPlus library. I will test it.

kadirnar commented 6 months ago

I explained it here.

https://github.com/kadirnar/whisper-plus?tab=readme-ov-file#-speaker-diarization