Commit 6e894c5d authored by Yin, Junqi's avatar Yin, Junqi

make it deterministic

parent 375c81fe
......@@ -6,7 +6,8 @@ import torch
import torch.distributed as dist
import torch.nn as nn
import torch.multiprocessing as mp
import numpy as np
import random
from parameters import get_args
import pcode.create_dataset as create_dataset
......@@ -199,10 +200,12 @@ def init_config(conf):
assert torch.cuda.is_available()
torch.manual_seed(conf.manual_seed*cur_rank)
torch.cuda.manual_seed(conf.manual_seed*cur_rank)
np.random.seed(conf.manual_seed*cur_rank)
random.seed(conf.manual_seed*cur_rank)
torch.cuda.set_device(conf.graph.device[0])
torch.backends.cudnn.enabled = True
torch.backends.cudnn.benchmark = True
torch.backends.cudnn.deterministic = True if conf.train_fast else False
torch.backends.cudnn.benchmark = False #True
torch.backends.cudnn.deterministic = True #if conf.train_fast else False
# define checkpoint for logging.
checkpoint.init_checkpoint(conf)
......
......@@ -209,7 +209,7 @@ def get_args():
parser.add_argument(
"-j",
"--num_workers",
default=4,
default=0,
type=int,
help="number of data loading workers (default: 4)",
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment