예제 #1
0
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
예제 #2
0
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)
예제 #3
0
파일: models.py 프로젝트: shafiahmed/camphr
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)
예제 #4
0
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