-
Notifications
You must be signed in to change notification settings - Fork 147
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
[BUG] CausalLanguageModeling do not mask last input item #765
Labels
Comments
I think this line of code need to be removed:
As solution just use the mask_label from predict_all() above.
And I think the reason why current code somehow works is because of this part: Transformers4Rec/transformers4rec/torch/masking.py Lines 318 to 337 in d0cce61
Given input sequence without padding [1,2,3] , the mask schema generated by current code during evaluation will be [True, True, True] , which exposes the last item. However the apply_mask_to_inputs will replace the last item with 0 embedding. And since the schema are all True, no mask embedding will be applied on input. I think in this case 0 embedding sort of plays a role as mask.However, when input has padding like [1,2,3,0,0] , the current mask schema will be [True, True, True, False, False] . And because the last item is a padding item, the apply_mask_to_inputs basically replaces the padding with 0 embedding. Then the mask schema comes in, masks the last 2 padding items, keeping the 1,2,3 visible to transformer.I think thats why people encounter issues testing clm. If there are always paddings in input data, the evaluation metrics would be unrealistically high. |
I also noticed this bug as well. After the fix, the recall is down about 20% less |
Any further updates? It seems #723 still not solve this bug. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Transformers4Rec/transformers4rec/torch/masking.py
Line 298 in 348c963
Steps/Code to reproduce bug
Expected behavior
Environment details
Additional context
The text was updated successfully, but these errors were encountered: