YC-wind / embedding_study

中文预训练模型生成字向量学习,测试BERT,ELMO的中文效果
97 stars 27 forks source link

ELMO代码中的疑问,希望解答 #7

Open KunWangR opened 4 years ago

KunWangR commented 4 years ago

感觉ELMO模型accuracy计算有点问题,详细情况见下图。 image

因为计算loss需要用到forward_output, 计算forward_pred需要用到forward_projection,因为argsoftmax需要从词表维度中选择最可能的词id,代码中是从elmo_hidden维度选择最可能的hidden id。

NLPOR commented 4 years ago

给聪哥大佬疯狂打call

------------------ 原始邮件 ------------------ 发件人: "KunWangR"<notifications@github.com>; 发送时间: 2020年1月14日(星期二) 下午4:43 收件人: "YC-wind/embedding_study"<embedding_study@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [YC-wind/embedding_study] ELMO代码中的疑问,希望解答 (#7)

感觉ELMO模型accuracy计算有点问题,详细情况见下图。

因为计算loss需要用到forward_output, 计算forward_pred需要用到forward_projection,因为argsoftmax需要从词表维度中选择最可能的词id,代码中是从elmo_hidden维度选择最可能的hidden id。

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

KunWangR commented 4 years ago

@NLPOR 聪哥是谁?

YC-wind commented 4 years ago

感觉ELMO模型accuracy计算有点问题,详细情况见下图。 image

因为计算loss需要用到forward_output, 计算forward_pred需要用到forward_projection,因为argsoftmax需要从词表维度中选择最可能的词id,代码中是从elmo_hidden维度选择最可能的hidden id。

好像是耶,有点问题,loss应该是没问题,就是 acc计算 会有错误,不正常

YC-wind commented 4 years ago

forward_output 是 shape = (batch_size, seq_len, elmo_hidden) forward_projection 是 shape = (batch_size, seq_len, word_vocab_size) 因此需要使用 forward_projection 谢谢(代码能跑通纯属 word_vocab_size > elmo_hidden),实际写错了