-
I have tried to follow the various discussions threads on loading the pyannote/speaker-diarization-3.1 pipeline locally but I cannot still load the models successfully. Python version: 3.10 My directory structure looks like this: root/ content of config.yaml: version: 3.1.0
pipeline:
name: pyannote.audio.pipelines.SpeakerDiarization
params:
clustering: AgglomerativeClustering
embedding: models/pytorch_model.bin
embedding_batch_size: 32
embedding_exclude_overlap: true
segmentation: models/seg_pytorch_model.bin
segmentation_batch_size: 32
params:
clustering:
method: centroid
min_cluster_size: 12
threshold: 0.7045654963945799
segmentation:
min_duration_off: 0.0 from pyannote.audio import Pipeline
pipeline = Pipeline.from_pretrained("models/config.yaml")
audio_file = "audio.wav"
segments = pipeline(audio_file)
for segment, _, speaker in segments.itertracks(yield_label=True):
print(segment.start, segment.end, segment.speaker) Errors:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @Harshs-09, great question, and I’ve seen this issue trip up many users when switching from HuggingFace-hosted models to local pipelines with pyannote. Let me walk you through it.. Why you’re seeing pipeline.instantiate(parameters)When you load a config.yaml via:
This happens because config.yaml doesn't contain the pre-frozen parameters — you still need to explicitly instantiate the pipeline. Fix: Use .instantiate({}) after loadingHere’s how you should modify your code:
This will correctly initialize and apply your local speaker diarization pipeline. Bonus tipsValidate paths inside config.yaml: If you have pretrained weights but not the YAML config, you can manually define the pipeline using:
Let me know if that solves the issue, happy to help with further debugging. Good luck with your project! 👏🏽 |
Beta Was this translation helpful? Give feedback.
-
Hi, Thank you for the help. It works properly now. |
Beta Was this translation helpful? Give feedback.
Hi @Harshs-09, great question, and I’ve seen this issue trip up many users when switching from HuggingFace-hosted models to local pipelines with pyannote.
Let me walk you through it..
Why you’re seeing pipeline.instantiate(parameters)
When you load a config.yaml via:
pipeline = Pipeline.from_pretrained("models/config.yaml")
you’re only parsing the config template, not the full pipeline object yet. That’s why pipeline(audio_file) throws:
RuntimeError: A pipeline must be instantiated with
pipeline.instantiate(parameters)``This happens because config.yaml doesn't contain the pre-frozen parameters — you still need to explicitly instantiate the pipeline.
Fix: Use .instantiate({}) after loading
…