So I am copying the exact code from the tutorial from
https://huggingface.co/docs/transformers/model_doc/lxmert#transformers.LxmertForQuestionAnswering.
Why am I getting this error ?
File “C:\Users\Utilizador\anaconda3\envs\IST_DL21_Env\lib\site-packages\torch\nn\modules\module.py”, line 1102, in _call_impl
return forward_call(*input, **kwargs)
TypeError: forward() got an unexpected keyword argument ‘start_positions’
from transformers import LxmertTokenizer, LxmertForQuestionAnswering
import torch
tokenizer = LxmertTokenizer.from_pretrained("unc-nlp/lxmert-base-uncased")
model = LxmertForQuestionAnswering.from_pretrained("unc-nlp/lxmert-base-uncased")
question, text = "Who was Jim Henson?", "Jim Henson was a nice puppet"
inputs = tokenizer(question, text, return_tensors="pt")
start_positions = torch.tensor([1])
end_positions = torch.tensor([3])
outputs = model(**inputs, start_positions=start_positions, end_positions=end_positions)
loss = outputs.loss
start_scores = outputs.start_logits
end_scores = outputs.end_logits