File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
8686Apex 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```
9090A Python-only build omits:
9191- Fused kernels required to use ` apex.optimizers.FusedAdam ` .
Original file line number Diff line number Diff line change @@ -145,6 +145,11 @@ Gradient accumulation across iterations
145145The following should "just work," and properly accommodate multiple models/optimizers/losses, as well as
146146gradient 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:
You can’t perform that action at this time.
0 commit comments