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
Add concatenative feature embeddings #147
Conversation
Great. This looks really good to me. Also, I am moving this code around a bit in the |
Also are we sure that |
I'm not totally sure if the sum is the same; I looked in the lua and couldn't figure it out. But at the very least, the result is of the same dimension as the word_vec_size, which is what should happen in the |
Here is the Lua code: https://github.com/OpenNMT/OpenNMT/blob/master/onmt/modules/FeaturesEmbedding.lua#L25 It just adds the embeddings, nothing more. |
Thanks. I interpreted what was going on primarily based on the documentation here: http://opennmt.net/OpenNMT/options/train/#sequence-to-sequence-with-attention-options The documentation seems to be in error with respect to I'll get cracking on fixing this soon. |
Added producer-consumer pattern to MTurk polling
This pull request adds support for concatenation of word and feature embeddings. Namely, if you have an x-dimension word embedding and a y-dimensional feature embedding, then these will be concatenated into an (x+y)-dimensional embedding for the encoder. This is the default setting for using features in Lua.
I believe the previous behavior of the embeddings class corresponds to the sum behavior, so I preserved it with the sum option.
The goal is for the interface to be the same is in Lua OpenNMT. Consequently, the command line interface has been changed slightly to match Lua.
-feat_merge
accepts concat and sum; the default is concat-feat_vec_exponent
defaults to 0.7; it is used to compute size of feature embeddings when using concat-feature_vec_size
is now-feat_vec_size
and its default is 20While I was at it, I changed the implementation of
make_positional_encodings()
to one with vectorized tensor operations instead of for loops and the built-in math class. It is faster now.