-
Notifications
You must be signed in to change notification settings - Fork 610
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 support for masked input in TrainingSampler #546
Add support for masked input in TrainingSampler #546
Conversation
Update from upstream
Update from head
Update from master
@seanpmorgan Could you please force run the CI tests on this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@qlzh727 should also validate before merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. The major change I would like is to raise error if both sequence length and masking are provided.
It will throw an error if both sequence_length and mask are provided.
@qlzh727 Did you have a chance to take a look at the new commits? |
@qlzh727 @guillaumekln Thank you very much for your feedbacks. |
Thank you for these improvements. Looking forward to the seq2seq tutorial! |
By applying this patch,
TrainingSampler
will be able to support bothmask
andsequnce_length
arguments. Butsequnce_length
will have higher priority. So if both are provided, themask
argument will be ignored. I had to add this priority because Keras implicitly passes the mask information to layers upon the invocation (even in model sub-classing). Without this priority, the user will face an error by using the following snippet (due to the automatically passed mask argument):To overcome this issue, the user had to manually delete the
_keras_mask
attribute from thesome_masked_input
variable.( e.g.delattr(some_masked_input, '_keras_mask')
) to be able to apply thesequence_length
parameter only.It Fixes (#534) by adding support for masked inputs. Also, this will bring better Keras integration.
Fixes #534