From 9903ed68237a2a353f12eb136d845d9637d83e6d Mon Sep 17 00:00:00 2001
From: 游雁 <zhifu.gzf@alibaba-inc.com>
Date: 星期三, 24 五月 2023 10:58:26 +0800
Subject: [PATCH] Merge branch 'main' of github.com:alibaba-damo-academy/FunASR merge

---
 docs/m2met2/_build/html/_images/qrcode.png                       |    0 
 docs/m2met2_cn/_build/doctrees/简介.doctree                        |    0 
 docs/m2met2_cn/_build/doctrees/联系方式.doctree                      |    0 
 egs/alimeeting/sa-asr/asr_local.sh                               |    8 ++--
 funasr/bin/asr_train.py                                          |    7 ++-
 docs/m2met2_cn/_build/html/.buildinfo                            |    2 
 docs/m2met2/_build/doctrees/Track_setting_and_evaluation.doctree |    0 
 docs/m2met2_cn/_build/doctrees/规则.doctree                        |    0 
 docs/m2met2/_build/doctrees/Dataset.doctree                      |    0 
 docs/m2met2_cn/_build/doctrees/index.doctree                     |    0 
 docs/m2met2_cn/images/qrcode.png                                 |    0 
 docs/m2met2/_build/doctrees/Baseline.doctree                     |    0 
 docs/m2met2/_build/doctrees/Organizers.doctree                   |    0 
 docs/m2met2_cn/_build/doctrees/environment.pickle                |    0 
 docs/m2met2/_build/doctrees/Rules.doctree                        |    0 
 docs/m2met2_cn/_build/doctrees/基线.doctree                        |    0 
 docs/m2met2_cn/_build/doctrees/组委会.doctree                       |    0 
 egs/alimeeting/sa-asr/conf/train_asr_conformer.yaml              |    1 
 docs/m2met2/_build/html/.buildinfo                               |    2 
 docs/m2met2/_build/doctrees/environment.pickle                   |    0 
 docs/m2met2/_build/doctrees/index.doctree                        |    0 
 docs/m2met2_cn/_build/doctrees/赛道设置与评估.doctree                   |    0 
 funasr/tasks/asr.py                                              |    9 +---
 funasr/tasks/abs_task.py                                         |   23 ++---------
 egs/alimeeting/sa-asr/conf/train_sa_asr_conformer.yaml           |    1 
 docs/m2met2/_build/doctrees/Contact.doctree                      |    0 
 docs/m2met2/images/qrcode.png                                    |    0 
 docs/m2met2_cn/_build/html/_images/qrcode.png                    |    0 
 funasr/bin/asr_infer.py                                          |   22 ++++++++---
 docs/m2met2_cn/_build/doctrees/数据集.doctree                       |    0 
 docs/m2met2/_build/doctrees/Introduction.doctree                 |    0 
 31 files changed, 34 insertions(+), 41 deletions(-)

diff --git a/docs/m2met2/_build/doctrees/Baseline.doctree b/docs/m2met2/_build/doctrees/Baseline.doctree
index c9c4075..e9db7d5 100644
--- a/docs/m2met2/_build/doctrees/Baseline.doctree
+++ b/docs/m2met2/_build/doctrees/Baseline.doctree
Binary files differ
diff --git a/docs/m2met2/_build/doctrees/Contact.doctree b/docs/m2met2/_build/doctrees/Contact.doctree
index 0508819..e272be7 100644
--- a/docs/m2met2/_build/doctrees/Contact.doctree
+++ b/docs/m2met2/_build/doctrees/Contact.doctree
Binary files differ
diff --git a/docs/m2met2/_build/doctrees/Dataset.doctree b/docs/m2met2/_build/doctrees/Dataset.doctree
index 47c8bb4..7030064 100644
--- a/docs/m2met2/_build/doctrees/Dataset.doctree
+++ b/docs/m2met2/_build/doctrees/Dataset.doctree
Binary files differ
diff --git a/docs/m2met2/_build/doctrees/Introduction.doctree b/docs/m2met2/_build/doctrees/Introduction.doctree
index 6ffceef..bbf9a37 100644
--- a/docs/m2met2/_build/doctrees/Introduction.doctree
+++ b/docs/m2met2/_build/doctrees/Introduction.doctree
Binary files differ
diff --git a/docs/m2met2/_build/doctrees/Organizers.doctree b/docs/m2met2/_build/doctrees/Organizers.doctree
index 7ecfbdf..87a23b8 100644
--- a/docs/m2met2/_build/doctrees/Organizers.doctree
+++ b/docs/m2met2/_build/doctrees/Organizers.doctree
Binary files differ
diff --git a/docs/m2met2/_build/doctrees/Rules.doctree b/docs/m2met2/_build/doctrees/Rules.doctree
index 5b7655f..ac881da 100644
--- a/docs/m2met2/_build/doctrees/Rules.doctree
+++ b/docs/m2met2/_build/doctrees/Rules.doctree
Binary files differ
diff --git a/docs/m2met2/_build/doctrees/Track_setting_and_evaluation.doctree b/docs/m2met2/_build/doctrees/Track_setting_and_evaluation.doctree
index 8770fba..4fdd68a 100644
--- a/docs/m2met2/_build/doctrees/Track_setting_and_evaluation.doctree
+++ b/docs/m2met2/_build/doctrees/Track_setting_and_evaluation.doctree
Binary files differ
diff --git a/docs/m2met2/_build/doctrees/environment.pickle b/docs/m2met2/_build/doctrees/environment.pickle
index 6fa2888..3002d02 100644
--- a/docs/m2met2/_build/doctrees/environment.pickle
+++ b/docs/m2met2/_build/doctrees/environment.pickle
Binary files differ
diff --git a/docs/m2met2/_build/doctrees/index.doctree b/docs/m2met2/_build/doctrees/index.doctree
index f40d4fe..9469f3c 100644
--- a/docs/m2met2/_build/doctrees/index.doctree
+++ b/docs/m2met2/_build/doctrees/index.doctree
Binary files differ
diff --git a/docs/m2met2/_build/html/.buildinfo b/docs/m2met2/_build/html/.buildinfo
index 97d32c4..4ed53f5 100644
--- a/docs/m2met2/_build/html/.buildinfo
+++ b/docs/m2met2/_build/html/.buildinfo
@@ -1,4 +1,4 @@
 # Sphinx build info version 1
 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: a62852d90c3e533904d811bbf85f977d
+config: 160d25833895e2f6c62a4c315cacc3b9
 tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/docs/m2met2/_build/html/_images/qrcode.png b/docs/m2met2/_build/html/_images/qrcode.png
