Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9ce8017

Browse files
Merge branch 'master' of https://github.com/NVIDIA/apex
2 parents f855756 + f17cd95 commit 9ce8017

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ CUDA and C++ extensions via
8080
```
8181
$ git clone https://github.com/NVIDIA/apex
8282
$ cd apex
83-
$ pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" .
83+
$ pip install -v --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
8484
```
8585

8686
Apex also supports a Python-only build (required with Pytorch 0.4) via
8787
```
88-
$ pip install -v --no-cache-dir .
88+
$ pip install -v --no-cache-dir ./
8989
```
9090
A Python-only build omits:
9191
- Fused kernels required to use `apex.optimizers.FusedAdam`.

docs/source/advanced.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ Gradient accumulation across iterations
145145
The following should "just work," and properly accommodate multiple models/optimizers/losses, as well as
146146
gradient clipping via the `instructions above`_::
147147

148+
# If your intent is to simulate a larger batch size using gradient accumulation,
149+
# you can divide the loss by the number of accumulation iterations (so that gradients
150+
# will be averaged over that many iterations):
151+
loss = loss/iters_to_accumulate
152+
148153
if iter%iters_to_accumulate == 0:
149154
# Every iters_to_accumulate iterations, unscale and step
150155
with amp.scale_loss(loss, optimizer) as scaled_loss:

0 commit comments

Comments
 (0)