mmrazor icon indicating copy to clipboard operation
mmrazor copied to clipboard

[Feature] The design of the loss name field is controversial

Open hhaAndroid opened this issue 4 years ago • 1 comments

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:

  1. Registrar mode generally does not have this way of writing, which does not conform to the way of class registration.
  2. 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.

hhaAndroid avatar Dec 27 '21 09:12 hhaAndroid

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

pppppM avatar Dec 31 '21 04:12 pppppM