MCPcopy
hub / github.com/zai-org/CogVideo / instantiate_from_config

Function instantiate_from_config

sat/sgm/util.py:254–261  ·  view source on GitHub ↗
(config, **extra_kwargs)

Source from the content-addressed store, hash-verified

252
253
254def instantiate_from_config(config, **extra_kwargs):
255 if not "target" in config:
256 if config == "__is_first_stage__":
257 return None
258 elif config == "__is_unconditional__":
259 return None
260 raise KeyError("Expected key `target` to instantiate.")
261 return get_obj_from_str(config["target"])(**config.get("params", dict()), **extra_kwargs)
262
263
264def get_obj_from_str(string, reload=False, invalidate_cache=True):

Callers 15

__init__Method · 0.90
_init_first_stageMethod · 0.90
_build_modulesMethod · 0.90
__init__Method · 0.90
load_model_from_configFunction · 0.70
__init__Method · 0.50
__init__Method · 0.50
__init__Method · 0.50
__init__Method · 0.50
__init__Method · 0.50
__init__Method · 0.50
__init__Method · 0.50

Calls 1

get_obj_from_strFunction · 0.70

Tested by

no test coverage detected