index fc4c349..d18d44a 100644
--- a/docs/m2met2/_build/html/_images/qrcode.png
+++ b/docs/m2met2/_build/html/_images/qrcode.png
Binary files differ
diff --git a/docs/m2met2/images/qrcode.png b/docs/m2met2/images/qrcode.png
index fc4c349..d18d44a 100644
--- a/docs/m2met2/images/qrcode.png
+++ b/docs/m2met2/images/qrcode.png
Binary files differ
diff --git a/docs/m2met2_cn/_build/doctrees/environment.pickle b/docs/m2met2_cn/_build/doctrees/environment.pickle
index 377374e..a65d613 100644
--- a/docs/m2met2_cn/_build/doctrees/environment.pickle
+++ b/docs/m2met2_cn/_build/doctrees/environment.pickle
Binary files differ
diff --git a/docs/m2met2_cn/_build/doctrees/index.doctree b/docs/m2met2_cn/_build/doctrees/index.doctree
index 1677b8b..43e1b34 100644
--- a/docs/m2met2_cn/_build/doctrees/index.doctree
+++ b/docs/m2met2_cn/_build/doctrees/index.doctree
Binary files differ
diff --git "a/docs/m2met2_cn/_build/doctrees/\345\237\272\347\272\277.doctree" "b/docs/m2met2_cn/_build/doctrees/\345\237\272\347\272\277.doctree"
index e31d3dd..aa459c1 100644
--- "a/docs/m2met2_cn/_build/doctrees/\345\237\272\347\272\277.doctree"
+++ "b/docs/m2met2_cn/_build/doctrees/\345\237\272\347\272\277.doctree"
Binary files differ
diff --git "a/docs/m2met2_cn/_build/doctrees/\346\225\260\346\215\256\351\233\206.doctree" "b/docs/m2met2_cn/_build/doctrees/\346\225\260\346\215\256\351\233\206.doctree"
index 5950ee3..2bc6bd7 100644
--- "a/docs/m2met2_cn/_build/doctrees/\346\225\260\346\215\256\351\233\206.doctree"
+++ "b/docs/m2met2_cn/_build/doctrees/\346\225\260\346\215\256\351\233\206.doctree"
Binary files differ
diff --git "a/docs/m2met2_cn/_build/doctrees/\347\256\200\344\273\213.doctree" "b/docs/m2met2_cn/_build/doctrees/\347\256\200\344\273\213.doctree"
index abe249d..6d6aab7 100644
--- "a/docs/m2met2_cn/_build/doctrees/\347\256\200\344\273\213.doctree"
+++ "b/docs/m2met2_cn/_build/doctrees/\347\256\200\344\273\213.doctree"
Binary files differ
diff --git "a/docs/m2met2_cn/_build/doctrees/\347\273\204\345\247\224\344\274\232.doctree" "b/docs/m2met2_cn/_build/doctrees/\347\273\204\345\247\224\344\274\232.doctree"
index 551248c..dbec226 100644
--- "a/docs/m2met2_cn/_build/doctrees/\347\273\204\345\247\224\344\274\232.doctree"
+++ "b/docs/m2met2_cn/_build/doctrees/\347\273\204\345\247\224\344\274\232.doctree"
Binary files differ
diff --git "a/docs/m2met2_cn/_build/doctrees/\350\201\224\347\263\273\346\226\271\345\274\217.doctree" "b/docs/m2met2_cn/_build/doctrees/\350\201\224\347\263\273\346\226\271\345\274\217.doctree"
index 6b8208a..dfdd79a 100644
--- "a/docs/m2met2_cn/_build/doctrees/\350\201\224\347\263\273\346\226\271\345\274\217.doctree"
+++ "b/docs/m2met2_cn/_build/doctrees/\350\201\224\347\263\273\346\226\271\345\274\217.doctree"
Binary files differ
diff --git "a/docs/m2met2_cn/_build/doctrees/\350\247\204\345\210\231.doctree" "b/docs/m2met2_cn/_build/doctrees/\350\247\204\345\210\231.doctree"
index 1cf759c..b74e39e 100644
--- "a/docs/m2met2_cn/_build/doctrees/\350\247\204\345\210\231.doctree"
+++ "b/docs/m2met2_cn/_build/doctrees/\350\247\204\345\210\231.doctree"
Binary files differ
diff --git "a/docs/m2met2_cn/_build/doctrees/\350\265\233\351\201\223\350\256\276\347\275\256\344\270\216\350\257\204\344\274\260.doctree" "b/docs/m2met2_cn/_build/doctrees/\350\265\233\351\201\223\350\256\276\347\275\256\344\270\216\350\257\204\344\274\260.doctree"
index c6be4ae..35e0a06 100644
--- "a/docs/m2met2_cn/_build/doctrees/\350\265\233\351\201\223\350\256\276\347\275\256\344\270\216\350\257\204\344\274\260.doctree"
+++ "b/docs/m2met2_cn/_build/doctrees/\350\265\233\351\201\223\350\256\276\347\275\256\344\270\216\350\257\204\344\274\260.doctree"
Binary files differ
diff --git a/docs/m2met2_cn/_build/html/.buildinfo b/docs/m2met2_cn/_build/html/.buildinfo
index 35632ee..43b8395 100644
--- a/docs/m2met2_cn/_build/html/.buildinfo
+++ b/docs/m2met2_cn/_build/html/.buildinfo
@@ -1,4 +1,4 @@
 # Sphinx build info version 1
 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: 06d9c1d4093817b45b9d4df7ab350eaf
+config: a4d4595bd4f85adbedc556dc23e6150a
 tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/docs/m2met2_cn/_build/html/_images/qrcode.png b/docs/m2met2_cn/_build/html/_images/qrcode.png
index fc4c349..d18d44a 100644
--- a/docs/m2met2_cn/_build/html/_images/qrcode.png
+++ b/docs/m2met2_cn/_build/html/_images/qrcode.png
Binary files differ
diff --git a/docs/m2met2_cn/images/qrcode.png b/docs/m2met2_cn/images/qrcode.png
index fc4c349..d18d44a 100644
--- a/docs/m2met2_cn/images/qrcode.png
+++ b/docs/m2met2_cn/images/qrcode.png
Binary files differ
diff --git a/egs/alimeeting/sa-asr/asr_local.sh b/egs/alimeeting/sa-asr/asr_local.sh
index 05599b7..30401b9 100755
--- a/egs/alimeeting/sa-asr/asr_local.sh
+++ b/egs/alimeeting/sa-asr/asr_local.sh
@@ -1153,10 +1153,10 @@
         mkdir -p ${sa_asr_exp}/log
         INIT_FILE=${sa_asr_exp}/ddp_init
         
-        if [ ! -f "exp/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/sv.pb" ]; then
+        if [ ! -f "exp/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/sv.pth" ]; then
             # download xvector extractor model file
             python local/download_xvector_model.py exp
