语帆
2024-02-28 2bffe1d5392b291c071cde0ffcc03860abdfc230
test
3个文件已修改
17 ■■■■ 已修改文件
examples/industrial_data_pretraining/lcbnet/demo2.sh 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/models/lcbnet/model.py 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
funasr/utils/load_utils.py 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
examples/industrial_data_pretraining/lcbnet/demo2.sh
@@ -6,7 +6,6 @@
--config-name="config.yaml" \
++init_param=${file_dir}/model.pb \
++tokenizer_conf.token_list=${file_dir}/tokens.txt \
++frontend_conf.cmvn_file=${file_dir}/am.mvn \
++input=[${file_dir}/wav.scp,${file_dir}/ocr_text] \
+data_type='["kaldi_ark", "text"]' \
++tokenizer_conf.bpemodel=${file_dir}/bpe.model \
funasr/models/lcbnet/model.py
@@ -21,6 +21,7 @@
from funasr.utils import postprocess_utils
from funasr.utils.datadir_writer import DatadirWriter
from funasr.register import tables
import pdb
@tables.register("model_classes", "LCBNet")
class LCBNet(nn.Module):
@@ -91,6 +92,7 @@
        fusion_encoder = fusion_encoder_class(**fusion_encoder_conf)
        bias_predictor_class = tables.encoder_classes.get(bias_predictor)
        bias_predictor = bias_predictor_class(**bias_predictor_conf)
        if decoder is not None:
            decoder_class = tables.decoder_classes.get(decoder)
@@ -272,15 +274,15 @@
                ind: int
        """
        with autocast(False):
            pdb.set_trace()
            # Data augmentation
            if self.specaug is not None and self.training:
                speech, speech_lengths = self.specaug(speech, speech_lengths)
            pdb.set_trace()
            # Normalization for feature: e.g. Global-CMVN, Utterance-CMVN
            if self.normalize is not None:
                speech, speech_lengths = self.normalize(speech, speech_lengths)
        pdb.set_trace()
        # Forward encoder
        # feats: (Batch, Length, Dim)
        # -> encoder_out: (Batch, Length2, Dim2)
@@ -297,7 +299,7 @@
        
        if intermediate_outs is not None:
            return (encoder_out, intermediate_outs), encoder_out_lens
        pdb.set_trace()
        return encoder_out, encoder_out_lens
    
    def _calc_att_loss(
@@ -442,6 +444,7 @@
        speech = speech.to(device=kwargs["device"])
        speech_lengths = speech_lengths.to(device=kwargs["device"])
        pdb.set_trace()
        # Encoder
        encoder_out, encoder_out_lens = self.encode(speech, speech_lengths)
        if isinstance(encoder_out, tuple):
funasr/utils/load_utils.py
@@ -108,10 +108,7 @@
            data_list.append(data_i)
            data_len.append(data_i.shape[0])
        data = pad_sequence(data_list, batch_first=True) # data: [batch, N]
    # import pdb;
    # pdb.set_trace()
    # if data_type == "sound":
    pdb.set_trace()
    data, data_len = frontend(data, data_len, **kwargs)
    
    if isinstance(data_len, (list, tuple)):