Commit 8bf38df
Only import torch.distributed when needed (open-mmlab#882)
* Fix an import error for `get_world_size` and `get_rank`
* Only import torch.distributed when needed
torch.distributed is only used in DistributedGroupSampler
* use `get_dist_info` to obtain world size and rank
`get_dist_info` from `mmcv.runner.utils` handles the problem of `distributed_c10d` doesn't exist.1 parent f080ccb commit 8bf38df
1 file changed
+4
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| 98 | + | |
98 | 99 | | |
99 | | - | |
| 100 | + | |
100 | 101 | | |
101 | | - | |
| 102 | + | |
102 | 103 | | |
103 | 104 | | |
104 | 105 | | |
| |||
0 commit comments