MCPcopy Create free account
hub / github.com/ASLP-lab/OSUM / get_nested_attribute

Function get_nested_attribute

OSUM/wenet/utils/common.py:327–333  ·  view source on GitHub ↗
(obj, attr_path)

Source from the content-addressed store, hash-verified

325
326
327def get_nested_attribute(obj, attr_path):
328 if isinstance(obj, torch.nn.parallel.DistributedDataParallel):
329 obj = obj.module
330 attributes = attr_path.split('.')
331 for attr in attributes:
332 obj = getattr(obj, attr)
333 return obj
334
335
336def lrs_to_str(lrs: List):

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected