Make config overrides user friendly (#80)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
7690cae2fc
commit
681cfc1c35
3 changed files with 86 additions and 0 deletions
|
|
@ -3,6 +3,8 @@ from typing import Dict, Union
|
|||
|
||||
from omegaconf import DictConfig, OmegaConf
|
||||
|
||||
from ultralytics.yolo.utils.configs.hydra_patch import check_config_mismatch
|
||||
|
||||
|
||||
def get_config(config: Union[str, DictConfig], overrides: Union[str, Dict] = {}):
|
||||
"""
|
||||
|
|
@ -20,4 +22,6 @@ def get_config(config: Union[str, DictConfig], overrides: Union[str, Dict] = {})
|
|||
elif isinstance(overrides, Dict):
|
||||
overrides = OmegaConf.create(overrides)
|
||||
|
||||
check_config_mismatch(dict(overrides).keys(), dict(config).keys())
|
||||
|
||||
return OmegaConf.merge(config, overrides)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue