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

[DETA] fix backbone freeze/unfreeze function #27843

Merged
merged 8 commits into from
Dec 11, 2023
4 changes: 2 additions & 2 deletions src/transformers/models/deta/modeling_deta.py
Original file line number Diff line number Diff line change
Expand Up @@ -1416,12 +1416,12 @@ def get_decoder(self):

# Copied from transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrModel.freeze_backbone
SangbumChoi marked this conversation as resolved.
Show resolved Hide resolved
def freeze_backbone(self):
for name, param in self.backbone.conv_encoder.model.named_parameters():
for name, param in self.backbone.model.named_parameters():
param.requires_grad_(False)

# Copied from transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrModel.unfreeze_backbone
SangbumChoi marked this conversation as resolved.
Show resolved Hide resolved
def unfreeze_backbone(self):
for name, param in self.backbone.conv_encoder.model.named_parameters():
for name, param in self.backbone.model.named_parameters():
param.requires_grad_(True)

# Copied from transformers.models.deformable_detr.modeling_deformable_detr.DeformableDetrModel.get_valid_ratio
Expand Down