-            log "Successfully download the pretrained xvector extractor to exp/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/sv.pb"
+            log "Successfully download the pretrained xvector extractor to exp/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/sv.pth"
         fi
         
         if [ -f $INIT_FILE ];then
@@ -1195,8 +1195,8 @@
                     --init_param "${asr_exp}/valid.acc.ave.pb:decoder.decoders.3:decoder.decoder4.2" \
                     --init_param "${asr_exp}/valid.acc.ave.pb:decoder.decoders.4:decoder.decoder4.3" \
                     --init_param "${asr_exp}/valid.acc.ave.pb:decoder.decoders.5:decoder.decoder4.4" \
-                    --init_param "exp/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/sv.pb:encoder:spk_encoder"   \
-                    --init_param "exp/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/sv.pb:decoder:spk_encoder:decoder.output_dense"   \
+                    --init_param "exp/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/sv.pth:encoder:spk_encoder"   \
+                    --init_param "exp/damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch/sv.pth:decoder:spk_encoder:decoder.output_dense"   \
                     --valid_data_path_and_name_and_type "${_asr_valid_dir}/${_scp},speech,${_type}" \
                     --valid_data_path_and_name_and_type "${_asr_valid_dir}/text,text,text" \
                     --valid_data_path_and_name_and_type "${_asr_valid_dir}/oracle_profile_nopadding.scp,profile,npy" \
diff --git a/egs/alimeeting/sa-asr/conf/train_asr_conformer.yaml b/egs/alimeeting/sa-asr/conf/train_asr_conformer.yaml
index 7865763..a8c9968 100644
--- a/egs/alimeeting/sa-asr/conf/train_asr_conformer.yaml
+++ b/egs/alimeeting/sa-asr/conf/train_asr_conformer.yaml
@@ -4,6 +4,7 @@
     n_fft: 400
     win_length: 400
     hop_length: 160
+    use_channel: 0
     
 # encoder related
 encoder: conformer
diff --git a/egs/alimeeting/sa-asr/conf/train_sa_asr_conformer.yaml b/egs/alimeeting/sa-asr/conf/train_sa_asr_conformer.yaml
index aa48b2d..612fd23 100644
--- a/egs/alimeeting/sa-asr/conf/train_sa_asr_conformer.yaml
+++ b/egs/alimeeting/sa-asr/conf/train_sa_asr_conformer.yaml
@@ -4,6 +4,7 @@
     n_fft: 400
     win_length: 400
     hop_length: 160
+    use_channel: 0
 
 # encoder related
 asr_encoder: conformer
diff --git a/funasr/bin/asr_infer.py b/funasr/bin/asr_infer.py
index 9da7ef7..760fd07 100644
--- a/funasr/bin/asr_infer.py
+++ b/funasr/bin/asr_infer.py
@@ -1510,8 +1510,13 @@
         if isinstance(speech, np.ndarray):
             speech = torch.tensor(speech)
         
-        feats = speech.unsqueeze(0).to(getattr(torch, self.dtype))
-        feats_lengths = feats.new_full([1], dtype=torch.long, fill_value=feats.size(1))
+        if self.frontend is not None:
+            speech = torch.unsqueeze(speech, axis=0)
+            speech_lengths = speech.new_full([1], dtype=torch.long, fill_value=speech.size(1))
+            feats, feats_lengths = self.frontend(speech, speech_lengths)
+        else:                
+            feats = speech.unsqueeze(0).to(getattr(torch, self.dtype))
+            feats_lengths = feats.new_full([1], dtype=torch.long, fill_value=feats.size(1))
         
         if self.asr_model.normalize is not None:
             feats, feats_lengths = self.asr_model.normalize(feats, feats_lengths)
@@ -1536,14 +1541,19 @@
         
         if isinstance(speech, np.ndarray):
             speech = torch.tensor(speech)
-        
-        feats = speech.unsqueeze(0).to(getattr(torch, self.dtype))
-        feats_lengths = feats.new_full([1], dtype=torch.long, fill_value=feats.size(1))
+
+        if self.frontend is not None:
+            speech = torch.unsqueeze(speech, axis=0)
+            speech_lengths = speech.new_full([1], dtype=torch.long, fill_value=speech.size(1))
+            feats, feats_lengths = self.frontend(speech, speech_lengths)
+        else:                
+            feats = speech.unsqueeze(0).to(getattr(torch, self.dtype))
+            feats_lengths = feats.new_full([1], dtype=torch.long, fill_value=feats.size(1))
         
         feats = to_device(feats, device=self.device)
         feats_lengths = to_device(feats_lengths, device=self.device)
         
