(module, prefix='', level=0)
| 353 | } |
| 354 | |
| 355 | def load_module_recursive(module, prefix='', level=0): |
| 356 | for name, child in module.named_children(): |
| 357 | if child.__class__ in layer_policies: |
| 358 | checking_key = prefix + name + '.' |
| 359 | if not any(checking_key in item for item in self.key_list): |
| 360 | continue |
| 361 | if len(list(child.parameters())) > 0 and list(child.parameters())[0].numel() == 0: |
| 362 | if len(child.weight.ds_shape) == 1: |
| 363 | child = Normalize(dim=child.weight.ds_shape[-1], dtype=child.weight.dtype, eps=child.eps) |
| 364 | setattr(module, name, child) |
| 365 | load(child, self.sd, prefix + name + '.') |
| 366 | else: |
| 367 | load_module_recursive(child, prefix if level == 0 else prefix + name + '.', level + 1) |
| 368 | |
| 369 | load_module_recursive(r_module) |
| 370 |
nothing calls this directly
no test coverage detected