File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change 44import warnings
55
66import numpy as np
7+ import pandas as pd
78import torch
89
910from whisperx .alignment import align , load_align_model
@@ -218,15 +219,23 @@ def transcribe_task(args: dict, parser: argparse.ArgumentParser):
218219 diarize_model = DiarizationPipeline (model_name = diarize_model_name , use_auth_token = hf_token , device = device )
219220 for result , input_audio_path in tmp_results :
220221 diarize_result = diarize_model (
221- input_audio_path ,
222- min_speakers = min_speakers ,
223- max_speakers = max_speakers ,
222+ input_audio_path ,
223+ min_speakers = min_speakers ,
224+ max_speakers = max_speakers ,
224225 return_embeddings = return_speaker_embeddings
225226 )
226227
227228 if return_speaker_embeddings :
229+ if not isinstance (diarize_result , tuple ):
230+ raise TypeError (
231+ f"Expected tuple when return_embeddings=True, got { type (diarize_result ).__name__ } "
232+ )
228233 diarize_segments , speaker_embeddings = diarize_result
229234 else :
235+ if not isinstance (diarize_result , pd .DataFrame ):
236+ raise TypeError (
237+ f"Expected DataFrame when return_embeddings=False, got { type (diarize_result ).__name__ } "
238+ )
230239 diarize_segments = diarize_result
231240 speaker_embeddings = None
232241
You can’t perform that action at this time.
0 commit comments