From cf8e000a84e888495dcf30c4dbfecea1ee7ab4e2 Mon Sep 17 00:00:00 2001
From: jmwang66 <wangjiaming.wjm@alibaba-inc.com>
Date: 星期一, 07 八月 2023 16:13:37 +0800
Subject: [PATCH] Merge pull request #807 from alibaba-damo-academy/dev_wjm

---
 egs/callhome/diarization/sond/finetune.sh |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/egs/callhome/diarization/sond/finetune.sh b/egs/callhome/diarization/sond/finetune.sh
index 91e6798..1b53690 100644
--- a/egs/callhome/diarization/sond/finetune.sh
+++ b/egs/callhome/diarization/sond/finetune.sh
@@ -43,8 +43,8 @@
 count=1
 
 # general configuration
-stage=1
-stop_stage=1
+stage=0
+stop_stage=10
 # number of jobs for data process
 nj=16
 sr=8000
@@ -177,6 +177,7 @@
   sv_exp_dir=exp/speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch
 
   if [ ! -e ${sv_exp_dir} ]; then
+    echo "start to download sv models"
     git lfs install
     git clone https://www.modelscope.cn/damo/speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch.git
     mv speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch ${expdir}/
@@ -242,7 +243,7 @@
 
   echo "Stage 6: start to dump for callhome1."
   python -Wignore script/dump_meeting_chunks.py --dir ${data_dir} \
-    --out ${dumpdir}/callhome1/dumped_files/data --n_spk 16 --no_pbar --sr 8000 --mode test \
+    --out ${dumpdir}/callhome1/dumped_files/data --n_spk 16 --no_pbar --sr 8000 --mode train \
     --chunk_size 1600 --chunk_shift 400 --add_mid_to_speaker true
 
   mkdir -p ${datadir}/callhome1/dumped_files
@@ -279,6 +280,15 @@
 # Finetune model on callhome1, this will take about 1.5 hours.
 if [ ${stage} -le 7 ] && [ ${stop_stage} -ge 7 ]; then
   echo "Stage 7: Finetune pretrained model on callhome1."
+
+  if [ ! -e ${expdir}/speech_diarization_sond-en-us-swbd_sre-8k-n16k4-pytorch ]; then
+    echo "start to download pretrained models"
+    git lfs install
+    git clone https://www.modelscope.cn/damo/speech_diarization_sond-en-us-swbd_sre-8k-n16k4-pytorch.git
+    mv speech_diarization_sond-en-us-swbd_sre-8k-n16k4-pytorch ${expdir}/
+    echo "Done."
+  fi
+
   world_size=$gpu_num  # run on one machine
   mkdir -p ${expdir}/${model_dir}
   mkdir -p ${expdir}/${model_dir}/log
@@ -319,7 +329,7 @@
               --valid_data_path_and_name_and_type ${datadir}/${valid_set}/dumped_files/profile.scp,profile,kaldi_ark \
               --valid_data_path_and_name_and_type ${datadir}/${valid_set}/dumped_files/label.scp,binary_labels,kaldi_ark \
               --valid_shape_file ${expdir}/${valid_set}_states/speech_shape \
-              --init_param exp/pretrained_models/phase2.pth \
+              --init_param ${expdir}/speech_diarization_sond-en-us-swbd_sre-8k-n16k4-pytorch/sond.pth \
               --unused_parameters true \
               ${init_opt} \
               ${freeze_opt} \
@@ -388,7 +398,7 @@
 
 # Scoring for finetuned model, you may get a DER like:
 # oracle_vad  |  system_vad
-#   7.28      |     8.06
+#   7.32      |     8.14
 if [ ${stage} -le 9 ] && [ ${stop_stage} -ge 9 ]; then
   echo "stage 9: Scoring finetuned models"
   if [ ! -e dscore ]; then
@@ -427,11 +437,11 @@
 # Then find the wav files to construct wav.scp and put it at data/callhome2/wav.scp.
 # After iteratively perform SOAP, you will get DER results like:
 # iters : oracle_vad  |  system_vad
-# iter_0:   9.63      |     10.43
-# iter_1:   9.17      |     10.03
-# iter_2:   9.11      |     9.98
-# iter_3:   9.08      |     9.96
-# iter_4:   9.07      |     9.95
+# iter_0:   9.58      |     10.46
+# iter_1:   9.22      |     10.15
+# iter_2:   9.21      |     10.14
+# iter_3:   9.30      |     10.24
+# iter_4:   9.29      |     10.23
 if [ ${stage} -le 10 ] && [ ${stop_stage} -ge 10 ]; then
   if [ ! -e ${expdir}/speech_xvector_sv-en-us-callhome-8k-spk6135-pytorch ]; then
     git lfs install

--
Gitblit v1.9.1