-        enc_out, _ = self.asr_model.encoder(feats, feats_lengths)
+        enc_out, _, _ = self.asr_model.encoder(feats, feats_lengths)
         
         nbest_hyps = self.beam_search(enc_out[0])
         
diff --git a/funasr/bin/asr_train.py b/funasr/bin/asr_train.py
index fd973a4..8161e7b 100755
--- a/funasr/bin/asr_train.py
+++ b/funasr/bin/asr_train.py
@@ -46,7 +46,8 @@
     args = parse_args()
 
     # setup local gpu_id
-    os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu_id)
+    if args.ngpu > 0:
+        os.environ['CUDA_VISIBLE_DEVICES'] = str(args.gpu_id)
 
     # DDP settings
     if args.ngpu > 1:
@@ -57,9 +58,9 @@
 
     # re-compute batch size: when dataset type is small
     if args.dataset_type == "small":
-        if args.batch_size is not None:
+        if args.batch_size is not None and args.ngpu > 0:
             args.batch_size = args.batch_size * args.ngpu
-        if args.batch_bins is not None:
+        if args.batch_bins is not None and args.ngpu > 0:
             args.batch_bins = args.batch_bins * args.ngpu
 
     main(args=args)
diff --git a/funasr/tasks/abs_task.py b/funasr/tasks/abs_task.py
index fd4e190..0fb77a9 100644
--- a/funasr/tasks/abs_task.py
+++ b/funasr/tasks/abs_task.py
@@ -1376,25 +1376,10 @@
 
             # 7. Build iterator factories
             if args.dataset_type == "large":
-                from funasr.datasets.large_datasets.build_dataloader import ArkDataLoader
-                train_iter_factory = ArkDataLoader(args.train_data_file, args.token_list, args.dataset_conf,
-                                                   frontend_conf=args.frontend_conf if hasattr(args,
-                                                                                               "frontend_conf") else None,
-                                                   seg_dict_file=args.seg_dict_file if hasattr(args,
-                                                                                               "seg_dict_file") else None,
-                                                   punc_dict_file=args.punc_list if hasattr(args,
-                                                                                            "punc_list") else None,
-                                                   bpemodel_file=args.bpemodel if hasattr(args, "bpemodel") else None,
-                                                   mode="train")
-                valid_iter_factory = ArkDataLoader(args.valid_data_file, args.token_list, args.dataset_conf,
-                                                   frontend_conf=args.frontend_conf if hasattr(args,
-                                                                                               "frontend_conf") else None,
-                                                   seg_dict_file=args.seg_dict_file if hasattr(args,
-                                                                                               "seg_dict_file") else None,
-                                                   punc_dict_file=args.punc_list if hasattr(args,
-                                                                                            "punc_list") else None,
-                                                   bpemodel_file=args.bpemodel if hasattr(args, "bpemodel") else None,
-                                                   mode="eval")
+                from funasr.datasets.large_datasets.build_dataloader import LargeDataLoader
+                train_iter_factory = LargeDataLoader(args, mode="train")
+                valid_iter_factory = LargeDataLoader(args, mode="eval")
+
             elif args.dataset_type == "small":
                 train_iter_factory = cls.build_iter_factory(
                     args=args,
diff --git a/funasr/tasks/asr.py b/funasr/tasks/asr.py
index 8e4f9cc..8244856 100644
--- a/funasr/tasks/asr.py
+++ b/funasr/tasks/asr.py
@@ -363,12 +363,6 @@
             default=get_default_kwargs(CTC),
             help="The keyword arguments for CTC class.",
         )
-        group.add_argument(
-            "--joint_network_conf",
-            action=NestedDictAction,
-            default=None,
-            help="The keyword arguments for joint network class.",
-        )
 
         group = parser.add_argument_group(description="Preprocess related")
         group.add_argument(
@@ -1379,6 +1373,7 @@
     num_optimizers: int = 1
 
     class_choices_list = [
+        model_choices,
         frontend_choices,
         specaug_choices,
         normalize_choices,
@@ -1476,7 +1471,7 @@
         try:
             model_class = model_choices.get_class(args.model)
         except AttributeError:
-            model_class = model_choices.get_class("asr")
+            model_class = model_choices.get_class("rnnt_unified")
 
         model = model_class(
             vocab_size=vocab_size,

--
Gitblit v1.9.1