mmrazor
mmrazor copied to clipboard
[Feature] The design of the loss name field is controversial
Describe the feature
losses=[
dict(
type='ChannelWiseDivergence',
name='loss_cwd_logits', # ---------------- this---------------
tau=1,
loss_weight=5,
)
]
From the OpenMMLab development model, there should be no additional loss name field, which will bring the following problems:
- Registrar mode generally does not have this way of writing, which does not conform to the way of class registration.
- The user needs to set this parameter every time, is it necessary? This will increase the burden on users.
I am not sure about your specific needs, I hope to discuss this. Looking forward to your feedback.
Because there are several losses in distiller, they need to be distinguished according to name.
The name will be poped before build_loss.
https://github.com/open-mmlab/mmrazor/blob/4611be25e07b2e4d9d26d615215f06dc86a010ef/mmrazor/models/distillers/single_teacher.py#L64-L66