| | |
| | | # using dummy inputs for a example |
| | | if self.audio_in is not None: |
| | | feats, feats_len = self.load_feats(self.audio_in) |
| | | for feat, len in zip(feats, feats_len): |
| | | m(feat, len) |
| | | for i, (feat, len) in enumerate(zip(feats, feats_len)): |
| | | with torch.no_grad(): |
| | | m(feat, len) |
| | | else: |
| | | dummy_input = model.get_dummy_inputs() |
| | | m(*dummy_input) |
| | |
| | | feats = [] |
| | | feats_len = [] |
| | | for line in wav_list: |
| | | name, path = line.strip().split() |
| | | path = line.strip() |
| | | waveform, sampling_rate = torchaudio.load(path) |
| | | if sampling_rate != self.frontend.fs: |
| | | waveform = torchaudio.transforms.Resample(orig_freq=sampling_rate, |
| | |
| | | model, asr_train_args = ASRTask.build_model_from_file( |
| | | asr_train_config, asr_model_file, cmvn_file, 'cpu' |
| | | ) |
| | | self.frontend = model.frontend |
| | | self._export(model, tag_name) |
| | | |
| | | |