-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
We should add functionality to set the seed for torch
This came up because @VinCheetah is having a bit of trouble replicating results from the 2022 eLife TweetyNet paper
A separate question is whether we want to "set the seed for everything", I see some libraries do something like this (from https://gist.github.com/gatheluck/c57e2a40e3122028ceaecc3cb0d152ac)
import os
import random
import numpy as np
import torch
def set_all_seeds(seed):
random.seed(seed)
os.environ('PYTHONHASHSEED') = str(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.backends.cudnn.deterministic = TrueEarlier versions of lightning similarly had a function seed_everything (that AFAICT has since migrated to fabric): https://pytorch-lightning.readthedocs.io/en/1.7.7/api/pytorch_lightning.utilities.seed.html#pytorch_lightning.utilities.seed.seed_everything
but just doing a bare minimum of setting the torch seed will let us control e.g. random initialization of model parameters
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Todo