920232796 / bert_seq2seq

pytorch实现 Bert 做seq2seq任务,使用unilm方案,现在也可以做自动摘要,文本分类,情感分析,NER,词性标注等任务,支持t5模型,支持GPT2进行文章续写。
Apache License 2.0
1.28k stars 208 forks source link

beam search issue #40

Closed chenhaoenen closed 3 years ago

chenhaoenen commented 3 years ago

您好,大佬,首先非常感谢您的项目,我有个问题,请教下: 在beam search中,如果是batch输入的话, logit_score = torch.log_softmax(scores, dim=-1)[:, -1] --> 不理解为什么会取最后一个的分数,按我的理解每个batch_size的文本长度应该是不一样的吧

这个时候该如何迭代生成最终结果呢?

920232796 commented 3 years ago

测试的时候,只能一个一个预测。