Capture unused HRRRMiniDataset kwargs
Modulus Pull Request
Description
Tiny fix to HRRRMiniDataset for training CorrDiff-Mini. At https://github.com/NVIDIA/modulus/blob/main/examples/generative/corrdiff/datasets/dataset.py#L64, we add "train" and "all_times" kwargs to the dataset config, which are not understood by the HRRRMiniDataset constructor. Adding **kwargs to the constructor to avoid the following error:
Traceback (most recent call last):
File "/workspace/repos/modulus/examples/generative/corrdiff/train.py", line 82, in main
) = init_train_valid_datasets_from_config(
File "/workspace/repos/modulus/examples/generative/corrdiff/datasets/dataset.py", line 66, in init_train_valid_datasets_from_config
(valid_dataset, valid_dataset_iter) = init_dataset_from_config(
File "/workspace/repos/modulus/examples/generative/corrdiff/datasets/dataset.py", line 88, in init_dataset_from_config
dataset_obj = dataset_init_func(**dataset_cfg)
TypeError: HRRRMiniDataset.__init__() got an unexpected keyword argument 'train'
Checklist
- [ ] I am familiar with the Contributing Guidelines.
- [ ] New or existing tests cover these changes.
- [ ] The documentation is up to date with these changes.
- [ ] The CHANGELOG.md is up to date with these changes.
- [ ] An issue is linked to this pull request.
Dependencies
@jleinonen
I'm worried adding a **kwargs could lead to silently accepting invalid config files. We should rather keep the non-dataset code organized such that it doesn't assume that the dataset constructor accepts any particular argument. For example, the train and all_times parameters are specific to the CWB dataloader and shouldn't be passed to the mini dataloader.
Fixed in https://github.com/NVIDIA/modulus/pull/676