简体   繁体   English

ValueError 从 Wav2Vec2 获取发射 PyTorch 管道 Model

[英]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.

相关问题 为多个(分类)任务训练 wav2vec2 - Training wav2vec2 for multiple (classification) tasks “SpeechToText”使用 huggingface 预训练模型但结果不同 =>Wav2Vec2 与其他 - "SpeechToText" Using huggingface pretrained models but different results =>Wav2Vec2 vs other Wav2Vec pytorch 张量的元素 0 不需要 grad 并且没有 grad_fn - Wav2Vec pytorch element 0 of tensors does not require grad and does not have a grad_fn 从 Pytorch 中的序列化模型获取 state_dict 时出错 - Error getting state_dict from a serialized model in Pytorch 将 word2vec 嵌入传递给自定义 LSTM pytorch model - Passing word2vec embedding to a custom LSTM pytorch model 将模型从 pytorch 转换为 ONNX 后得到不同的结果 - Getting different results after converting a model to from pytorch to ONNX PyTorch:将预训练的 model 从 3 个 RGB 通道更改为 4 个通道后,“ValueError:无法优化非叶张量” - PyTorch: “ValueError: can't optimize a non-leaf Tensor” after changing pretrained model from 3 RGB Channels to 4 Channels 从变压器加载 model 时出现“无法从 pytorch 检查点文件加载权重” - Getting "Unable to load weights from pytorch checkpoint file" when loading model from transformers 为什么来自 FairSeq 的 VQ-Wav2Vec 的 output 缺少帧? - Why does the output from VQ-Wav2Vec from FairSeq missing frames? pytorch从gpu中删除模型 - pytorch delete model from gpu
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM