Merge branch 'release/4.0.4'

This commit is contained in:
Hervé BREDIN committed 2026-02-07 10:55:11 +01:00
commit 78c0d16a5f
6 files changed
+3333 -1952

No files matched your search

+6
View File
@@ -1,5 +1,11 @@
# CHANGELOG
## Version 4.0.4 (2026-02-07)
- feat(sample): add transcription of sample file
- setup: relax torch dependencies constraints
- fix(pipeline): fix HF authentication for Speechbrain speaker embedding [@krisoye](https://github.com/krisoye)
## Version 4.0.3 (2025-12-07)
- feat(cli): add `--revision` option to most CLI commands
+3 -4
View File
@@ -23,11 +23,10 @@ dependencies = [
"rich>=13.9.4",
"safetensors>=0.5.2",
"torch-audiomentations>=0.12.0",
"torch==2.8.0",
"torchaudio==2.8.0",
"torchcodec==0.7.0",
"torch>=2.8.0",
"torchaudio>=2.8.0",
"torchcodec>=0.7.0",
"torchmetrics>=1.6.1",
"soundfile>=0.13.1",
"matplotlib>=3.10.0",
"pyannoteai-sdk>=0.3.0",
]
@@ -256,7 +256,7 @@ class SpeechBrainPretrainedSpeakerEmbedding(BaseInference):
source=self.embedding,
savedir=f"{self.cache_dir}/speechbrain",
run_opts={"device": self.device},
use_auth_token=self.token,
token=self.token,
huggingface_cache_dir=self.cache_dir,
revision=self.revision,
)
@@ -271,7 +271,7 @@ class SpeechBrainPretrainedSpeakerEmbedding(BaseInference):
source=self.embedding,
savedir=f"{self.cache_dir}/speechbrain",
run_opts={"device": device},
use_auth_token=self.token,
token=self.token,
huggingface_cache_dir=self.cache_dir,
revision=self.revision,
)
+34 -11
View File
@@ -1,6 +1,7 @@
# MIT License
#
# Copyright (c) 2024- CNRS
# Copyright (c) 2024-2025 CNRS
# Copyright (c) 2026- pyannoteAI
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -23,34 +24,56 @@
from pathlib import Path
from pyannote.audio.core.io import Audio, AudioFile
from pyannote.core import Annotation, Segment, Timeline
from pyannote.database.util import load_rttm
from pyannote.audio.core.io import Audio, AudioFile
def load_stm(file_stm: str | Path) -> dict[str, list[dict]]:
session_ids = {}
with open(file_stm, "r") as stm:
for line in stm:
infos = line.strip().split()
session_id, _, spk, start, end, *words = infos
entry = {
"start": float(start),
"end": float(end),
"text": " ".join(words),
"speaker": spk,
}
session_ids.setdefault(session_id, []).append(entry)
return session_ids
def _sample() -> AudioFile:
sample_wav = Path(__file__).parent / "sample.wav"
uri = "sample"
def _sample(uri: str = "sample") -> AudioFile:
sample_wav = Path(__file__).parent / f"{uri}.wav"
audio = Audio()
waveform, sample_rate = audio(sample_wav)
sample_rttm = Path(__file__).parent / "sample.rttm"
annotation: Annotation = load_rttm(sample_rttm)[uri]
sample_rttm = Path(__file__).parent / f"{uri}.rttm"
diarization: Annotation = load_rttm(sample_rttm)[uri]
duration = audio.get_duration(sample_wav)
annotated: Timeline = Timeline([Segment(0.0, duration)], uri=uri)
sample_stm = Path(__file__).parent / f"{uri}.stm"
transcription = load_stm(sample_stm)[uri]
return {
"audio": sample_wav,
"uri": "sample",
"uri": uri,
"waveform": waveform,
"sample_rate": sample_rate,
"annotation": annotation,
"annotation": diarization,
"annotated": annotated,
"diarization": diarization,
"transcription": transcription,
}
SAMPLE_FILE = _sample()
SAMPLE_FILE = _sample(uri="sample")
+13
View File
@@ -0,0 +1,13 @@
sample 1 Diane 6.68 7.16 Hello?
sample 1 Sheila 7.634 8.155 Hello?
sample 1 Diane 8.436 8.876 Oh, hello.
sample 1 Diane 8.916 9.798 I didn't know you were there.
sample 1 Sheila 9.838 10.78 Neither did I.
sample 1 Diane 10.78 12.54 Okay, then I thought you know, I heard a beep.
sample 1 Diane 12.542 14.184 This is Diane in New Jersey.
sample 1 Sheila 14.444 17.769 And I'm Sheila in Texas, originally from Chicago.
sample 1 Diane 17.789 20.113 Oh, I'm originally from Chicago also.
sample 1 Diane 20.173 21.475 I'm in New Jersey now though.
sample 1 Sheila 21.935 23.978 Well, there isn't that much difference.
sample 1 Sheila 24.058 28.425 At least you know, they all call me a Yankee down here, so what can I say?
sample 1 Diane 28.445 29.987 Oh, I don't hear that in New Jersey now.
Generated
+3275 -1935
View File
File diff suppressed because it is too large. Load diff