Problem with pyannote.audio==3.1.0

Hello! Thank you so much!! I realized.. I should read the error msg properly to solve the problem!!! xD

I have one more problem….

I made a code as below..

from pathlib import Path
import os, sys

ffmpeg_dll_dir = Path(r"C:\Users\majh0\miniconda3\Library\bin")  
assert ffmpeg_dll_dir.exists(), ffmpeg_dll_dir
os.add_dll_directory(str(ffmpeg_dll_dir))  

import torch, torchcodec, platform, subprocess
print("exe:", sys.executable)
print("torch", torch.__version__, "torchcodec", torchcodec.__version__, "py", platform.python_version())
subprocess.run(["ffmpeg", "-version"], check=True)
print("cuda torch?",torch.cuda.is_available())

# instantiate the pipeline
import torch
from pyannote.audio import Pipeline

pipeline = Pipeline.from_pretrained(
  "pyannote/speaker-diarization-3.1",
  token="my token")


if torch.cuda.is_available():
    pipeline.to(torch.device("cuda"))
    print("Using CUDA")
else:
    print("Using CPU")

audio_file ="./guitar.wav"
diarization = pipeline(audio_file)

# dump the diarization output to disk using RTTM format
with open("./guitar.rttm", "w", encoding="utf-8") as rttm:
    diarization.write_rttm(rttm)

this thing gave me error as below…

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[15], line 6
      4 # dump the diarization output to disk using RTTM format
      5 with open("./guitar.rttm", "w", encoding="utf-8") as rttm:
----> 6     diarization.write_rttm(rttm)

AttributeError: 'DiarizeOutput' object has no attribute 'write_rttm'

This thing is hard to understand for me… because I literally typed “diarization.write_rttm(rttm)” same with the example of this document like picture below https://huggingface.co/pyannote/speaker-diarization-3.1

the name of the function “write_rttm” has changed? then is there any way to check the new name of it..?

or did I make another mistake again..?

I think I am bothering you too much.. but thank you so much for your help..

1 Like