-
Notifications
You must be signed in to change notification settings - Fork 27.2k
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: Parameterized norm freezing #32631
fix: Parameterized norm freezing #32631
Conversation
For the R18 model, the authors don't freeze norms in the backbone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, looks good to me! Can you please run make modified_only_fixup
to fix code style issues?
Co-authored-by: Pavel Iakubovskii <[email protected]>
Sorry for the delay. Should be good |
Cool! I've tried finetuning, works fine even without excluding weight decay for batchnorms. The only concern is that while loading the model I get the warning, probably because from transformers import AutoModelForObjectDetection
model = AutoModelForObjectDetection.from_pretrained(
"PekingU/rtdetr_r18vd",
freeze_backbone_batch_norms=False,
) Some weights of RTDetrForObjectDetection were not initialized from the model checkpoint at PekingU/rtdetr_r18vd and are newly initialized: ['model.backbone.model.embedder.embedder.0.normalization.num_batches_tracked', 'model.backbone.model.embedder.embedder.1.normalization.num_batches_tracked', 'model.backbone.model.embedder.embedder.2.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.0.layers.0.layer.0.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.0.layers.0.layer.1.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.0.layers.0.shortcut.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.0.layers.1.layer.0.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.0.layers.1.layer.1.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.1.layers.0.layer.0.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.1.layers.0.layer.1.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.1.layers.0.shortcut.1.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.1.layers.1.layer.0.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.1.layers.1.layer.1.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.2.layers.0.layer.0.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.2.layers.0.layer.1.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.2.layers.0.shortcut.1.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.2.layers.1.layer.0.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.2.layers.1.layer.1.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.3.layers.0.layer.0.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.3.layers.0.layer.1.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.3.layers.0.shortcut.1.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.3.layers.1.layer.0.normalization.num_batches_tracked', 'model.backbone.model.encoder.stages.3.layers.1.layer.1.normalization.num_batches_tracked'] |
@amyeroberts what do you think? I suggest not changing configs on the hub for backward compatibility and to avoid weight conversion, just let the user use |
@qubvel Agreed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this fix!
@AlanBlanchet One thing which would be useful for users is to have this documented on the model's hub README. If you could open up a PR to add that and share the link we'd be happy to do a quick review so people know this feature exists! |
Hello @amyeroberts . |
@amyeroberts Here is the link. |
For the R18 model, the authors don't freeze norms in the backbone.
What does this PR do?
Fixes # (issue)
#32604
Before submitting
Pull Request section?
to it if that's the case.
documentation guidelines, and
here are tips on formatting docstrings.
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.
@qubvel