Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@
"# ⚡ PyTorch Lightning\n",
"import lightning.pytorch as pl\n",
"import torchmetrics\n",
"pl.seed_everything(hash(\"setting random seeds\") % 2**32 - 1)\n",
"seed = 42\n",
"pl.seed_everything(seed)\n",
"\n",
"# 🏋️‍♀️ Weights & Biases\n",
"import wandb\n",
Expand Down
9 changes: 5 additions & 4 deletions colabs/pytorch/Simple_PyTorch_Integration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -145,11 +145,12 @@
"from tqdm.auto import tqdm\n",
"\n",
"# Ensure deterministic behavior\n",
"seed = 42\n",
"torch.backends.cudnn.deterministic = True\n",
"random.seed(hash(\"setting random seeds\") % 2**32 - 1)\n",
"np.random.seed(hash(\"improves reproducibility\") % 2**32 - 1)\n",
"torch.manual_seed(hash(\"by removing stochasticity\") % 2**32 - 1)\n",
"torch.cuda.manual_seed_all(hash(\"so runs are repeatable\") % 2**32 - 1)\n",
"random.seed(seed)\n",
"np.random.seed(seed)\n",
"torch.manual_seed(seed)\n",
"torch.cuda.manual_seed_all(seed)\n",
"\n",
"# Device configuration\n",
"device = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n",
Expand Down
9 changes: 5 additions & 4 deletions examples/pytorch/pytorch-intro/intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,12 @@
"from tqdm.auto import tqdm\n",
"\n",
"# Ensure deterministic behavior\n",
"seed = 42\n",
"torch.backends.cudnn.deterministic = True\n",
"random.seed(hash(\"setting random seeds\") % 2**32 - 1)\n",
"np.random.seed(hash(\"improves reproducibility\") % 2**32 - 1)\n",
"torch.manual_seed(hash(\"by removing stochasticity\") % 2**32 - 1)\n",
"torch.cuda.manual_seed_all(hash(\"so runs are repeatable\") % 2**32 - 1)\n",
"random.seed(seed)\n",
"np.random.seed(seed)\n",
"torch.manual_seed(seed)\n",
"torch.cuda.manual_seed_all(seed)\n",
"\n",
"# Device configuration\n",
"device = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")"
Expand Down