| | |
| | | from funasr.utils.load_utils import load_audio_text_image_video,extract_fbank |
| | | from funasr.utils.datadir_writer import DatadirWriter |
| | | from torch.nn.utils.rnn import pad_sequence |
| | | from funasr.train_utils.device_funcs import to_device |
| | | |
| | | class VadStateMachine(Enum): |
| | | kVadInStateStartPointNotDetected = 1 |
| | |
| | | meta_data[ |
| | | "batch_data_time"] = speech_lengths.sum().item() * frontend.frame_shift * frontend.lfr_n / 1000 |
| | | |
| | | speech.to(device=kwargs["device"]), speech_lengths.to(device=kwargs["device"]) |
| | | speech = speech.to(device=kwargs["device"]) |
| | | speech_lengths = speech_lengths.to(device=kwargs["device"]) |
| | | |
| | | # b. Forward Encoder streaming |
| | | t_offset = 0 |
| | |
| | | "cache": cache |
| | | } |
| | | |
| | | |
| | | |
| | | batch = to_device(batch, device=kwargs["device"]) |
| | | segments_part, cache = self.forward(**batch) |
| | | if segments_part: |
| | | for batch_num in range(0, batch_size): |