Reduce boilerplate around MultiStorageClient feature checks - #5269
Conversation
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
maanug-nv
left a comment
There was a problem hiding this comment.
Hi @Randl , thanks for tackling this. MSC accesses seem a lot cleaner now!
The implementation of maybe_msc seems problematic though, iiuc it will always be disabled. Since MaybeMultiStorageClient's init is running once the first time this file is imported, it will get initialized to maybe_msc before a user even has the chance to run MultiStorageClientFeature.enable().
Some ideas off the top of my head that might work instead:
- move
MaybeMultiStorageClientandmaybe_mscto a different file. If this gets added to any 'init.py' files on accident though, might run into the same issue. - construct a
MaybeMultiStorageClienteach time. ie in the other files, you'd doMaybeMultiStorageClient().osor similar. - replace
MaybeMultiStorageClientwith a function. - use lazy initialization of
self.open,self.os, etc. this would allow you to still construct it once, and the 'is_enabled()' checks will happen at runtime lazily. - add
self.open,self.ostoMultiStorageClientFeature, and set appropriately inenable()anddisable().
Shouldn't take too long to implement any of those I think. Once it's fixed, we can push this through review to get merged.
|
Yep, you're right @maanug-nv |
|
/ok to test 07c463d |
Code reviewFound 4 issues:
The refactored line dropped the Megatron-LM/megatron/core/dist_checkpointing/strategies/common.py Lines 36 to 43 in 07c463d
Megatron-LM/megatron/core/dist_checkpointing/validation.py Lines 206 to 211 in 07c463d
The original Megatron-LM/megatron/training/config/container.py Lines 189 to 202 in 07c463d
The original local-path branch guarded each entry with Megatron-LM/megatron/core/dist_checkpointing/validation.py Lines 518 to 523 in 07c463d 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
0b81410 to
1a55265
Compare
|
Fair enough. |
|
/ok to test 1a55265 |
|
/ok to test da12d84 |
|
Hi @Randl , sorry this is taking so long. |
|
@maanug-nv I've pushed the update, do you need to rerun the CI manually? |
|
/ok to test 4dc5816 |
|
/ok to test 1ecd38e |
|
/ok to test bbf91bb |
|
/ok to test 6578f93 |
Signed-off-by: Evgenii Zheltonozhskii <zheltonozhskiy@gmail.com>
Signed-off-by: Evgenii Zheltonozhskii <zheltonozhskiy@gmail.com>
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Signed-off-by: Evgenii Zheltonozhskii <zheltonozhskiy@gmail.com>
Signed-off-by: Evgenii Zheltonozhskii <zheltonozhskiy@gmail.com>
Signed-off-by: Evgenii Zheltonozhskii <zheltonozhskiy@gmail.com>
Signed-off-by: Evgenii Zheltonozhskii <zheltonozhskiy@gmail.com>
Signed-off-by: Evgenii Zheltonozhskii <zheltonozhskiy@gmail.com>
|
Looks like attempted merge broke something, I fixed and pushed again |
|
/ok to test 6cc1dde |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/29775113671 |
What does this PR do ?
Use a proxy object to handle MultiStorageClient.
Issue tracking
Linked issue: Fixes #4507
Contribution process
Pre-checks