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 cost condition in DetrHungarianMatcher and YolosHungarianMatcher to allow zero-cost #18647

Merged

Conversation

kongzii
Copy link
Contributor

@kongzii kongzii commented Aug 16, 2022

What does this PR do?

Fixes costs condition in DetrHungarianMatcher and YolosHungarianMatcher. In #16720 a bug was introduced while switching from asserts to conditions. Currently, any zero-cost will result in a ValueError:

if class_cost == 0 or bbox_cost == 0 or giou_cost == 0:
    raise ValueError("All costs of the Matcher can't be 0")

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?

@LysandreJik @sgugger based on reviewers of previous PR #16720.

@kongzii kongzii changed the title Fix loss condition in DetrHungarianMatcher to allow zero-loss Fix loss condition in DetrHungarianMatcher to allow zero-cost Aug 16, 2022
@kongzii kongzii changed the title Fix loss condition in DetrHungarianMatcher to allow zero-cost Fix cost condition in DetrHungarianMatcher to allow zero-cost Aug 16, 2022
@HuggingFaceDocBuilderDev
Copy link

HuggingFaceDocBuilderDev commented Aug 16, 2022

The documentation is not available anymore as the PR was closed or merged.

@kongzii kongzii changed the title Fix cost condition in DetrHungarianMatcher to allow zero-cost Fix cost condition in DetrHungarianMatcher and YolosHungarianMatcher to allow zero-cost Aug 16, 2022
@LysandreJik
Copy link
Member

This looks reasonable given the error message! cc @NielsRogge

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.

Indeed, this slipped through the cracks of my review of #16720. Thanks a lot for fixing!

@sgugger sgugger merged commit c3be98e into huggingface:main Aug 31, 2022
@kongzii kongzii deleted the kongzii-fix-loss-DetrHungarianMatcher branch August 31, 2022 12:30
oneraghavan pushed a commit to oneraghavan/transformers that referenced this pull request Sep 26, 2022
…to allow zero-cost (huggingface#18647)

* Fix loss condition in DetrHungarianMatcher

* Fix costs condition in YolosHungarianMatcher
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