ai-forever / ai-forever/ner-bert

RuntimeError: Expected tensor [2, 512, 1], src [2, 371, 6] and index [2, 512, 1] to have the same size apart from dimension 2

未关闭
#29 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
407
派生
100
PR 合并指标
30 天内没有已合并 PR

描述

I use my own dataseta, and in the training process of CRF, the following error occurs:

```
line 483, in main
global_step, tr_loss = train(args, train_dataset, model, tokenizer, labels,pos, pad_token_label_id)

line 138, in train
loss = model.score(batch) # model outputs are always tuple in pytorch-transformers (see doc)

line 52, in score
return self.crf.score(output, labels_mask, labels)

line 46, in score
gold_score = self.crf.calc_gold_score(logits, labels, lens)

line 99, in calc_gold_score
unary_score = self.calc_unary_score(logits, labels, lens).sum(

line 93, in calc_unary_score
scores = torch.gather(logits, 2, labels_exp).squeeze(-1)

RuntimeError: Expected tensor [2, 512, 1], src [2, 371, 6] and index [2, 512, 1] to have the same size apart from dimension 2
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。