当前位置:网站首页>batchnorm. Py this file single GPU operation error solution

batchnorm. Py this file single GPU operation error solution

2022-07-05 01:26:00 Zi Yan Ruoshui

The original

        if self.training and self.track_running_stats:
            self.num_batches_tracked = self.num_batches_tracked + 1
            if self.momentum is None:  # use cumulative moving average
                exponential_average_factor = 1.0 / self.num_batches_tracked.item()
            else:  # use exponential moving average
                exponential_average_factor = self.momentum

        need_sync = self.training or not self.track_running_stats
        if need_sync:
            process_group = torch.distributed.group.WORLD
            if self.process_group:
                process_group = self.process_group
            world_size = torch.distributed.get_world_size(process_group)
            need_sync = world_size > 1

  Modify file :/home/ubuntu/venvs/venv/lib/python3.6/site-packages/torch/nn/modules/batchnorm.py


(venv) [email protected]:~/code/ICDAR2021_MFD$ python tools/train.py configs/gfl/gfl_s50_fpn_2x_coco.py --gpus 1 --work-dir /home/ubuntu/data
Traceback (most recent call last):
  File "tools/train.py", line 8, in <module>
    import mmcv
  File "/home/ubuntu/venvs/venv/lib/python3.6/site-packages/mmcv/__init__.py", line 4, in <module>
    from .fileio import *
  File "/home/ubuntu/venvs/venv/lib/python3.6/site-packages/mmcv/fileio/__init__.py", line 4, in <module>
    from .io import dump, load, register_handler
  File "/home/ubuntu/venvs/venv/lib/python3.6/site-packages/mmcv/fileio/io.py", line 4, in <module>
    from ..utils import is_list_of, is_str
  File "/home/ubuntu/venvs/venv/lib/python3.6/site-packages/mmcv/utils/__init__.py", line 19, in <module>
    import torch
  File "/home/ubuntu/venvs/venv/lib/python3.6/site-packages/torch/__init__.py", line 448, in <module>
    from .functional import *
  File "/home/ubuntu/venvs/venv/lib/python3.6/site-packages/torch/functional.py", line 4, in <module>
    import torch.nn.functional as F
  File "/home/ubuntu/venvs/venv/lib/python3.6/site-packages/torch/nn/__init__.py", line 1, in <module>
    from .modules import *
  File "/home/ubuntu/venvs/venv/lib/python3.6/site-packages/torch/nn/modules/__init__.py", line 17, in <module>
    from .batchnorm import BatchNorm1d, BatchNorm2d, BatchNorm3d, SyncBatchNorm
  File "/home/ubuntu/venvs/venv/lib/python3.6/site-packages/torch/nn/modules/batchnorm.py", line 489
    need_sync = False

原网站

版权声明
本文为[Zi Yan Ruoshui]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207050124272090.html

随机推荐