transformers icon indicating copy to clipboard operation
transformers copied to clipboard

TypeError: forward() got an unexpected keyword argument 'labels'

Open Document-Data-Analyst opened this issue 3 years ago • 0 comments

In NSP training program, when training starts the TypeError occurs in the following line of code,

outputs = model(input_ids, attention_mask=attention_mask, token_type_ids=token_type_ids, labels=labels)

The Error shows as follows: /...../site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) TypeError: forward() got an unexpected keyword argument 'labels'

I reinstalled torch's latest version, even then I am getting this error. Need help to start training.

Document-Data-Analyst avatar Dec 07 '21 06:12 Document-Data-Analyst