From c4248e23e4d01e5c313a8288e66546586f1c7854 Mon Sep 17 00:00:00 2001 From: LiuChang <20027988+liuchang0523@users.noreply.github.com> Date: Thu, 7 Dec 2023 23:44:56 +0800 Subject: [PATCH] Update base_backbone.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Solve the problem: RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicate s that your module has parameters that were not used in producing loss. You can enable unused parameter detection by passing the keyword argument `find_unused_parameters=True` to `torch.nn.parallel.DistributedDataParallel`, and by making sure all `forward` function outputs participate in calculating loss. reference: https://github.com/open-mmlab/mmdetection/issues/8208#issuecomment-1505112163 --- mmyolo/models/backbones/base_backbone.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mmyolo/models/backbones/base_backbone.py b/mmyolo/models/backbones/base_backbone.py index 730c7095e..27502888b 100644 --- a/mmyolo/models/backbones/base_backbone.py +++ b/mmyolo/models/backbones/base_backbone.py @@ -118,6 +118,8 @@ def __init__(self, stage += self.make_stage_plugins(plugins, idx, setting) self.add_module(f'stage{idx + 1}', nn.Sequential(*stage)) self.layers.append(f'stage{idx + 1}') + + self._freeze_stages() @abstractmethod def build_stem_layer(self):