def parse(cfg): assert isinstance(cfg, Config), cfg cfg = resolve_alias(ALIASES, cfg) check_nonempty(cfg, MUST_FIELDS) cfg = resolve_path(cfg) cfg.model = correct_model_config(cfg.model) return cfg
def test_align_pipeline_and_alias(yml, modified): config = OmegaConf.create(yml) config = resolve_alias(ALIASES, config) config = _add_required_pipes(config) config = _align_pipeline(config) modified = OmegaConf.create(modified) assert list(config.pipeline) == list(modified.pipeline)
def correct_model_config(cfg: NLPConfig) -> NLPConfig: """Parse config. Complement missing informations, resolve aliases, etc.""" PARSERS: List[_ConfigParser] = [ resolve_alias(ALIASES), _assign_pipeline, _align_pipeline, _correct_trf_pipeline, _resolve_label, ] return toolz.pipe(cfg, *PARSERS)
def parse(cfg: Config): cfg = resolve_alias(ALIASES, cfg) check_nonempty(cfg, MUST_FIELDS) cfg = resolve_path(cfg) cfg.model = correct_model_config(cfg.model) return cfg