Skip to content

Commit

Permalink
fix(composer): streamline config initialization and composition
Browse files Browse the repository at this point in the history
  • Loading branch information
entelecheia committed Jul 21, 2023
1 parent f414c9f commit eaddcf3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/hyfi/composer/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,18 @@ def validate_model_config_before(cls, data):
if not _config_group_:
logger.debug("There is no config group specified.")
return data
config_group = f"{_config_group_}={_config_name_}"
if not Composer.is_composable(config_group):
logger.debug("Config group `%s` is not composable.", config_group)
return data
# Initialize the config with the given config_name.
logger.info(
"Composing `%s` class with `%s` config in `%s` group.",
_class_name_,
_config_name_,
_config_group_,
)
cfg = Composer(
config_group=f"{_config_group_}={_config_name_}",
config_data=data,
).config_as_dict
cfg = Composer(config_group=config_group, config_data=data).config_as_dict
data = Composer.update(cfg, data)
# Exclude any attributes specified in the class's `exclude` list.
exclude = getattr(cls._exclude_, "default", set()) # type: ignore
Expand Down

0 comments on commit eaddcf3

Please sign in to comment.