Skip to content

Commit 68e2efe

Browse files
authored
Mention small discrepancy due to Dropout non-reproducibility in PyTorch (rasbt#519)
* Mention small discrepancy due to Dropout non-reproducibility in PyTorch * bump pytorch version
1 parent bd8f752 commit 68e2efe

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

.github/workflows/basic-tests-old-pytorch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test PyTorch 2.0 and 2.5
1+
name: Test PyTorch 2.0 and 2.6
22

33
on:
44
push:
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424
strategy:
2525
matrix:
26-
pytorch-version: [ 2.0.1, 2.5.0 ]
26+
pytorch-version: [ 2.0.1, 2.6.0 ]
2727

2828
steps:
2929
- uses: actions/checkout@v4

ch04/01_main-chapter-code/ch04.ipynb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@
317317
"```\n",
318318
"\n",
319319
"- Since these are just random numbers, this is not a reason for concern, and you can proceed with the remainder of the chapter without issues\n",
320+
"- One possible reason for this discrepancy is the differing behavior of `nn.Dropout` across operating systems, depending on how PyTorch was compiled, as discussed [here on the PyTorch issue tracker](https://github.com/pytorch/pytorch/issues/121595)\n",
320321
"\n",
321322
"---"
322323
]

ch05/01_main-chapter-code/ch05.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,6 +1348,16 @@
13481348
"# print(f\"Training completed in {execution_time_minutes:.2f} minutes.\")"
13491349
]
13501350
},
1351+
{
1352+
"cell_type": "markdown",
1353+
"id": "2e8b86f0-b07d-40d7-b9d3-a9218917f204",
1354+
"metadata": {},
1355+
"source": [
1356+
"- Note that you might get slightly different loss values on your computer, which is not a reason for concern if they are roughly similar (a training loss below 1 and a validation loss below 7)\n",
1357+
"- Small differences can often be due to different GPU hardware and CUDA versions or small changes in newer PyTorch versions\n",
1358+
"- Even if you are running the example on a CPU, you may observe slight differences; a possible reason for a discrepancy is the differing behavior of `nn.Dropout` across operating systems, depending on how PyTorch was compiled, as discussed [here on the PyTorch issue tracker](https://github.com/pytorch/pytorch/issues/121595)"
1359+
]
1360+
},
13511361
{
13521362
"cell_type": "code",
13531363
"execution_count": 28,

0 commit comments

Comments
 (0)