FSDPConfig#3170
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughIntroduces a dedicated FSDPConfig Pydantic model and switches AxolotlInputConfig.fsdp_config to use it. Updates validation logic to access FSDP settings via attributes instead of dict keys. Adjusts tests to reflect renamed/mapped FSDP fields during config normalization/migration. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
📖 Documentation Preview: https://68e8f210ee7e3e94afb37b19--resonant-treacle-0fd729.netlify.app Deployed on Netlify from commit 7a8672e |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/axolotl/utils/schemas/validation.py (1)
885-896: Use int comparison for fsdp_version; keep attribute accessMinor consistency/safety: elsewhere
fsdp_versionis treated as int post-parse. Comparing as string is brittle.Apply:
- and str(self.fsdp_version) != "2" + and self.fsdp_version != 2src/axolotl/utils/schemas/fsdp.py (1)
10-14: Forbid unknown keys to catch typos earlyGiven we normalize legacy
fsdp_*keys before model parsing, rejecting unknown fields here helps prevent silent misconfigurations.Apply:
class FSDPConfig(BaseModel): """ FSDP Configuration Schema """ + model_config = {"extra": "forbid"}
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/axolotl/utils/schemas/config.py(2 hunks)src/axolotl/utils/schemas/fsdp.py(1 hunks)src/axolotl/utils/schemas/validation.py(2 hunks)tests/test_normalize_config.py(0 hunks)
💤 Files with no reviewable changes (1)
- tests/test_normalize_config.py
🧰 Additional context used
🧬 Code graph analysis (1)
src/axolotl/utils/schemas/config.py (1)
src/axolotl/utils/schemas/fsdp.py (1)
FSDPConfig(10-67)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: PyTest from Source Dist (3.11, 2.8.0)
- GitHub Check: PyTest from Source Dist (3.11, 2.6.0)
- GitHub Check: PyTest (3.11, 2.8.0)
- GitHub Check: PyTest from Source Dist (3.11, 2.7.1)
- GitHub Check: PyTest (3.11, 2.6.0)
- GitHub Check: PyTest (3.11, 2.7.1)
- GitHub Check: preview
🔇 Additional comments (2)
src/axolotl/utils/schemas/config.py (1)
27-27: LGTM: new FSDPConfig importImport is correct and localizes FSDP schema cleanly.
src/axolotl/utils/schemas/validation.py (1)
821-831: Switch to attribute access (FSDPConfig) — correctReading
cpu_ram_efficient_loadingvia attribute on the typed model is correct for anaftervalidator.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
| ) | ||
| # TODO @SalmanMohammadi strongly type this as its own schema | ||
| fsdp_config: dict[str, Any] | None = Field( | ||
| fsdp_config: FSDPConfig | None = Field( |
There was a problem hiding this comment.
Would this mean we're now dropping fsdp1 support? Given that the fsdp_config schema only has fsdp2 configs, any prior fsdp1 configs would be dropped.
There was a problem hiding this comment.
fsdp_config should also include FSDP1 fields, am I missing some?
There was a problem hiding this comment.
There is also the old way of configuring FSDP1 through cfg.fsdp which remains.
There was a problem hiding this comment.
For ex:
fsdp_config:
fsdp_state_dict_type: FULL_STATE_DICT
fsdp_transformer_layer_cls_to_wrap: MistralDecoderLayer
fsdp_activation_checkpointing: true
With the new pydantic schema, would these be ignored?
There was a problem hiding this comment.
No, we strip fsdp_ from any fields which have it and emit a deprecation warning to encourage users to just use state_dict_type etc. But those fields are common to both FSDP1 and FSDP2.
There was a problem hiding this comment.
There are tests which cover this in test_normalize_config.py.
There was a problem hiding this comment.
Thanks for clarifying. Forgot it gets stripped before the pydantic
|
Please hold off on merging until #3167 lands. |
(cherry picked from commit 143dea4)
Summary by CodeRabbit
New Features
Bug Fixes
Tests