Skip to content
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

Turn off safe_serialization from save_split so that save_function is called #56

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/transformers_neuronx/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
warnings.filterwarnings("ignore", category=UserWarning, module='torch.nn.modules.lazy')

def save_pretrained_split(model, save_directory):
model.save_pretrained(save_directory, save_function=save_split, max_shard_size='10000GB')
model.save_pretrained(save_directory, save_function=save_split, max_shard_size='10000GB', safe_serialization=False)


_KEY_TO_FILENAME_JSON = 'key_to_filename.json'
Expand Down Expand Up @@ -160,4 +160,4 @@ def load_state_dict_dir(self, state_dict_dir):
self.chkpt_model.load_state_dict_dir(state_dict_dir)

def load_state_dict_low_memory(self, state_dict):
self.chkpt_model.load_state_dict_low_memory(state_dict)
self.chkpt_model.load_state_dict_low_memory(state_dict)