mirror of
https://github.com/m-bain/whisperX.git
synced 2025-07-01 18:17:27 -04:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
f4261f34e9 | |||
429658d4cc | |||
e0833da5dc | |||
ffedc5cdf0 |
@ -2,7 +2,7 @@
|
||||
urls = { repository = "https://github.com/m-bain/whisperx" }
|
||||
authors = [{ name = "Max Bain" }]
|
||||
name = "whisperx"
|
||||
version = "3.4.0"
|
||||
version = "3.4.2"
|
||||
description = "Time-Accurate Automatic Speech Recognition using Whisper."
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.9, <3.13"
|
||||
|
2
uv.lock
generated
2
uv.lock
generated
@ -2788,7 +2788,7 @@ wheels = [
|
||||
|
||||
[[package]]
|
||||
name = "whisperx"
|
||||
version = "3.4.0"
|
||||
version = "3.4.2"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "ctranslate2" },
|
||||
|
@ -424,7 +424,7 @@ def get_wildcard_emission(frame_emission, tokens, blank_id):
|
||||
wildcard_mask = (tokens == -1)
|
||||
|
||||
# Get scores for non-wildcard positions
|
||||
regular_scores = frame_emission[tokens.clamp(min=0)] # clamp to avoid -1 index
|
||||
regular_scores = frame_emission[tokens.clamp(min=0).long()] # clamp to avoid -1 index
|
||||
|
||||
# Create a mask and compute the maximum value without modifying frame_emission
|
||||
max_valid_score = frame_emission.clone() # Create a copy
|
||||
|
@ -213,12 +213,19 @@ def transcribe_task(args: dict, parser: argparse.ArgumentParser):
|
||||
results = []
|
||||
diarize_model = DiarizationPipeline(model_name=diarize_model_name, use_auth_token=hf_token, device=device)
|
||||
for result, input_audio_path in tmp_results:
|
||||
diarize_segments, speaker_embeddings = diarize_model(
|
||||
diarize_result = diarize_model(
|
||||
input_audio_path,
|
||||
min_speakers=min_speakers,
|
||||
max_speakers=max_speakers,
|
||||
return_embeddings=return_speaker_embeddings
|
||||
)
|
||||
|
||||
if return_speaker_embeddings:
|
||||
diarize_segments, speaker_embeddings = diarize_result
|
||||
else:
|
||||
diarize_segments = diarize_result
|
||||
speaker_embeddings = None
|
||||
|
||||
result = assign_word_speakers(diarize_segments, result, speaker_embeddings)
|
||||
results.append((result, input_audio_path))
|
||||
# >> Write
|
||||
|
@ -52,23 +52,3 @@ class Vad:
|
||||
|
||||
return merged_segments
|
||||
|
||||
# Unused function
|
||||
@staticmethod
|
||||
def merge_vad(vad_arr, pad_onset=0.0, pad_offset=0.0, min_duration_off=0.0, min_duration_on=0.0):
|
||||
active = Annotation()
|
||||
for k, vad_t in enumerate(vad_arr):
|
||||
region = Segment(vad_t[0] - pad_onset, vad_t[1] + pad_offset)
|
||||
active[region, k] = 1
|
||||
|
||||
if pad_offset > 0.0 or pad_onset > 0.0 or min_duration_off > 0.0:
|
||||
active = active.support(collar=min_duration_off)
|
||||
|
||||
# remove tracks shorter than min_duration_on
|
||||
if min_duration_on > 0:
|
||||
for segment, track in list(active.itertracks()):
|
||||
if segment.duration < min_duration_on:
|
||||
del active[segment, track]
|
||||
|
||||
active = active.for_json()
|
||||
active_segs = pd.DataFrame([x['segment'] for x in active['content']])
|
||||
return active_segs
|
||||
|
Reference in New Issue
Block a user