Mentions légales du service

Skip to content
Snippets Groups Projects
Commit b8eaa291 authored by PaulWawerek-L's avatar PaulWawerek-L
Browse files

read seedValue automatically

parent 7d038eb8
No related branches found
No related tags found
1 merge request!2OSLO-IC
......@@ -432,11 +432,17 @@ def main():
print(f"{key:_<40}: {val}\n") # check this for all kinds of formatting
print("=" * 60 + "\n")
seedValue = random.randrange(2**32) # create a seed
if args.seed is not None:
seedValue = args.seed
else:
seedValue = random.randrange(2**32) # create a seed
elif args.checkpoint_file and os.path.isfile(os.path.join(args.out_dir, 'config.txt')):
with open(os.path.join(args.out_dir, 'config.txt'), 'r') as f:
config_lines = f.readlines()
for line in config_lines:
if line.strip().startswith('seedValue'):
seedValue = int(line.split(': ')[1])
common_pytorch.set_seed(seedValue)
device_str = 'cpu'
if args.gpu and torch.cuda.is_available():
device_str = 'cuda'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment