语帆
2024-02-28 52fee96d71ba96fd09ad453dbae1926a1d601a56
funasr/models/lcbnet/model.py
@@ -274,15 +274,12 @@
                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)
@@ -426,7 +423,6 @@
        else:
            # extract fbank feats
            time1 = time.perf_counter()
            pdb.set_trace()
            sample_list = load_audio_text_image_video(data_in, fs=frontend.fs, audio_fs=kwargs.get("fs", 16000),
                                                            data_type=kwargs.get("data_type", "sound"),
                                                            tokenizer=tokenizer)
@@ -434,13 +430,12 @@
            meta_data["load_data"] = f"{time2 - time1:0.3f}"
            audio_sample_list = sample_list[0]
            ocr_sample_list = sample_list[1]
            pdb.set_trace()
            speech, speech_lengths = extract_fbank(audio_sample_list, data_type=kwargs.get("data_type", "sound"),
                                                   frontend=frontend)
            pdb.set_trace()
            time3 = time.perf_counter()
            meta_data["extract_feat"] = f"{time3 - time2:0.3f}"
            meta_data["batch_data_time"] = speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000
            frame_shift = 10
            meta_data["batch_data_time"] = speech_lengths.sum().item() * frame_shift / 1000
        speech = speech.to(device=kwargs["device"])
        speech_lengths = speech_lengths.to(device=kwargs["device"])