(config)
| 244 | |
| 245 | |
| 246 | def 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 | |
| 256 | def get_obj_from_str(string, reload=False, invalidate_cache=True): |
no test coverage detected