def merge(self, input_config: DictConfig): """ Merges under specified dictionary config into the current configuration object :param input_config: The input configuration dictionary :return: Structured output config """ for key in self.__dict__.keys(): if key in input_config.keys(): if input_config.get(key, None) is not None: if key == "negative_sampling": val = input_config.get("negative_sampling", MISSING) if val is not MISSING: if self.negative_sampling is MISSING: self.negative_sampling = NegativeSamplingConfig() self.negative_sampling.merge(val) elif key == "pipeline": if self.pipeline is MISSING: self.pipeline = PipelineConfig() self.pipeline.merge(input_config.pipeline) elif key == "checkpoint": self.checkpoint.merge(input_config.checkpoint) else: val = input_config.__getattr__(key) self.__setattr__(key, val) self.__post_init__()
def merge(self, input_config: DictConfig): """ Merges under specified dictionary config into the current configuration object :param input_config: The input configuration dictionary :return: Structured output config """ for key in self.__dict__.keys(): if key in input_config.keys(): val = input_config.__getattr__(key) self.__setattr__(key, val) self.__post_init__()