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 typo in classification function selection logic to improve code consistency #32031

Merged
merged 1 commit into from
Jul 17, 2024

Conversation

moses
Copy link
Contributor

@moses moses commented Jul 17, 2024

Fixes #32030
(previously tagged #32013 )

The existing logic has a typo in it, where, for example, it selects a sigmoid classification function if the problem type is "multi_label_classification" or num_labels is 1. The num_labels condition overrides the problem_type condition, so in practice, I don't think this error will cause a bug, but it's confusing.

This fix corrects the problem type conditions.

Please review at your convenience @Narsil

The latter condition generally overrides the former, so this is more of a code reading issue. I'm not sure the bug would ever actually get triggered under normal use.
@leloykun
Copy link
Contributor

Hi! I think you should be tagging this? #32030

Copy link
Collaborator

@amyeroberts amyeroberts 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!

@amyeroberts amyeroberts merged commit 63be8e6 into huggingface:main Jul 17, 2024
18 checks passed
@moses moses deleted the issue-32030 branch July 17, 2024 22:42
amyeroberts pushed a commit to amyeroberts/transformers that referenced this pull request Jul 19, 2024
…onsistency (huggingface#32031)

Make problem_type condition consistent with num_labels condition

The latter condition generally overrides the former, so this is more of a code reading issue. I'm not sure the bug would ever actually get triggered under normal use.
MHRDYN7 pushed a commit to MHRDYN7/transformers that referenced this pull request Jul 23, 2024
…onsistency (huggingface#32031)

Make problem_type condition consistent with num_labels condition

The latter condition generally overrides the former, so this is more of a code reading issue. I'm not sure the bug would ever actually get triggered under normal use.
zucchini-nlp pushed a commit to zucchini-nlp/transformers that referenced this pull request Jul 24, 2024
…onsistency (huggingface#32031)

Make problem_type condition consistent with num_labels condition

The latter condition generally overrides the former, so this is more of a code reading issue. I'm not sure the bug would ever actually get triggered under normal use.
itazap pushed a commit that referenced this pull request Jul 25, 2024
…onsistency (#32031)

Make problem_type condition consistent with num_labels condition

The latter condition generally overrides the former, so this is more of a code reading issue. I'm not sure the bug would ever actually get triggered under normal use.
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.

Minor typo in ImageClassificationPipeline
3 participants