loss.backward(retain_graph=True) 报错
mrb957600057 opened this issue · 3 comments
mrb957600057 commented
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [768]] is at version 3; expected version 2 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).
请问您有遇到这个问题吗?
mrb957600057 commented
版本问题,切换到1.4没问题
lmw0320 commented
版本问题,切换到1.4没问题
请教下,如果还是保持1.5的版本,要修改哪里的代码呢?
baojunshan commented
版本问题,切换到1.4没问题
请教下,如果还是保持1.5的版本,要修改哪里的代码呢?
SoftMaskedBert/model/soft_masked_bert.py
Line 27 in 25b62c7
改成
self.mask_e = self.embedding(mask_token_id).detach()