When calling
model = torchaudio.pipelines.WAV2VEC2_ASR_BASE_960H.get_model()
emission = model(data)
This is to get the emission probabilities from the model.
but I get
File "XXX\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "XXX\lib\site-packages\torchaudio\models\wav2vec2\model.py", line 119, in forward
x, lengths = self.feature_extractor(waveforms, lengths)
File "XXX\lib\site-packages\torch\nn\modules\module.py", line 1190, in _call_impl
return forward_call(*input, **kwargs)
File "XXX\lib\site-packages\torchaudio\models\wav2vec2\components.py", line 135, in forward
raise ValueError("Expected the input Tensor to be 2D (batch, time), " "but received {list(x.shape)}")
ValueError: Expected the input Tensor to be 2D (batch, time), but received {list(x.shape)}
what is the shape of
data
?It's probably you are feeding 1D tensor. The shape of the tensor has to be (batch, time).