Przeglądaj źródła

fix paraformer finetune bug

北念 2 lat temu
rodzic
commit
d90de51e76
1 zmienionych plików z 5 dodań i 2 usunięć
  1. 5 2
      funasr/bin/build_trainer.py

+ 5 - 2
funasr/bin/build_trainer.py

@@ -548,7 +548,10 @@ def build_trainer(modelscope_dict,
     init_param = modelscope_dict['init_model']
     cmvn_file = modelscope_dict['cmvn_file']
     seg_dict_file = modelscope_dict['seg_dict']
-    bpemodel = modelscope_dict['bpemodel']
+    if 'bpemodel' in modelscope_dict:
+        bpemodel = modelscope_dict['bpemodel']
+    else:
+        bpemodel = None
 
     # overwrite parameters
     with open(config) as f:
@@ -582,7 +585,7 @@ def build_trainer(modelscope_dict,
         args.seg_dict_file = seg_dict_file
     else:
         args.seg_dict_file = None
-    if os.path.exists(bpemodel):
+    if bpemodel is not None and os.path.exists(bpemodel):
         args.bpemodel = bpemodel
     else:
         args.bpemodel = None