It’s a big project.
the way  to build model is [backbone+neck+head]
(1)the set params code in backbone
    def set_params(self, cfg): # cfg is a BatchNorm and Conv2d parameters
        """Backbone is using <layer type> to set lr and wd"""
        self.params = []
        arranged_names = set()
        for name, module in self.named_modules():
            for key in cfg:
                if isinstance(module, eval(key)):
                    self.params.append({'params': name + ".weight", 'lr': cfg[key][0],
                                        'weight_decay': cfg[key][1]})
                    arranged_names.add(name + '.weight')
                    if not isinstance(module, nn.PReLU):
                        if module.bias is not None and len(cfg[key]) == 4:
                            self.params.append({'params': name + ".bias",
                                                'lr': cfg[key][2], 'weight_decay': cfg[key][3]})
                            arranged_names.add(name + '.bias')

        for name, param in self.named_parameters():
            if name in arranged_names:
                continue
            else:
                self.params.append({'params': name})

        self.param_setted = True

(2) the build model part
build order: backbone->neck->head
    def build(self, mtype, kwargs):
        module_name, cls_name = mtype.rsplit('.', 1) # Some way to import 'class module'
        module = importlib.import_module(module_name)
        cls = getattr(module, cls_name)
        return cls(**kwargs)

    def forward(self, input):
        for submodule in self.children():
            output = submodule(input)
            input.update(output)
        return input

It’s so strange meet the problem, thanks for help!
Or can you explain what the diffence between self.named_modules() and self._modules ???
Thanks!!