facebookresearch / MUSE

A library for Multilingual Unsupervised or Supervised word Embeddings
Other
3.18k stars 552 forks source link

Fixed the problem of index out of range when n_src<i<max_rank #84

Closed Justin1904 closed 5 years ago

Justin1904 commented 5 years ago

Fixing a problem encountered here at #76

The problem that led to #76 is that when using methods other than invsm, the code re-assigns n_src with params.dico_max_rank here. Yet params.dico_max_rank can potentially be larger than the original n_src. This will lead to later indexing into an empty slice once n_src < i < params.dico_max_rank and trying to transpose it (here), causing the error eventually.

facebook-github-bot commented 5 years ago

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

facebook-github-bot commented 5 years ago

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

glample commented 5 years ago

Hi, this looks good to me. Thanks for the PR!