You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我想将mmpretrain的模型拿出来,放入自己写的模型当作backbone,但是在训练的时候,报错backbone不能参与梯度计算。
’‘’
class UpernetDniov2(nn.Module):
def init(self, cfg, *args, **kwargs) -> None:
super().init(*args, **kwargs)
self.backbone = VisionTransformer(**cfg.model.backbone)
self.decode_head = UPerHead(**cfg.model.decode_head)
def forward(self, x):
feat = self.backbone(x)
outs = self.decode_head(feat)
return outs
‘’‘
’‘’
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).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
我想将mmpretrain的模型拿出来,放入自己写的模型当作backbone,但是在训练的时候,报错backbone不能参与梯度计算。
’‘’
class UpernetDniov2(nn.Module):
def init(self, cfg, *args, **kwargs) -> None:
super().init(*args, **kwargs)
self.backbone = VisionTransformer(**cfg.model.backbone)
self.decode_head = UPerHead(**cfg.model.decode_head)
def forward(self, x):
feat = self.backbone(x)
outs = self.decode_head(feat)
return outs
‘’‘
’‘’
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
totorch.nn.parallel.DistributedDataParallel
, and bymaking 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 offorward
of your module when reporting this issue (e.g. list, dict, iterable).Parameter indices which did not receive grad for rank 1: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...
‘’‘
Beta Was this translation helpful? Give feedback.
All reactions