Add custom section support to SFT TOML configuration#57
Conversation
Signed-off-by: Alex Peng <haopeng@nvidia.com>
|
|
||
| # Import lazily so this module stays cheap to import in non-training contexts. | ||
| from cosmos_framework.utils.config import load_config | ||
| import importlib |
There was a problem hiding this comment.
Should we directly load the config from module file by default? I think the original load_config will handle all cases: yaml, py?
There was a problem hiding this comment.
Agree with one entrypoint. But the interpolation requirement for ${custom} mandates that custom be injected into the tree prior to the resolution step within override(). To accommodate this, a pre_override hook has been added to load_config to enable this logic.
| dataloader_train: object = None | ||
|
|
||
|
|
||
| class TestCustomInterpolationAndAccess: |
There was a problem hiding this comment.
The test here could put into cosmos_framework/ and make this test in the same format with the other *test.py in cosmos_framework/ such as inference/prompt_upsampling_test.py? to make sure the unittest job in the current ci tests could automatically grep and run it?
There was a problem hiding this comment.
Good call, thanks to clarify the tests structure
Updated the `load_experiment_from_toml` function to utilize `load_config` with a `pre_override` hook for injecting the `[custom]` section into the config before applying overrides. This ensures that custom configurations are part of the OmegaConf tree resolved by Hydra. Additionally, modified the `load_config` and `_load_py_config` functions to accept the `pre_override` parameter for enhanced configurability. Documentation for SFT configuration has been updated to reflect these changes.
Signed-off-by: Alex Peng <haopeng@nvidia.com>
| data_setting: DataSetting = attrs.field(factory=DataSetting) | ||
| # Free-form, project-owned escape hatch fed by the SFT TOML's [custom] section. | ||
| # Default-empty so ${custom} interpolation and config.custom always resolve. | ||
| custom: dict = attrs.field(factory=dict) |
There was a problem hiding this comment.
For those two hydra configs, we prefer not changing anything here. Can you do it in this way:
- Only Add custom in sft_config
- pop custom_dict after load toml
- load_config in old way to get hydra config
- Using setattr(config, 'custom', custom_dict) to inject custom into hydra config
No description provided.