Closed dbogunowicz closed 1 year ago
Hi @dbogunowicz Could you let us know if this is still a known issue? Thank you. -Jeannie / Neural Magic
Hey, @jeanniefinks. Yeah, this issue is still valid. We have managed to suppress it by pinning the numpy version across all the repos. However, once we decide to upgrade numpy, this problem will strike back. There is a PR opened to fix this problem, but sadly I did not get a chance to work on it for a while now: https://github.com/neuralmagic/deepsparse/pull/827
This has been addressed so I'll be closing this thread. Thank you!
Describe the bug
Transformers QA pipeline fails on a simple inference task.
Expected behavior The inference pipeline for Question Answering should work without raising any errors.
Environment Python version: 3.8 DeepSparse version: current main
To Reproduce
Errors
Additional context The error occurs in https://github.com/neuralmagic/deepsparse/blob/main/src/deepsparse/transformers/pipelines/question_answering.py#L260.
When attempting to perform dictionary comprehension:
Here:
self.onnx_input_names = ['input_ids', 'attention_mask', 'token_type_ids']
tokenized_example.keys() = ['input_ids', 'token_type_ids', 'attention_mask', 'special_tokens_mask', 'offset_mapping', 'overflow_to_sample_mapping', 'example_id']
As a result, we end up iterating over the list difference. One element of this resulting list,
offset_mapping
is the culprit:results in :
Calling
numpy.array(...)
on this data structure envokes the error in question.Interestingly, when @mwitiderrick attempted to reproduce an error inside the collab notebook (not using the main, but the last release), the problem disappears: https://colab.research.google.com/drive/1aIrITYxgcR-5VmL4vm8P-6H4rvCBAeaX?usp=sharing However, it reappears (on the last release) when he attempted to run transformers QA pipeline in HF/Gradio: https://huggingface.co/spaces/neuralmagic/question-answering/blob/main/app.py