Views
No views yet
pyannote/segmentation-3.0 (via HuggingFace diarizers) on Bengali
multi-speaker data. Tuned clustering threshold: 0.65 - also stored in
tuned_params.json in this repo for programmatic loading.1import json, torch
2from pyannote.audio import Pipeline
3from huggingface_hub import hf_hub_download
4from diarizers import SegmentationModel
5
6device = "cuda" if torch.cuda.is_available() else "cpu"
7pipeline = Pipeline.from_pretrained("pyannote/speaker-diarization-3.1")
8seg = SegmentationModel().from_pretrained("rasel-harun/pyannote-bengali-finetuned-custom-V4-ss10").to_pyannote_model()
9pipeline._segmentation.model = seg.to(device)
10pipeline.to(torch.device(device))
11
12tp = json.load(open(hf_hub_download("rasel-harun/pyannote-bengali-finetuned-custom-V4-ss10", "tuned_params.json")))
13params = pipeline.parameters(instantiated=True)
14params["clustering"]["threshold"] = tp["clustering_threshold"]
15params["segmentation"]["min_duration_off"] = tp["segmentation_min_duration_off"]
16pipeline.instantiate(params)
17
18diarization = pipeline("audio.wav", min_speakers=tp["min_speakers"],
19 max_speakers=tp["max_speakers"])