[RFC] structured configs for verl #2648
eric-haibin-lin
started this conversation in
RFC
Replies: 1 comment
-
I propose to upstream dataclass config classes from Trinity: It builds up on Verl and validated the approach with dataclass configs and OmegaConf. E.g. here is an example of partial Verl config dataclass: https://github.com/nkkarpov/Trinity-RFT/blob/main/trinity/common/verl_config.py |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As initially mentioned in #1941, having structured configuration classes in verl makes argument passing easier for testing and validation.
This is an extended thread on the current implementation of configuration schema in verl. Related PRs:
Motivation
By moving from loose
omegaconfig.DictConfig
-based parameters to structured dataclasses, we gain:Core: BaseConfig
All config dataclasses inherit from BaseConfig, which:
extra: dict[str, Any]
for unchecked extensions.Example Config Classes (verl/trainer/config)
Each sub-component of the trainer has its own dataclass, inheriting BaseConfig.
Definition:
Extending existing config classes
Because now configs become structured, unexpected keys would raise exceptions. To add new keys, there are two ways:
Explicit class extensions:
When using yaml or from command line, update the target config class:
or directly from command line:
Leverage the
extra
fieldAdding more keys to the
extra
field of any dataclass that inherits fromBaseConfig
also works. This way there's no need to define your own dataclass in python:Declaring mutable fields
For historical reasons some fields in the configs are mutated inplace in the codebase such as batch size for data/sequence parallelism. We are in the process of deprecating this kind of behavior. However, if you want to intentionally mutate one field, specify it with the
_mutable_fields
attr:Other helpful resources
verl default trainer configs combines the following config files together, specified in the
_defaults_
field: https://github.com/volcengine/verl/blob/main/verl/trainer/config/ppo_trainer.yaml#L1-L36To quickly peek the default full config in a single file, you can check the auto-generated full config in https://github.com/volcengine/verl/blob/main/verl/trainer/config/_generated_ppo_trainer.yaml
Beta Was this translation helpful? Give feedback.
All reactions