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

Returning outputs only when asked for for MaskFormer. #15936

Merged

Conversation

Narsil
Copy link
Contributor

@Narsil Narsil commented Mar 4, 2022

What does this PR do?

Change the return output from () to None which seems more aligned with
the rest of the library.

Also auxiliary_logits seem optional and don't seem to be used by the feature
extractor, so this PR makes them optional too.

Note: I couldn't test the modeling tests, there seem to be no fast tests, and the slow tests are failing for reasons seemingly unrelated to this PR.

Fixes # (issue)

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue or the forum? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Here are the
    documentation guidelines, and
    here are tips on formatting docstrings.
  • Did you write any new necessary tests?

Who can review?

Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint.

Copy link
Collaborator

@sgugger sgugger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing this!

@@ -2421,6 +2428,7 @@ def forward(
mask_labels: Optional[Tensor] = None,
class_labels: Optional[Tensor] = None,
pixel_mask: Optional[Tensor] = None,
output_auxiliary_logits: Optional[bool] = None,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably go with a config argument (like output_hidden_states etc) that would give a default. Otherwise defaulting to None makes no sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I made the change but will wait for @FrancescoSaverioZuppichini advice to make sure this is sound.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just a little bit of context, the auxiliary_logits are consumed by the loss if use_auxiliary_loss was set to true. So we could remove them from the output or add a flag in the config to return them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if someone uses both output_auxiliary_logits=True and use_auxiliary_loss=True then it wouldn't work currently is that it ? (If so we need to change the consuming behavior into a copy I think)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will work :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM

@Narsil Narsil merged commit ea07064 into huggingface:master Mar 8, 2022
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

Successfully merging this pull request may close these issues.

4 participants