Skip to content

Commit

Permalink
place multi-processing init to main method (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
Qing Lan authored Feb 10, 2023
1 parent fff55e7 commit 7634698
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/pytorch/gpt/utils/huggingface_gpt_convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,7 @@ def split_and_convert(args):
"mlp.dense_4h_to_h.bias",
"mlp.dense_4h_to_h.weight",
]

torch.multiprocessing.set_start_method("spawn")
torch.multiprocessing.set_sharing_strategy("file_system")

pool = multiprocessing.Pool(args.processes)
for name, param in model.named_parameters():
if name.find("weight") == -1 and name.find("bias") == -1:
Expand Down Expand Up @@ -201,4 +199,6 @@ def split_and_convert(args):
print("{}: {}".format(key, vars(args)[key]))
print("========================================")

torch.multiprocessing.set_start_method("spawn")
torch.multiprocessing.set_sharing_strategy("file_system")
split_and_convert(args)

0 comments on commit 7634698

Please sign in to comment.