We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 39e8d95 commit a246547Copy full SHA for a246547
1 file changed
selene_sdk/utils/config_utils.py
@@ -8,7 +8,9 @@
8
import sys
9
from time import strftime
10
import types
11
+import random
12
13
+import numpy as np
14
import torch
15
16
from . import _is_lua_trained_model
@@ -335,8 +337,12 @@ def parse_configs_and_run(configs,
335
337
336
338
if "random_seed" in configs:
339
seed = configs["random_seed"]
340
+ random.seed(seed)
341
+ np.random.seed(seed)
342
torch.manual_seed(seed)
343
torch.cuda.manual_seed_all(seed)
344
+ torch.backends.cudnn.deterministic = True
345
+ torch.backends.cudnn.benchmark = False
346
else:
347
print("Warning: no random seed specified in config file. "
348
"Using a random seed ensures results are reproducible.")
0 commit comments