raphaelbiojout commited on
Commit
d359671
·
1 Parent(s): 38217d8
Files changed (2) hide show
  1. handler.py +5 -5
  2. requirements.txt +2 -1
handler.py CHANGED
@@ -179,7 +179,7 @@ class EndpointHandler():
179
 
180
  self.diarize_model = whisperx.DiarizationPipeline(
181
  "pyannote/speaker-diarization-3.0",
182
- use_auth_token="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", device="cpu")
183
 
184
  logger.info(f"Model for diarization initialized")
185
 
@@ -235,6 +235,9 @@ class EndpointHandler():
235
  if info:
236
  print(transcription["segments"][0:10000]) # before alignment
237
  logger.info(transcription["segments"][0:10000])
 
 
 
238
 
239
  # 3. align
240
  if alignment:
@@ -262,10 +265,7 @@ class EndpointHandler():
262
  logger.info(transcription["segments"][0:10000]) # segments are now assigned speaker IDs
263
 
264
  if torch.cuda.is_available():
265
- logger.info("--------------- GPU ------------------------")
266
- logger.info(display_gpu_infos())
267
- torch.cuda.empty_cache()
268
- logger.info("--------------- GPU AFTER empty_cache ------------------------")
269
  logger.info(display_gpu_infos())
270
 
271
  # results_json = json.dumps(results)
 
179
 
180
  self.diarize_model = whisperx.DiarizationPipeline(
181
  "pyannote/speaker-diarization-3.0",
182
+ use_auth_token="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", device=device)
183
 
184
  logger.info(f"Model for diarization initialized")
185
 
 
235
  if info:
236
  print(transcription["segments"][0:10000]) # before alignment
237
  logger.info(transcription["segments"][0:10000])
238
+ if len(transcription["segments"]) == 0:
239
+ logger.warning("No transcription")
240
+ return {"transcription": transcription["segments"]}
241
 
242
  # 3. align
243
  if alignment:
 
265
  logger.info(transcription["segments"][0:10000]) # segments are now assigned speaker IDs
266
 
267
  if torch.cuda.is_available():
268
+ logger.info("--------------- GPU AFTER ------------------------")
 
 
 
269
  logger.info(display_gpu_infos())
270
 
271
  # results_json = json.dumps(results)
requirements.txt CHANGED
@@ -2,4 +2,5 @@ git+https://github.com/m-bain/whisperX.git
2
  ffmpeg-python==0.2.0
3
  setuptools
4
  torch==2.0.0
5
- torchaudio==2.0.0
 
 
2
  ffmpeg-python==0.2.0
3
  setuptools
4
  torch==2.0.0
5
+ torchaudio==2.0.0
6
+ ctranslate2==3.22.0