Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'list' object has no attribute 'tolist error while using 'deepset/xlm-roberta-large-squad2' #13869

Closed
Nahid-tjk opened this issue Oct 5, 2021 · 3 comments

Comments

@Nahid-tjk
Copy link

Hi there,

I am using 'deepset/xlm-roberta-large-squad2' for Question Answering prediction on my own dataset using transformers QuestionAnsweringPipeline. I get the following error and I can't handle it as it has something to do with 'p_mask' in preprocess(self, example, padding, doc_stride, max_question_len, max_seq_len) in transformers/pipelines/question_answering.py. The error that was thrown is:

AttributeError Traceback (most recent call last)
in ()
7 for i in range(len(qa_df)):
----> 9 prediction = QA_obj.predict_answers(qa_df.loc[i,'Question'], qa_df.loc[i,'ID'], [qa_df.loc[i,'Passage']])
10 all_predictions.append(prediction)
11

4 frames
/usr/local/lib/python3.7/dist-packages/transformers/pipelines/question_answering.py in preprocess(self, example, padding, doc_stride, max_question_len, max_seq_len)
314 attention_mask=attention_mask_span_idx,
315 token_type_ids=token_type_ids_span_idx,
--> 316 p_mask=p_mask[span_idx].tolist(),
317 encoding=encoded_inputs[span_idx],
318 # We don't use the rest of the values - and actually

AttributeError: 'list' object has no attribute 'tolist'

Any help would be much appreciated.
Thanks.

@NielsRogge
Copy link
Contributor

NielsRogge commented Oct 5, 2021

Probably the same error as #13811, cc'ing @Narsil

@Narsil
Copy link
Contributor

Narsil commented Oct 5, 2021

Should be fixed by #13873 can you confirm ?

@github-actions
Copy link

github-actions bot commented Nov 4, 2021

This issue has been automatically marked as stale because it has not had recent activity. If you think this still needs to be addressed please comment on this thread.

Please note that issues that do not follow the contributing guidelines are likely to be ignored.

@Narsil Narsil closed this as completed Nov 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants