Skip to content

Commit

Permalink
update data config explicitly after config update from checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
francoishernandez committed Sep 23, 2024
1 parent 6000008 commit 902aaf5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion eole/config/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,10 @@ def _validate_data(self):
# self.data = corpora
self.__dict__["data"] = corpora # skip validation to avoid recursion error

@model_validator(mode="after")
# @model_validator(mode="after")
# This needs to be called only after the config is fully up to date,
# to prevent setting and keeping some unwanted values
# (e.g. transforms [] for datasets)
def _validate_data_config(self, build_vocab_only=False):
if self.data is not None: # patch to allow None data
self._validate_data()
Expand Down
2 changes: 2 additions & 0 deletions eole/train_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def _init_train(config):
checkpoint = None

config = update_config_with_checkpoint(config, checkpoint=checkpoint)
# explicitly validate data_config after checkpoint update
config._validate_data_config()
transforms_cls = get_transforms_cls(config._all_transform)
vocabs, transforms = prepare_transforms_vocabs(config, transforms_cls)
if config.training.train_from and not config.training.update_vocab:
Expand Down

0 comments on commit 902aaf5

Please sign in to comment.