INNER CODE UNIT · Python
merge_config
CogStack/OpenGPT · opengpt/config.py:49
def merge_config(self, config_dict):
r''' Merge a config_dict with the existing config object.
Args:
config_dict (`dict`):
A dictionary which key/values should be added to this class.
'''
for key in config_dict.keys():
if key in self.__dict__ and isinstance(self.__dict__[key], dict):
self.__dict__[key].update(config_dict[key])
else:
self.__dict__[key] = config_dict[key]
class Config(BaseConfig):
r''' There are probably nicer ways to do this, but I like this one.
'''
def __init__(self, yaml_path):
self.yaml_path = yaml_path