-
Notifications
You must be signed in to change notification settings - Fork 144
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
base: main
Are you sure you want to change the base?
Conversation
99c7bf8
to
ca07946
Compare
mindcv/utils/distill_loss_cell.py
Outdated
def construct(self, data, label): | ||
out = self._backbone(data) | ||
|
||
out, out_kd = out |
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.
_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.
对,需要返回一个cls_token和一个distill_token
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.
目前的网络支持返回两个结果吗?
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.
可以在网络结构中实现返回两个结果
mindcv/utils/distill_loss_cell.py
Outdated
teacher_out = self.teacher_model(data) | ||
|
||
T = self.tau | ||
distillation_loss = ( |
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.
可以考虑统一 DistillLossCell
,不同loss算法名称以参数传入,实际算法以不同方法实现
79d7428
to
7b6c666
Compare
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)