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

Masks in Meter.update() #143

Open
and-tos opened this issue Apr 23, 2021 · 1 comment
Open

Masks in Meter.update() #143

and-tos opened this issue Apr 23, 2021 · 1 comment

Comments

@and-tos
Copy link

and-tos commented Apr 23, 2021

Hi,
I'm trying to use masks for multi task learning.
The documentation in eval.py about the use of masks is not clear to me.

mask : None or float32 tensor
            Binary mask indicating the existence of ground truth labels with
            shape ``(B, T)``. If None, we assume that all labels exist and create
            a one-tensor for placeholder.

If a mask is set to 1 it could mean that a) the label will be masked or b) the label is present. Which one is it?

If label = [5, None, None],
should I set mask = [1,0,0] or [0,1,1]

What's the convention if I wanted to exclude the "None" labels from the loss calculation?

Thanks a lot for clarifying!

@mufeili
Copy link
Contributor

mufeili commented Apr 26, 2021

1 indicates the existence of a label. In your example, it will be [1, 0, 0]. For loss computation, we can multiply the prediction by the mask so that we will only update the model based on existing labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants