Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
759 views
in Technique[技术] by (71.8m points)

pytorch - pow not implemented for Half

I have this code part for training a Bert model:

from fastai.callbacks import *

learner = Learner(
    databunch, bert_model,
    loss_func=loss_func,
)

learner.lr_find() 

and facing this runtime error

/usr/local/lib/python3.6/dist-packages/pytorch_pretrained_bert/modeling.py in forward(self, x)
    240         def forward(self, x):
    241             u = x.mean(-1, keepdim=True)
--> 242             s = pow((x - u),2).mean(-1, keepdim=True)
    243             x = (x - u) / torch.sqrt(s + self.variance_epsilon)
    244             return self.weight * x + self.bias

RuntimeError: "pow" not implemented for 'Half'

How can I solve this issue? Any help would be great!

Thanks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...