-
Notifications
You must be signed in to change notification settings - Fork 72
Description
Bug Description
RuntimeError: Expected to have finished reduction in the prior iteration before starting a new one. This error indicates 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.
If you already have done the above, then the distributed data parallel module wasn't able to locate the output tensors in the return value of your module's forward function. Please include the loss function and the structure of the return value of forward of your module when reporting this issue (e.g. list, dict, iterable).
Parameters which did not receive grad for rank 0: module.image_encoder.imagegoal_encoder.mask_token, module.pixel_encoder.pixelgoal_encoder.mask_token, module.rgbd_encoder.depth_model.mask_token
Parameter indices which did not receive grad for rank 0: 2 217 394
Steps to Reproduce
bash scripts/train/base_train/start_train.sh --name navdp_train --model navdp
Expected Behavior
Distributed Data Parallel Training without Error
Screenshots/Videos
No response
Environment
- OS: [e.g. Ubuntu 22.04]
- Ubuntu 22.04
- GPU/CPU [e.g. A100, RTX 4090, i9-14900K]
- RTX 5090
- GPU-driver version
- 580.95.05
Release version or Commit ID
version 0.3.0
Additional Context
ONE WAY TO SOLVE THIS PROBLEM
navigate to internnav/model/basemodel/encoder/depth_anything/depth_anything_v2/dinov2.py
in DinoVisionTransformer class:
def prepare_tokens_with_masks(self, x, masks=None):
B, nc, w, h = x.shape
#BEGIN[MODIFY] force mask_token to participate calculation
x = self.patch_embed(x) + self.mask_token * 0.0
#ORIGIN
# x = self.patch_embed(x)
#END[MODIFY] force mask_token to participate calculation
if masks is not None:
x = torch.where(masks.unsqueeze(-1), self.mask_token.to(x.dtype).unsqueeze(0), x)
x = torch.cat((self.cls_token.expand(x.shape[0], -1, -1), x), dim=1)
x = x + self.interpolate_pos_encoding(x, w, h)
if self.register_tokens is not None:
x = torch.cat(
(
x[:, :1],
self.register_tokens.expand(x.shape[0], -1, -1),
x[:, 1:],
),
dim=1,
)
return x