[英]ValueError Getting Emission from Wav2Vec2 PyTorch Pipeline Model
When calling打电话时
model = torchaudio.pipelines.WAV2VEC2_ASR_BASE_960H.get_model()
emission = model(data)
This is to get the emission probabilities from the model.这是为了从 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
? data
的形状是什么?
It's probably you are feeding 1D tensor.可能是您正在输入一维张量。 The shape of the tensor has to be (batch, time).
张量的形状必须是(批次,时间)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.