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

[WIP] The Missing Ingredient in Zero-Shot Neural Machine Translation #1714

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

francoishernandez
Copy link
Member

This PR intends to add an implementation of the cosine similarity alignment loss introduced as a regularization term in The Missing Ingredient in Zero-Shot Neural Machine Translation.

onmt/utils/loss.py Outdated Show resolved Hide resolved
onmt/trainer.py Show resolved Hide resolved
@francoishernandez
Copy link
Member Author

francoishernandez commented Feb 7, 2020

Note:
Impact on speed is quite significant: as we need to reduce batches to make place in memory for the additional representations, we can loose up to 20-25% in training speed, both in FP32 and FP16 modes.

@vince62s
Copy link
Member

For the record, we discussed offline if this should be in the code of NMTModel or Trainer.
For performance reason it needs to be in NMTModel (encoding through forward of src and tgt), but it makes the API a little less "clear". We opted for performance, but we kept the API intact when this new loss is not used.

onmt/trainer.py Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

3 participants