Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] find_unused_parameters error #945

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

liuchang0523
Copy link

Motivation

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.

Modification

Adding self._freeze_stages() at the end of the backbone init methods, similar to the resnet code (here for swin and here for CSPNeXt).

reference:

open-mmlab/mmdetection#8208 (comment)

Checklist

  1. Pre-commit or other linting tools are used to fix potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a potential influence on downstream projects, this PR should be tested with downstream projects, like MMDetection or MMClassification.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

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:
open-mmlab/mmdetection#8208 (comment)
@CLAassistant
Copy link

CLAassistant commented Dec 7, 2023

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants