Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
KunWangR opened this issue Jan 14, 2020 · 4 comments
Open

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

KunWangR opened this issue Jan 14, 2020 · 4 comments

Comments

@KunWangR
Copy link

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

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

@NLPOR
Copy link

NLPOR commented Jan 14, 2020 via email

@KunWangR
Copy link
Author

@NLPOR 聪哥是谁?

@YC-wind
Copy link
Owner

YC-wind commented Jan 14, 2020

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

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

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

@YC-wind
Copy link
Owner

YC-wind commented Jan 14, 2020

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),实际写错了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants