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 num_classes update in reset_classifier and RDNet forward head call #2421

Merged
merged 3 commits into from
Jan 21, 2025

Conversation

brianhou0208
Copy link
Contributor

Hi @rwightman ,

  1. self.reset_classifier Bug:
    The self.reset_classifier method now properly updates self.num_classes when the num_classes parameter is used. (Only a few models lacked this update, while most already had it correctly implemented)

  2. RDNet forward Method Bug:
    Fixed the forward method of RDNet, where it incorrectly called self.head(x). It now correctly calls self.forward_head(x) to ensure proper functionality during the forward pass.

@rwightman
Copy link
Collaborator

rwightman commented Jan 21, 2025

@brianhou0208 thanks, should probably add a assert model.num_classes == 0 after the model.reset_classifier(0) in test_model_default_cfgs and test_model_default_cfgs_non_std to prevent that in the future...

@brianhou0208
Copy link
Contributor Author

@rwightman finished it, added assertions to check num_classes after reset_classifier(0) in both tests

@rwightman rwightman merged commit bda46f8 into huggingface:main Jan 21, 2025
22 checks passed
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.

2 participants