Skip to content

Commit

Permalink
error early on missing mandatory values
Browse files Browse the repository at this point in the history
  • Loading branch information
milocress committed Apr 23, 2024
1 parent b9c3cbf commit cbfec68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 4 additions & 0 deletions llmfoundry/utils/config_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,10 @@ def make_dataclass_and_log_config(
dataclass_dict_config: DictConfig = om.structured(
dataclass_constructor(**unstructured_config))

# Error on missing mandatory values:
for key in dataclass_fields:
_ = dataclass_dict_config[key]

# Convert DictConfig to dict for dataclass constructor so that child
# configs are not DictConfigs
dataclass_config: T = dataclass_constructor(
Expand Down
4 changes: 0 additions & 4 deletions scripts/train/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@

def validate_config(train_config: TrainConfig):
"""Validates compatible model and dataloader selection."""
# Check for missing mandatory fields and throw error early.
for field in TRAIN_CONFIG_KEYS:
_ = getattr(train_config, field)

# Validate the rest of the config
loaders = [train_config.train_loader]
if train_config.eval_loaders is not None:
Expand Down

0 comments on commit cbfec68

Please sign in to comment.