Skip to content

Commit

Permalink
Modify broadcasting operation for random seed
Browse files Browse the repository at this point in the history
  • Loading branch information
hyunwoongko committed Dec 28, 2021
1 parent b78a208 commit d7007c9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions parallelformers/parallel/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,12 @@ def inference(self, model: nn.Module) -> None:
model (nn.Module): model weight
"""
if self.seed is None:
seed = time()
seed = torch.tensor(int(time())).cuda()
dist.broadcast(seed, src=0)
seed = seed.item()
else:
seed = self.seed

seed = torch.tensor(int(seed)).cuda()
dist.broadcast(seed, src=0)
seed = seed.item()

torch.manual_seed(seed)
np.random.seed(seed)
random.seed(seed)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

setup(
name='parallelformers',
version='1.2.1',
version='1.2.2',
description=
'An Efficient Model Parallelization Toolkit for Deployment',
long_description=long_description,
Expand Down

0 comments on commit d7007c9

Please sign in to comment.