mirror of
https://github.com/hpcaitech/ColossalAI.git
synced 2025-09-07 20:10:17 +00:00
[devops] remove post commit ci (#5566)
* [devops] remove post commit ci * [misc] run pre-commit on all files * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -294,6 +294,7 @@ def shard_optimizer_checkpoint(state_dict: dict, max_shard_size: int = 1024) ->
|
||||
# Helper functions for saving state dict
|
||||
# ======================================
|
||||
|
||||
|
||||
def save_state_dict(state_dict: dict, checkpoint_file_path: str, use_safetensors: bool) -> None:
|
||||
"""
|
||||
Save state dict to checkpoint.
|
||||
@@ -305,7 +306,7 @@ def save_state_dict(state_dict: dict, checkpoint_file_path: str, use_safetensors
|
||||
"""
|
||||
# Move all tensors in the state_dict to CPU before saving to avoid serialization issues
|
||||
state_dict_cpu = tree_map(lambda x: x.cpu() if torch.is_tensor(x) else x, state_dict)
|
||||
|
||||
|
||||
if use_safetensors:
|
||||
assert is_safetensors_available(), "safetensors is not available."
|
||||
assert checkpoint_file_path.endswith(
|
||||
|
Reference in New Issue
Block a user