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

feat: support distillation strategy #705

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

The-truthh
Copy link
Collaborator

@The-truthh The-truthh commented Jul 17, 2023

Thank you for your contribution to the MindCV repo.
Before submitting this PR, please make sure:

Motivation

support distillation strategy

Test Plan

(How should this PR be tested? Do you require special setup to run the test or repro the fixed bug?)

Related Issues and PRs

(Is this PR part of a group of changes? Link the other relevant PRs and Issues here. Use https://help.github.com/en/articles/closing-issues-using-keywords for help on GitHub syntax)

@The-truthh The-truthh force-pushed the distill branch 5 times, most recently from 99c7bf8 to ca07946 Compare July 19, 2023 03:40
@SamitHuang SamitHuang requested a review from zhtmike July 29, 2023 10:29
def construct(self, data, label):
out = self._backbone(data)

out, out_kd = out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_backbone 返回的是两个结果吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对,需要返回一个cls_token和一个distill_token

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

目前的网络支持返回两个结果吗?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以在网络结构中实现返回两个结果

teacher_out = self.teacher_model(data)

T = self.tau
distillation_loss = (
Copy link
Contributor

@zhtmike zhtmike Aug 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以考虑统一 DistillLossCell,不同loss算法名称以参数传入,实际算法以不同方法实现

@The-truthh The-truthh force-pushed the distill branch 4 times, most recently from 79d7428 to 7b6c666 Compare August 8, 2023 09:36
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