MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / z3_leaf_parameter

Function z3_leaf_parameter

deepspeed/utils/z3_leaf_module.py:26–34  ·  view source on GitHub ↗

Returns whether a parameter belongs to a leaf module. See `set_z3_leaf_modules` for more details. Args: model (torch.nn.Parameter): The parameter to which the leaf module flag will be applied. Returns: bool: Whether the parameter belongs to a leaf modu

(model: torch.nn.Parameter)

Source from the content-addressed store, hash-verified

24
25
26def z3_leaf_parameter(model: torch.nn.Parameter) -> bool:
27 """Returns whether a parameter belongs to a leaf module.
28 See `set_z3_leaf_modules` for more details.
29 Args:
30 model (torch.nn.Parameter): The parameter to which the leaf module flag will be applied.
31 Returns:
32 bool: Whether the parameter belongs to a leaf module.
33 """
34 return hasattr(model, 'ds_z3_leaf_module')
35
36
37def get_z3_leaf_modules(model: torch.nn.Module) -> List[torch.nn.Module]:

Calls

no outgoing calls

Tested by

no test coverage detected