-
Notifications
You must be signed in to change notification settings - Fork 150
Open
Labels
Description
Bug description
The clm
masking for last item only do not mask last item in input.
It will cause using the embedding of the label instead of mask.
I think following code needs to be fixed.
mask_labels = item_ids != self.padding_idx |
Steps/Code to reproduce bug
import torch
from transformers4rec.torch import masking
item_ids = torch.tensor([[1, 2, 0], ])
mask = masking.CausalLanguageModeling(hidden_size=10, train_on_last_item_seq_only=True)
masking_info = mask.compute_masked_targets(item_ids, training=True)
print(masking_info)
MaskingInfo(schema=tensor([[ True, True, False]]), targets=tensor([[2, 0, 0]]))
Expected behavior
MaskingInfo(schema=tensor([[ True, False, False]]), targets=tensor([[2, 0, 0]]))
Environment details
- Transformers4Rec version: 23.08.00