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

#5
by rsml - opened

Getting this error when trying to run the qa script from 'Model Usage'. Is there a workaround?

Trace:

Traceback (most recent call last):
File "/Users/rsml/Documents/medAlpaca/test.py", line 6, in
answer = qa_pipeline({"question": question, "context": context})
File "/Users/rsml/miniconda3/lib/python3.9/site-packages/transformers/pipelines/question_answering.py", line 390, in call
return super().call(examples[0], **kwargs)
File "/Users/rsml/miniconda3/lib/python3.9/site-packages/transformers/pipelines/base.py", line 1111, in call
return next(
File "/Users/rsml/miniconda3/lib/python3.9/site-packages/transformers/pipelines/pt_utils.py", line 124, in next
item = next(self.iterator)
File "/Users/rsml/miniconda3/lib/python3.9/site-packages/transformers/pipelines/pt_utils.py", line 266, in next
processed = self.infer(next(self.iterator), **self.params)
File "/Users/rsml/miniconda3/lib/python3.9/site-packages/transformers/pipelines/base.py", line 1025, in forward
model_outputs = self._forward(model_inputs, **forward_params)
File "/Users/rsml/miniconda3/lib/python3.9/site-packages/transformers/pipelines/question_answering.py", line 513, in _forward
output = self.model(**model_inputs)
File "/Users/rsml/miniconda3/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1501, in _call_impl
return forward_call(*args, **kwargs)
TypeError: forward() got an unexpected keyword argument 'token_type_ids'

medalpaca org

Seems like the pipeline does not support the model fully. Check out the inferer on the GitHub repo.
We are slowly working on rewriting the model, so this will probably not be fixed but rather addressed in the new version.

kbressem changed discussion status to closed

Hi @kbressem , is there a MedAlpaca model that is supported by the pipeline that I can use now instead of this model?

rsml changed discussion status to open

Sign up or log in to comment