The dtype of attention mask (torch.int64) is not bool
时间: 2024-01-21 10:18:45 浏览: 194
关于pytorch中部分矩阵乘法的总结(torch.mm,torch.mul,torch.matmul)
This error message indicates that the data type of the attention mask tensor is `torch.int64`, but it should be `bool`.
To fix this, you can convert the tensor to the correct data type using the `.bool()` method. For example, if your attention mask tensor is called `attention_mask`, you can convert it to `bool` by doing:
```
attention_mask = attention_mask.bool()
```
After this conversion, your attention mask tensor should have the correct data type and the error should be resolved.
阅读全文