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

Better buffering, readability in beam_search; random sampling class #1281

Merged
merged 5 commits into from
Feb 11, 2019

Conversation

flauted
Copy link
Contributor

@flauted flauted commented Feb 9, 2019

I've made .view calls more literate. By that I mean avoiding -1's and avoiding referencing the original tensor for dimensions in favor of using hopefully well-named variables. I've tried to make some of the instance attribute uses more readable, too. IMO when dealing with stateful instance attribute tensors, using a buffer/out approach is more readable. So that's what I've done. I'm seeing the same scores, speed (non-significant difference, anyways), and memory usage.

Also, #1277 broke return_attention when not using a coverage penalty. This fixes it, and unit tests it.

@vince62s vince62s requested a review from guillaumekln February 9, 2019 20:27
@flauted flauted changed the title Better buffering, readability in beam_search Better buffering, readability in beam_search; random sampling class Feb 11, 2019
@flauted
Copy link
Contributor Author

flauted commented Feb 11, 2019

This now also adds a DecodeStrategy class and a RandomSampling class. BeamSearch and RandomSampling inherit DecodeStrategy. Since the bug with coverage penalty is fixed, this also removes coverage penalty being None => old decode path.

Copy link
Contributor

@guillaumekln guillaumekln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very useful, thanks! It's a big diff so it's difficult to review in details, but I did not find major issues.

Looking forward to the unified decoding loop. :)

@vince62s
Copy link
Member

okay trusting you guys ...merging.

@vince62s vince62s merged commit e2799c6 into OpenNMT:master Feb 11, 2019
ItaySofer pushed a commit to ItaySofer/OpenNMT-py that referenced this pull request Mar 17, 2019
…penNMT#1281)

* Better buffering, readability, possible bug fix for return_attention
* Update docs.
* Test with return attention.
* Update docs, translation device selection, refactor translation strategies.
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