feat(config): inline DeepSpeed config into main YAML#36
Conversation
There was a problem hiding this comment.
Pull request overview
This PR migrates DeepSpeed configuration from an external YAML file (deepspeed.config_path) to an inline deepspeed: block embedded directly in the main training config YAMLs, with deepspeed: null intended to disable DeepSpeed.
Changes:
- Removes the
DeepSpeedConfigdataclass andload_deepspeed_config()loader, replacing them with a top-level inlinedeepspeedconfig object. - Updates training argument construction to pass the inline
deepspeedconfig directly. - Migrates TRL YAML configs (
sft.yaml,dpo.yaml) to include the full DeepSpeed config inline.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/post_training/utils/guardrails.py | Updates DeepSpeed summary output to reflect inline config rather than a referenced file path. |
| src/post_training/methods/common.py | Switches DeepSpeed config source from file-loading to using config.deepspeed directly when building trainer kwargs. |
| src/post_training/config.py | Removes file-based DeepSpeed config schema/loader and introduces an inline deepspeed field on the root config. |
| configs/trl/sft.yaml | Replaces deepspeed.config_path with an inline DeepSpeed config block for SFT runs. |
| configs/trl/dpo.yaml | Replaces deepspeed.config_path with an inline DeepSpeed config block for DPO runs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| t = config.training | ||
| ds_config = config.load_deepspeed_config() if config.deepspeed.config_path else None | ||
| ds_config = config.deepspeed | ||
|
|
| # Infrastructure. | ||
| deepspeed: DeepSpeedConfig = field(default_factory=DeepSpeedConfig) | ||
| # Inline DeepSpeed config dict. Set to null to disable DeepSpeed entirely. | ||
| deepspeed: Any = None | ||
| accelerate: AccelerateConfig = field(default_factory=AccelerateConfig) |
| # Inline DeepSpeed config dict. Set to null to disable DeepSpeed entirely. | ||
| deepspeed: Any = None | ||
| accelerate: AccelerateConfig = field(default_factory=AccelerateConfig) |
| # ------------------------------------------------------------------ | ||
|
|
||
| @classmethod | ||
| def load( |
There was a problem hiding this comment.
This function still supports the old deepspeed config style. (deepspeed: {config_path:...}). Maybe a deprecation warning over here or a assertion check while loading and merging would be good.
|
Good catch! I'll fix that.
I'd say no to this because:
I let them stay on as a reference. Might remove in future.
Yes, will do. |
# Conflicts: # tests/test_slurm_render.py
Summary
Removes the separate DeepSpeed config file and embeds the DeepSpeed configuration directly in the main training YAML under a
deepspeed:key. Setdeepspeed: nullto disable DeepSpeed entirely.Previously,
deepspeed.config_pathpointed to a separate file (e.g.configs/deepspeed/zero2.yaml) which had to be kept in sync with the main config. All existing configs (sft.yaml,dpo.yaml) are migrated to use the inline format.Type of change