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

[TASK] Implement PredictMasked (BERT-like masking) #692

Closed
marcromeyn opened this issue Aug 30, 2022 · 0 comments · Fixed by #780
Closed

[TASK] Implement PredictMasked (BERT-like masking) #692

marcromeyn opened this issue Aug 30, 2022 · 0 comments · Fixed by #780
Assignees
Milestone

Comments

@marcromeyn
Copy link
Contributor

marcromeyn commented Aug 30, 2022

BERT-like masking

Let’s say we have a sequence ABCDE, BERT-like masking would result in the following:

Inputs A MASKED C MASKED E
Targets MASKED B MASKED D MASKED

Note, the number of target items might differ for different samples in the batch. We should ensure that we have at least one target and at most len(seq) - 1

The class that’s responsible for masking could roughly look like:

class PredictMasked(DataAugmentation):
	def __init__(
		self, 
		schema: Schema
		target: Union[str, Tag, ColSchema],
		prediction_block=None,
		mask_selection_rate,
		mask_selection_length,
		unselectable_token_ids=[0],
		mask_token_rate=0.8,
		random_token_rate=0.1
	):
		...

	def compute_mask(self, ...):
		...

We want to make use of standard Keras functionality w.r.t. masking. Some useful links:

@marcromeyn marcromeyn transferred this issue from NVIDIA-Merlin/Merlin Aug 30, 2022
@marcromeyn marcromeyn changed the title Implement PredictMasked [TASK] Implement PredictMasked Aug 30, 2022
@marcromeyn marcromeyn changed the title [TASK] Implement PredictMasked [TASK] Implement PredictMasked (BERT-like masking) Aug 30, 2022
@marcromeyn marcromeyn added this to the Merlin 22.09 milestone Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment