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

same sentence different padding length result different embedding because softmax precision #1326

Open
JJplane opened this issue May 21, 2021 · 0 comments

Comments

@JJplane
Copy link

JJplane commented May 21, 2021

I use nn.Softmax(dim=-1) to softmax. I find different outputs.


a = [-3.6180e-01,  6.6926e-01,  1.2248e+01, -9.5795e-01]
b = [-3.6180e-01,  6.6926e-01,  1.2248e+01, -9.5795e-01, -9.5795e-01]

softmax(a) = [3.3403e-06, 9.3662e-06, 9.9999e-01, 1.8402e-06]
softmax(b) =[3.3403e-06, 9.3661e-06, 9.9998e-01, 1.8402e-06, 1.8402e-06]
The different softmax results result in different sentence embedding, sometimes the embedding differ a lot.I test transeformers the question cant repoduce. This bug appears in transformers modified by our company. Any help is appreciate!

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

1 participant