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

Skip to content

Commit a78ccf0

Browse files
authored
fix import container_abcs issue (#1049)
* copy-paste friendly * fix import container_abcs issue Nightly PyTorch has removed `container_abcs` from `torch._six`. pytorch/pytorch@58eb233#diff-b3c160475f0fbe8ad50310f92d3534172ba98203387a962b7dc8f4a23b15cf4dL35 * fix import container_abcs issue Nightly PyTorch has removed `container_abcs` from `torch._six`. pytorch/pytorch@58eb233#diff-b3c160475f0fbe8ad50310f92d3534172ba98203387a962b7dc8f4a23b15cf4dL35 * keep existing for pytorch1.7 and earlier
1 parent eefb1ba commit a78ccf0

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,14 @@ See the [Docker example folder](https://github.com/NVIDIA/apex/tree/master/examp
122122
For performance and full functionality, we recommend installing Apex with
123123
CUDA and C++ extensions via
124124
```
125-
$ git clone https://github.com/NVIDIA/apex
126-
$ cd apex
127-
$ pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
125+
git clone https://github.com/NVIDIA/apex
126+
cd apex
127+
pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
128128
```
129129

130130
Apex also supports a Python-only build (required with Pytorch 0.4) via
131131
```
132-
$ pip install -v --disable-pip-version-check --no-cache-dir ./
132+
pip install -v --disable-pip-version-check --no-cache-dir ./
133133
```
134134
A Python-only build omits:
135135
- Fused kernels required to use `apex.optimizers.FusedAdam`.

apex/amp/_amp_state.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
TORCH_MAJOR = int(torch.__version__.split('.')[0])
99
TORCH_MINOR = int(torch.__version__.split('.')[1])
1010

11-
if TORCH_MAJOR == 0:
12-
import collections.abc as container_abcs
13-
else:
11+
12+
if TORCH_MAJOR == 1 and TORCH_MINOR < 8:
1413
from torch._six import container_abcs
14+
else:
15+
import collections.abc as container_abcs
1516

1617

1718
class AmpState(object):

0 commit comments

Comments
 (0)