MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / instantiate_from_config

Function instantiate_from_config

sat/vae_modules/utils.py:246–253  ·  view source on GitHub ↗
(config)

Source from the content-addressed store, hash-verified

244
245
246def instantiate_from_config(config):
247 if not "target" in config:
248 if config == "__is_first_stage__":
249 return None
250 elif config == "__is_unconditional__":
251 return None
252 raise KeyError("Expected key `target` to instantiate.")
253 return get_obj_from_str(config["target"])(**config.get("params", dict()))
254
255
256def get_obj_from_str(string, reload=False, invalidate_cache=True):

Callers 2

__init__Method · 0.90
load_model_from_configFunction · 0.70

Calls 2

getMethod · 0.80
get_obj_from_strFunction · 0.70

Tested by

no test coverage detected