| | |
| | | self.waveform = None |
| | | self.last_drop_frames = 0 |
| | | |
| | | |
| | | @tables.register("model_classes", "FsmnVADStreaming") |
| | | class FsmnVADStreaming(nn.Module): |
| | | """ |
| | |
| | | # # reset class variables and clear the dict for the next query |
| | | # self.AllResetDetection() |
| | | return segments |
| | | |
| | | |
| | | def init_cache(self, cache: dict = {}, **kwargs): |
| | | |
| | | cache["frontend"] = {} |
| | | cache["prev_samples"] = torch.empty(0) |
| | | cache["encoder"] = {} |
| | |
| | | cache: dict = {}, |
| | | **kwargs, |
| | | ): |
| | | |
| | | |
| | | if len(cache) == 0: |
| | | self.init_cache(cache, **kwargs) |
| | | |
| | |
| | | |
| | | cache["prev_samples"] = audio_sample[:-m] |
| | | if _is_final: |
| | | cache = {} |
| | | self.init_cache(cache) |
| | | |
| | | ibest_writer = None |
| | | if ibest_writer is None and kwargs.get("output_dir") is not None: |