[英]Hugging Face - PyTorch RuntimeError : nll_loss_forward_reduce_cuda_kernel_2d_index not implemented for Int
I attempted to fine-tune the Wav2vec2
model for an audio classification task by following the tutorial at https://huggingface.co/docs/transformers/tasks/audio_classification and copying and pasting the code provided.我试图通过遵循https://huggingface.co/docs/transformers/tasks/audio_classification上的教程并复制和粘贴所提供的代码来为音频分类任务微调
Wav2vec2
model。
However, when I trained the model, I encountered the following error:但是,我在训练model的时候遇到了如下错误:
nll_loss_forward_reduce_cuda_kernel_2d_index not implemented for Int.
I believe the problem may lie with PyTorch
.我相信问题可能在于
PyTorch
。 It seems to be working on Ubuntu WSL 22.04
, but not on Powershell
.它似乎适用于
Ubuntu WSL 22.04
,但不适用于Powershell
。
My system specifications include:我的系统规格包括:
- Powershell
- datasets 2.8.0
- transformers 4.25.1
- torch 1.13.1+cu117
- torchaudio 0.13.1+cu117
- torchvision 0.14.1+cu117
How can I resolve this issue?我该如何解决这个问题?
Convert your target dtype to torch.int64
.将您的目标 dtype 转换为
torch.int64
。
I received the same error when my target dtype was torch.int32
.当我的目标 dtype 是
torch.int32
时,我收到了同样的错误。 I resolved the issue by adding the following line to my code:我通过在我的代码中添加以下行解决了这个问题:
target = target.to(torch.int64)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.