Views
No views yet
1apt-get update && apt-get install -y libsndfile1 ffmpeg
2pip install Cython packaging
3pip install git+https://github.com/NVIDIA/NeMo.git@main#egg=nemo_toolkit[asr]1from nemo.collections.asr.models import SortformerEncLabelModel
2
3# Load model from Hugging Face
4diar_model = SortformerEncLabelModel.from_pretrained("devsy0117/ultra_diar_streaming_sortformer_5spk_v1")
5diar_model.eval()
6
7# Streaming parameters (recommended for best performance)
8diar_model.sortformer_modules.chunk_len = 340
9diar_model.sortformer_modules.chunk_right_context = 40
10diar_model.sortformer_modules.fifo_len = 40
11diar_model.sortformer_modules.spkcache_update_period = 300
12
13# Run diarization
14predicted_segments = diar_model.diarize(audio=["/path/to/your/audio.wav"], batch_size=1)
15
16for segment in predicted_segments[0]:
17 print(segment)1from nemo.collections.asr.models import SortformerEncLabelModel
2
3# Option 1: Load directly from Hugging Face
4diar_model = SortformerEncLabelModel.from_pretrained("devsy0117/ultra_diar_streaming_sortformer_5spk_v1")
5
6# Option 2: Load from a downloaded .nemo file
7diar_model = SortformerEncLabelModel.restore_from(
8 restore_path="/path/to/ultra_diar_streaming_sortformer_5spk_v1.nemo",
9 map_location="cuda",
10 strict=False,
11)
12
13diar_model.eval()audio_input="/path/to/multispeaker_audio.wav"audio_input=["/path/to/audio1.wav", "/path/to/audio2.wav"]Note: The base model (v2.1) is trained for up to 4 speakers. The lowerSpk_Count_Accof this model on AliMeeting and AMI IHM reflects sessions with ≤4 speakers being predicted as 5, a trade-off from extending to 5-speaker support. DER improves significantly due to reduced MISS rate.