error in BERT_evel.ipynb
jxy-001 opened this issue · 2 comments
jxy-001 commented
tmp_eval_loss = loss_fct(logits.view(-1, num_labels), label_ids.view(-1))
AttributeError: 'tuple' object has no attribute 'view'
ThilinaRajapakse commented
You are getting this because you are using the updated BERT library. There the model outputs are tuples.
Change the line from:
logits = model(input_ids, segment_ids, input_mask, labels=None)
to:
logits = model(input_ids, segment_ids, input_mask, labels=None)[0]
See #9
jxy-001 commented
thanks a lot!