fastNLP icon indicating copy to clipboard operation
fastNLP copied to clipboard

StaticEmbedding 中的 dropout 问题

Open XieDelong opened this issue 2 years ago • 1 comments

在 StaticEmbedding forward 方法中, words = self.drop_word(words) words = self.embedding(words) words = self.dropout(words)

drop_word 函数有 self.training 的判断,但是 dropout 没有,导致在推断的时候,同样的 query 预测结果不一致问题

XieDelong avatar May 24 '22 03:05 XieDelong

由于 self.dropout 是nn.Dropout,它本身是受到module的training状态管控的,所以如果调用了 StaticEmbedding.eval() 的话,这个 dropout 就是自动关闭的了。

yhcc avatar May 24 '22 05:05 yhcc