解决Bert 报错:AttributeError: ‘str‘ object has no attribute ‘softmax‘

解决Bert 报错:AttributeError: ‘str’ object has no attribute ‘softmax’解决Bert 报错:AttributeError: ‘str‘ object has no attribute ‘softmax‘_第1张图片
需要将这里改为:

output= self.bert(input_ids = batch_seqs, attention_mask = batch_seq_masks,token_type_ids=batch_seq_segments, labels = labels)
loss = output.loss
logits = output.logits

你可能感兴趣的:(python3,pytorch)