Instructions to use impira/layoutlm-document-qa with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use impira/layoutlm-document-qa with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("document-question-answering", model="impira/layoutlm-document-qa")# Load model directly from transformers import AutoTokenizer, AutoModelForDocumentQuestionAnswering tokenizer = AutoTokenizer.from_pretrained("impira/layoutlm-document-qa") model = AutoModelForDocumentQuestionAnswering.from_pretrained("impira/layoutlm-document-qa") - Notebooks
- Google Colab
- Kaggle
Are Image features used in this LayoutLM based model?
Hello,
Just saw the code for LayoutLMForQuestionAnswering here: https://github.com/huggingface/transformers/blob/f1e8c48c5eebf899a5c79b2c48c0ef8456e6bddc/src/transformers/models/layoutlm/modeling_layoutlm.py#L1248
I don't think the document image features are used anywhere here but Image is a non-Optional argument in the DocumentQuestionAnsweringPipeline here:
https://github.com/huggingface/transformers/blob/b2c863a3196150850d17548f25ee0575bccb8224/src/transformers/pipelines/document_question_answering.py#L188
I get that it maybe is needed for OCR(tesseract) but if I provide word_boxes and use a LayoutLM(v1) based model, Image features should have no use.
So just want to confirm if image features are actually being used in this LayoutLM(v1) based model?
Thanks :)
You can provide None for the images for LayoutLMv1, and the pipeline will succeed (as long as you provide word_boxes).