(module, prefix='', level=0)
| 384 | } |
| 385 | |
| 386 | def load_module_recursive(module, prefix='', level=0): |
| 387 | for name, child in module.named_children(): |
| 388 | if child.__class__ in layer_policies: |
| 389 | checking_key = prefix + name + '.' |
| 390 | if not any(checking_key in item for item in self.key_list): |
| 391 | continue |
| 392 | if len(list(child.parameters())) > 0 and list(child.parameters())[0].numel() == 0: |
| 393 | if len(child.weight.ds_shape) == 1: |
| 394 | child = Normalize(dim=child.weight.ds_shape[-1], dtype=child.weight.dtype, eps=child.eps) |
| 395 | setattr(module, name, child) |
| 396 | load(child, self.sd, prefix + name + '.') |
| 397 | else: |
| 398 | load_module_recursive(child, prefix if level == 0 else prefix + name + '.', level + 1) |
| 399 | |
| 400 | load_module_recursive(r_module) |
| 401 |
nothing calls this directly
no test coverage detected