# Error on pipeline with docquery (Transformers)

**URL:** <https://discuss.huggingface.co/t/error-on-pipeline-with-docquery-transformers/39672>\
**Category:** 🤗Transformers\
**Created:** [May 12, 2023, 3:51pm UTC](https://discuss.huggingface.co/t/error-on-pipeline-with-docquery-transformers/39672 "2023-05-12T15:51:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jack-cpu](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@Jack-cpu](https://discuss.huggingface.co/u/Jack-cpu)\
**Post date:** [May 12, 2023, 3:51pm UTC](https://discuss.huggingface.co/t/error-on-pipeline-with-docquery-transformers/39672/1 "2023-05-12T15:51:11Z")

</div>

Hello,

I’ve tried to implement docquery with different models like impira/layoutlm-invoices but I always have the same error (on collab notebook or pycharm, windows or ubuntu always the same):

Code :  
from docquery import document, pipeline

p = pipeline(task=‘document-question-answering’, model = “impira/layoutlm-invoices”)  
doc = document.load\_document(file)  
s = p(question=“What is the invoice number?”, \*\*doc.context)

Error :

Exception Traceback (most recent call last)  
Cell In[76], line 5  
3 p = pipeline(task=‘document-question-answering’, model = “impira/layoutlm-invoices”)  
4 doc = document.load\_document(file)  
----\> 5 s = p(question=“What is the invoice number?”, \*\*doc.context)

File ~\Documents\GitHub\Llama\venv\lib\site-packages\docquery\ext\pipeline\_document\_question\_answering.py:232, in DocumentQuestionAnsweringPipeline. **call** (self, image, question, \*\*kwargs)  
229 else:  
230 normalized\_images = [(image, None)]  
 → 232 return super(). **call** ({“question”: question, “pages”: normalized\_images}, \*\*kwargs)

File ~\Documents\GitHub\Llama\venv\lib\site-packages\transformers\pipelines\base.py:1111, in Pipeline. **call** (self, inputs, num\_workers, batch\_size, \*args, \*\*kwargs)  
1109 return self.iterate(inputs, preprocess\_params, forward\_params, postprocess\_params)  
1110 elif self.framework == “pt” and isinstance(self, ChunkPipeline):  
 → 1111 return next(  
1112 iter(  
1113 self.get\_iterator(  
1114 [inputs], num\_workers, batch\_size, preprocess\_params, forward\_params, postprocess\_params  
1115 )  
1116 )  
1117 )  
1118 else:  
1119 return self.run\_single(inputs, preprocess\_params, forward\_params, postprocess\_params)

File ~\Documents\GitHub\Llama\venv\lib\site-packages\transformers\pipelines\pt\_utils.py:124, in PipelineIterator. **next** (self)  
121 return self.loader\_batch\_item()  
123 # We’re out of items within a batch  
 → 124 item = next(self.iterator)  
125 processed = self.infer(item, \*\*self.params)  
126 # We now have a batch of “inferred things”.

File ~\Documents\GitHub\Llama\venv\lib\site-packages\transformers\pipelines\pt\_utils.py:291, in PipelinePackIterator. **next** (self)  
289 else:  
290 item = processed  
 → 291 is\_last = item.pop(“is\_last”)  
292 accumulator.append(item)  
293 return accumulator

File ~\Documents\GitHub\Llama\venv\lib\site-packages\transformers\utils\generic.py:310, in ModelOutput.pop(self, \*args, \*\*kwargs)  
309 def pop(self, \*args, \*\*kwargs):  
 → 310 raise Exception(f"You cannot use `pop` on a {self. **class**. **name** } instance.")

Exception: You cannot use `pop` on a ModelOutput instance.

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![noexiste](https://avatars.discourse-cdn.com/v4/letter/n/f1d935/32.png) [@noexiste](https://discuss.huggingface.co/u/noexiste)\
**Post date:** [June 2, 2023, 9:32am UTC](https://discuss.huggingface.co/t/error-on-pipeline-with-docquery-transformers/39672/2 "2023-06-02T09:32:21Z")

</div>

I had the same error and was able to get rid of it by downgrading the transformers library like this:

```auto
pip uninstall transformers
pip install transformers==4.23

```

---

<div class="post-metadata">

**Author:** ![Jack-cpu](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@Jack-cpu](https://discuss.huggingface.co/u/Jack-cpu)\
**Post date:** [June 5, 2023, 11:49am UTC](https://discuss.huggingface.co/t/error-on-pipeline-with-docquery-transformers/39672/3 "2023-06-05T11:49:33Z")

</div>

Thank you, it works
