deepdoctection / deepdoctection

A Repo For Document AI
Apache License 2.0
2.41k stars 122 forks source link

Error in setting newspaper model #284

Open szekrenyesi opened 5 months ago

szekrenyesi commented 5 months ago

Hi, when I try to initialize the Newspaper extension, I got this error:

page_parser = dd.PageParsingService(text_container = dd.LayoutType.word, floating_text_block_categories=[layout_item for layout_item in NewspaperExtension]) TypeError: init() got an unexpected keyword argument 'floating_text_block_categories'

JaMe76 commented 5 months ago

Hi, may I ask what deepdoctection version you are using?

The


import deepdoctection as dd

print(dd.__version__)

PageParsingService arguments haven't changed for a long time.

szekrenyesi commented 5 months ago

Hi, It's 0.23

JaMe76 commented 5 months ago

That’s the problem.

Please upgrade to the latest release, e.g. 0.29

szekrenyesi commented 5 months ago

Thanks! yes, the upgrade helped. However, now I have another issue. Could you help which version of Pillow (or other fix) needed to resolve?

Traceback (most recent call last): File "test_new.py", line 27, in dd.ModelCatalog.register("layoutparser/newspaper/model_final.pth",dd.ModelProfile( File "/data/aramis/Environments/layout/deepdocdetection/lib/python3.8/site-packages/deepdoctection/utils/file_utils.py", line 693, in getattr module = self._get_module(self._class_to_module[name]) File "/data/aramis/Environments/layout/deepdocdetection/lib/python3.8/site-packages/deepdoctection/utils/file_utils.py", line 703, in _get_module return importlib.import_module("." + module_name, self.name) File "/data/aramis/Environments/layout/deepdocdetection/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "/data/aramis/Environments/layout/deepdocdetection/lib/python3.8/site-packages/deepdoctection/extern/init.py", line 28, in from .hflayoutlm import * File "/data/aramis/Environments/layout/deepdocdetection/lib/python3.8/site-packages/deepdoctection/extern/hflayoutlm.py", line 56, in from transformers import ( File "", line 1039, in _handle_fromlist File "/data/aramis/Environments/layout/deepdocdetection/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 1355, in getattr value = getattr(module, name) File "/data/aramis/Environments/layout/deepdocdetection/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 1354, in getattr module = self._get_module(self._class_to_module[name]) File "/data/aramis/Environments/layout/deepdocdetection/lib/python3.8/site-packages/transformers/utils/import_utils.py", line 1366, in _get_module raise RuntimeError( RuntimeError: Failed to import transformers.models.layoutlmv2.modeling_layoutlmv2 because of the following error (look up to see its traceback): module 'PIL.Image' has no attribute 'LINEAR'

szekrenyesi commented 5 months ago

If I downgrade to Pillow==9.5 Then I got this:

ImportError: cannot import name 'convert_to_tensor' from 'tensorflow' (unknown location)

muruguru commented 4 months ago

I see the same issue with 0.30 version