sberdevices/golos

Error at `infer_beam_search_lm`

IvanAntipov opened this issue · 1 comments

I managed to get transcriptions from infer_greedy method

....
[NeMo I 2021-06-27 18:07:19 modelPT:434] Model EncDecCTCModel was successfully restored from ./models/QuartzNet15x5_golos.nemo.
Transcribing:   0%|                                                                                                                       | 0/1 [00:00<?, ?it/s]
[NeMo W 2021-06-27 18:07:24 patch_utils:49] torch.stft() signature has been updated for PyTorch 1.7+
    Please update PyTorch to remain compatible with later versions of NeMo.
[NeMo W 2021-06-27 18:07:24 nemo_logging:349] /opt/conda/lib/python3.8/site-packages/torch/_tensor.py:575: UserWarning: floor_divide is deprecated, and will be
removed in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative va
lues.
    To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor'). (Trigger
ed internally at  /pytorch/aten/src/ATen/native/BinaryOps.cpp:467.)
      return torch.floor_divide(self, other)

Transcribing: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:05<00:00,  5.53s/it]
 h
 h добрый день ну гавайдетеы ухотелинетеетадано ....
Greedy WER: 0.7927927927927928

But, an exception occurred on infer_beam_search_lm

Transcribing: 100%|███████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:06<00:00,  6.31s/it]
Traceback (most recent call last):
  File "./examples/infer.py", line 68, in <module>
    hyps = infer_beam_search_lm(files, asr_model, beam_search_lm)
  File "./examples/infer.py", line 22, in infer_beam_search_lm
    logits_tensor = torch.nn.utils.rnn.pad_sequence(logits, batch_first=True)
  File "/opt/conda/lib/python3.8/site-packages/torch/nn/utils/rnn.py", line 363, in pad_sequence
    return torch._C._nn.pad_sequence(sequences, batch_first, padding_value)
TypeError: expected Tensor as element 0 in argument 0, but got numpy.ndarray

Fixed by #4