Skip to content

[BUG] Training flag in convert_sync_batchnorm() #2422

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

Closed
collinmccarthy opened this issue Jan 21, 2025 · 2 comments · Fixed by #2423
Closed

[BUG] Training flag in convert_sync_batchnorm() #2422

collinmccarthy opened this issue Jan 21, 2025 · 2 comments · Fixed by #2423
Assignees
Labels
bug Something isn't working

Comments

@collinmccarthy
Copy link
Contributor

Maybe "bug" is too harsh, but should we be setting module_output.training = module.training in convert_sync_batchnorm()?

This is what torch.nn.SyncBatchNorm does now too, so personally I think we should.

I ran into some issues with mmdetection when this wasn't being set, but of course that could be mitigated by changing how/when model.eval() is called. Still, I think setting the module_output.training flag is correct.

Thoughts?

@collinmccarthy collinmccarthy added the bug Something isn't working label Jan 21, 2025
@rwightman
Copy link
Collaborator

@collinmccarthy yup, never noticed that change was made on pytorch side but timm should be updated too. Though wouldn't make a difference in use with the train script due to where .train() / .eval() are called, could impact some uses.

Want to add a PR?

@collinmccarthy
Copy link
Contributor Author

Yes, will do, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants