我正在尝试使用预训练的BERT模型进行文本分类。我在我的数据集上训练了模型,并在测试阶段;我知道BERT只能接受512个令牌,所以我编写了if条件来检查我的数据帧中测试的长度。序列的长度是512,但是在执行tokenize编码之后,长度变成了707,我得到了这个错误。The size of tensor a (707) must match the size of tensor b (512) at non-singleton dim
我正在训练一个CNN模型。我在为我的模型进行训练迭代时遇到了问题。当我使用MSE损失函数和Adam优化器时,我会遇到以下错误:
RuntimeError: The size of tensor a (133) must match the size of tensor b(10) at non-singleton d
我正在执行以下操作: energy.masked_fill(mask == 0, float("-1e20")) 我的蟒蛇痕迹在下面, File "/usr/local/lib/python3.6"))
RuntimeError: The size of tensor a (1024) must match the size of tensor b (512) at non-singletondimension 3 这些是我的注意力层