-
Notifications
You must be signed in to change notification settings - Fork 4.4k
HF2UCP: Converting a pytorch_model.bin
or .safetensors
checkpoint to UCP
#7212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Schwidola0607 <[email protected]>
Signed-off-by: Schwidola0607 <[email protected]>
Signed-off-by: Schwidola0607 <[email protected]>
Signed-off-by: Schwidola0607 <[email protected]>
Signed-off-by: Schwidola0607 <[email protected]>
Signed-off-by: Schwidola0607 <[email protected]>
Signed-off-by: Schwidola0607 <[email protected]>
Signed-off-by: Schwidola0607 <[email protected]>
Signed-off-by: Schwidola0607 <[email protected]>
Signed-off-by: Schwidola0607 <[email protected]>
@@ -0,0 +1,36 @@ | |||
--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about moving this document to the Megatron-DeepSpeed
repository?
The purpose of converting the Hugging Face checkpoint to UCP is to enable loading with 4D parallelism, so the Megatron-DeepSpeed repo might be a more suitable place for it.
optim_sd = torch.load(optim_state_path, weights_only=False) | ||
|
||
self._load_global_state(optim_sd) | ||
if os.path.isfile(optim_state_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
Update the logic as follows:
if universal_checkpoint:
# Allow missing optimizer state path, but issue a warning
if optim_state_path is None:
warnings
else:
assert os.path.isfile()
optim_sd = torch.load(optim_state_path, weights_only=False) | ||
self._load_global_state_stage3(optim_sd) | ||
if os.path.isfile(optim_state_path): | ||
ignore_missing_optim_state = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion:
Update the logic as follows:
if universal_checkpoint:
# Allow missing optimizer state path, but issue a warning
if optim_state_path is None:
warnings
else:
assert os.path.isfile()
@@ -2947,7 +2947,7 @@ def load_checkpoint(self, | |||
|
|||
Returns: | |||
A tuple of ``load_path`` and ``client_state``. | |||
*``load_path``: Path of the loaded checkpoint. ``None`` if loading the checkpoint failed. | |||
*``load_path``: Path of the loaded checkpoint. ``None`` if loading the checkpoint failed or loading a HF based UCP |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
missing comma
PR for HF2UCP feature
Converting a pytorch_model.bin or .safetensors checkpoint to UCP will