MCPcopy Create free account
hub / github.com/AIS-SNU/Smart-Infinity / load_module_recursive

Method load_module_recursive

deepspeed/inference/engine.py:388–400  ·  view source on GitHub ↗
(module, prefix='', level=0)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

NormalizeClass · 0.85
load_module_recursiveFunction · 0.85
numelMethod · 0.80
loadFunction · 0.50

Tested by

no test coverage detected