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
Import ERROR
RuntimeError: Failed to import transformers.models.layoutlm.modeling_tf_layoutlm because of the following error (look up to see its traceback):
No module named 'keras.saving.hdf5_format'
when i ran the program,
ImportError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
1030 def is_timm_available():
-> 1031 return _timm_available
1032
26 frames
ImportError: cannot import name 'GENERATION_CONFIG_NAME' from 'transformers.utils' (/usr/local/lib/python3.10/dist-packages/transformers/utils/init.py)
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
RuntimeError: Failed to import transformers.generation.configuration_utils because of the following error (look up to see its traceback):
cannot import name 'GENERATION_CONFIG_NAME' from 'transformers.utils' (/usr/local/lib/python3.10/dist-packages/transformers/utils/init.py)
The above exception was the direct cause of the following exception:
RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.10/dist-packages/transformers/utils/import_utils.py in _get_module(self, module_name)
1031 return _timm_available
1032
-> 1033
1034 def is_natten_available():
1035 return _natten_available
RuntimeError: Failed to import transformers.models.layoutlm.modeling_tf_layoutlm because of the following error (look up to see its traceback):
Failed to import transformers.generation.configuration_utils because of the following error (look up to see its traceback):
cannot import name 'GENERATION_CONFIG_NAME' from 'transformers.utils' (/usr/local/lib/python3.10/dist-packages/transformers/utils/init.py)