We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6faf6e3 + 328d13b commit 86ab99fCopy full SHA for 86ab99f
sota_extractor2/helpers/training.py
@@ -1,10 +1,14 @@
1
2
-def set_seed(seed, name, quiet=False):
+def set_seed(seed, name, quiet=False, all_gpus=True):
3
import torch
4
import numpy as np
5
+ import random
6
if not quiet:
7
print(f"Setting {name} seed to {seed}")
8
torch.manual_seed(seed)
9
torch.backends.cudnn.deterministic = True
10
torch.backends.cudnn.benchmark = False
- np.random.seed(seed)
11
+ np.random.seed(seed)
12
+ random.seed(seed)
13
+ if all_gpus:
14
+ torch.cuda.manual_seed_all(seed)
0 commit comments