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

[Bug]Fix fpn teacher distill #388

Merged
merged 1 commit into from
Dec 25, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ def loss(
# If the `override_data` of a delivery is False, the delivery will
# record the origin data.
self.distiller.set_deliveries_override(False)

# Unlike ``SingleTeacherDistill``, teacher will only execute
# back + neck, not head, so there will be no loss.
if self.teacher_trainable:
# Unlike ``SingleTeacherDistill``, teacher will only execute
# back + neck, not head, so there will be no loss.
with self.distiller.teacher_recorders, self.distiller.deliveries:
_ = self.teacher.extract_feat(batch_inputs)
else:
with self.distiller.teacher_recorders, self.distiller.deliveries:
with torch.no_grad():
_ = self.teacher(batch_inputs, data_samples, mode='loss')
_ = self.teacher.extract_feat(batch_inputs)

# If the `override_data` of a delivery is True, the delivery will
# override the origin data with the recorded data.
Expand Down