docling-project / docling-project/docling
Chart extraction failing with 2.126
- Dominant language
- Python
- Stars
- 66.4k
- Forks
- 4.8k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 84
Description
### Bug
When running the chart_extraction.py example, it is failing with the latest version of Docling 2.126. This was working with the previous version of Docling.
...
### Steps to reproduce
Run chart_extraction.py example
...
### Docling version
Docling version: 2.126.0
Docling Core version: 2.95.0
Docling IBM Models version: 4.0.2
Docling Parse version: 7.17.0
Python: cpython-313 (3.13.14)
Platform: Windows-10-10.0.19045-SP0
...
### Python version
Docling version: 2.126.0
Docling Core version: 2.95.0
Docling IBM Models version: 4.0.2
Docling Parse version: 7.17.0
Python: cpython-313 (3.13.14)
Platform: Windows-10-10.0.19045-SP0
...
The following is the output of the run of the example.
===================================
Traceback (most recent call last):
File ".venv\Lib\site-packages\docling\pipeline\base_pipeline.py", line 92, in execute
conv_res = self._enrich_document(conv_res)
File ".venv\Lib\site-packages\docling\pipeline\base_pipeline.py", line 174, in _enrich_document
for element in model(
~~~~~^
doc=conv_res.document, element_batch=element_batch
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
): # Must exhaust!
^
File ".venv\Lib\site-packages\docling\models\stages\chart_extraction\granite_vision.py", line 447, in __call__
output_ids = cast(Any, self._model).generate(
**inputs,
max_new_tokens=self._model_max_length,
use_cache=True,
)
File ".cache\huggingface\modules\transformers_modules\ibm_hyphen_granite_hyphen__hyphen_granite_hyphen_vision_hyphen_4_dot_1_hyphen_4b\e9b9d02f4da44ef1\modeling.py", line 58, in generate
return super().generate(*args, **kwargs)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File ".venv\Lib\site-packages\torch\utils\_contextlib.py", line 124, in decorate_context
return func(*args, **kwargs)
File ".venv\Lib\site-packages\transformers\generation\utils.py", line 2668, in generate
result = decoding_method(
self,
...<5 lines>...
**model_kwargs,
)
File ".venv\Lib\site-packages\transformers\generation\utils.py", line 2868, in _sample
outputs = self._prefill(
input_ids,
...<2 lines>...
is_first_iteration=not generation_config.is_assistant,
)
File ".venv\Lib\site-packages\transformers\generation\utils.py", line 3948, in _prefill
return self(**model_inputs, return_dict=True)
File ".venv\Lib\site-packages\torch\nn\modules\module.py", line 1783, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File ".venv\Lib\site-packages\torch\nn\modules\module.py", line 1794, in _call_impl
return forward_call(*args, **kwargs)
File ".venv\Lib\site-packages\transformers\utils\generic.py", line 939, in wrapper
output = func(self, *args, **kwargs)
File ".cache\huggingface\modules\transformers_modules\ibm_hyphen_granite_hyphen__hyphen_granite_hyphen_vision_hyphen_4_dot_1_hyphen_4b\e9b9d02f4da44ef1\modeling.py", line 110, in forward
outputs = self.model(input_ids, **model_kwargs, **kwargs)
File ".venv\Lib\site-packages\torch\nn\modules\module.py", line 1783, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File ".venv\Lib\site-packages\torch\nn\modules\module.py", line 1794, in _call_impl
return forward_call(*args, **kwargs)
File ".venv\Lib\site-packages\transformers\utils\generic.py", line 939, in wrapper
output = func(self, *args, **kwargs)
File ".cache\huggingface\modules\transformers_modules\ibm_hyphen_granite_hyphen__hyphen_granite_hyphen_vision_hyphen_4_dot_1_hyphen_4b\e9b9d02f4da44ef1\modeling.py", line 497, in forward
causal_mask = create_causal_mask(**mask_kwargs)
TypeError: create_causal_mask() got an unexpected keyword argument 'cache_position'
===================================
Also,
Though i specify to use local models, it is looking at .cache\huggingface\modules.
Please help with this.
Thank you
Contributor guide
Research direction
Start by running the chart_extraction.py example with Docling 2.126.0 on the reported environment and compare it with the previous Docling version. Trace the failure through base_pipeline.py and models/stages/chart_extraction/granite_vision.py, then inspect the cached Granite Vision module and model-loading behavior. Done means chart extraction runs successfully and the local-model/cache behavior is explained.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- huggingface, python, pytorch
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100