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
I have a problem when I run the code loss=model(inputs,label_ids), it happens a problem of AttributeError. I have seached on Google for a long time but I can't find a key to solve it. Could you help me how to solve the problem, thank you very much.
AttributeError Traceback (most recent call last)
in ()
13 with torch.no_grad():
14 inputs,_ = basemodel(input_ids, segment_ids, input_mask)
---> 15 loss = model(inputs, label_ids)
16 loss = loss.mean()
17 loss.backward()
1 frames
in forward(self, inputs, labels)
14
15 def forward(self, inputs, labels=None):
---> 16 output = inputs.unsqueeze(1)
17 output = [nn.functional.relu(conv(output)).squeeze(3) for conv in self.convs]
18 output = [nn.functional.max_pool1d(i, i.size(2)).squeeze(2) for i in output]
AttributeError: 'str' object has no attribute 'unsqueeze'
The text was updated successfully, but these errors were encountered:
I have a problem when I run the code loss=model(inputs,label_ids), it happens a problem of AttributeError. I have seached on Google for a long time but I can't find a key to solve it. Could you help me how to solve the problem, thank you very much.
AttributeError Traceback (most recent call last)
in ()
13 with torch.no_grad():
14 inputs,_ = basemodel(input_ids, segment_ids, input_mask)
---> 15 loss = model(inputs, label_ids)
16 loss = loss.mean()
17 loss.backward()
1 frames
in forward(self, inputs, labels)
14
15 def forward(self, inputs, labels=None):
---> 16 output = inputs.unsqueeze(1)
17 output = [nn.functional.relu(conv(output)).squeeze(3) for conv in self.convs]
18 output = [nn.functional.max_pool1d(i, i.size(2)).squeeze(2) for i in output]
AttributeError: 'str' object has no attribute 'unsqueeze'
The text was updated successfully, but these errors were encountered: