diff --git a/models/integrations/pytorch.mdx b/models/integrations/pytorch.mdx index 3c644f823f..f967e0e187 100644 --- a/models/integrations/pytorch.mdx +++ b/models/integrations/pytorch.mdx @@ -70,11 +70,12 @@ import torchvision.transforms as transforms from tqdm.auto import tqdm # Ensure deterministic behavior +seed = 42 torch.backends.cudnn.deterministic = True -random.seed(hash("setting random seeds") % 2**32 - 1) -np.random.seed(hash("improves reproducibility") % 2**32 - 1) -torch.manual_seed(hash("by removing stochasticity") % 2**32 - 1) -torch.cuda.manual_seed_all(hash("so runs are repeatable") % 2**32 - 1) +random.seed(seed) +np.random.seed(seed) +torch.manual_seed(seed) +torch.cuda.manual_seed_all(seed) # Device configuration device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")