MCPcopy
hub / github.com/OpenMotionLab/MotionGPT / get_obj_from_str

Function get_obj_from_str

mGPT/config.py:24–33  ·  view source on GitHub ↗

Get object from string

(string, reload=False)

Source from the content-addressed store, hash-verified

22
23
24def get_obj_from_str(string, reload=False):
25 """
26 Get object from string
27 """
28
29 module, cls = string.rsplit(".", 1)
30 if reload:
31 module_imp = importlib.import_module(module)
32 importlib.reload(module_imp)
33 return getattr(importlib.import_module(module, package=None), cls)
34
35
36def instantiate_from_config(config):

Callers 2

configure_optimizersMethod · 0.90
instantiate_from_configFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected