Downloads · 30 days
6
4% of all-time downloads
zhniu/wav2vec2_ssd
wav2vec2_ssd is a machine learning model from zhniu. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Downloads · 30 days
6
4% of all-time downloads
All-time downloads
169
Public
Parameters
94.4M
2.6 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors378 MB · 100%
From the Hugging Face model README
the opensource address: here
This repository provides a comprehensive solution for speaker diarization using a Wav2Vec2-based model. It includes scripts for data preparation, training, evaluation, and inference.
The first step is to prepare the training and testing data. This involves generating reference labels from RTTM files and splitting the audio into chunks.
Run the following script to generate training data. You need to provide the directory containing the RTTM files and a list of WAV files.
bash prepare_training_data/gen_training_data_for_ssd.sh
This script will:
wav_list_file.txt.prepare_training_data/dir_ref_out/.Similarly, run the following script to generate test data.
bash prepare_training_data/gen_test_data_for_ssd.sh
This script will generate test data and save it in prepare_training_data/dir_ref_out_for_test/.
Once the data is prepared, you can train the speaker diarization model.
bash run_ssd_train.sh
This script will:
zhniu/wav2vec2_ssd model../experiments/new_model directory.After training, you can evaluate the model's performance on the test set. The evaluation script calculates precision, recall, and F1-score for speaker change detection (SCD).
python src/run_ssd_metrics.py \
--model_checkpoint ./experiments/new_model \
--file_list prepare_training_data/wav_list_file_for_test.txt \
--rttm_dir /path/to/your/rttm/test/dir \
--matchrange 0.5
The script will output the following metrics:
For running inference on a single audio file to detect speaker changes, use the run_ssd_eval.py script.
python src/run_ssd_eval.py --file examples/test.wav
The output will show the timestamps of the detected speaker changes:
python src/run_ssd_eval.py --file examples/test.wav
2025-08-21 03:32:35,644 - INFO - Using device: cuda
2025-08-21 03:32:35,650 - INFO - Loading model and processor...
2025-08-21 03:32:38,377 - INFO - Processing audio file...
2025-08-21 03:32:40,168 - INFO - Extracting speaker change information...
2025-08-21 03:32:40,168 - INFO - Smoothing parameters: min_interval=0.2s, window_size=0.4s, smooth_strength=1.0
--- Speaker Change Points ---
Change No. Time (s)
------------------------------
Change 1 6.772
Change 2 34.587
Change 3 49.373
Change 4 104.197
Change 5 113.366
---
license: apache-2.0
---