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

Fix dtype mismatch in CLM masking class due to new data loader changes #539

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion transformers4rec/torch/masking.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ def _compute_masked_targets(self, item_ids: torch.Tensor, training=False) -> Mas
labels.size(0), dtype=torch.long, device=item_ids.device # type: ignore
)
last_item_sessions = mask_labels.sum(dim=1) - 1
label_seq_trg_eval = torch.zeros(labels.shape, dtype=torch.long, device=item_ids.device)
label_seq_trg_eval = torch.zeros(
labels.shape, dtype=labels.dtype, device=item_ids.device
)
label_seq_trg_eval[rows_ids, last_item_sessions] = labels[rows_ids, last_item_sessions]
# Updating labels and mask
labels = label_seq_trg_eval
Expand Down