Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in setting newspaper model #284

Open
szekrenyesi opened this issue Feb 12, 2024 · 6 comments
Open

Error in setting newspaper model #284

szekrenyesi opened this issue Feb 12, 2024 · 6 comments
Labels
dependencies Pull requests that update a dependency file

Comments

@szekrenyesi
Copy link

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
Copy link
Contributor

JaMe76 commented Feb 12, 2024

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
Copy link
Author

Hi, It's 0.23

@JaMe76
Copy link
Contributor

JaMe76 commented Feb 12, 2024

That’s the problem.

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

@JaMe76 JaMe76 added the answered Issue answered or reacted label Feb 12, 2024
@szekrenyesi
Copy link
Author

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
Copy link
Author

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

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

@muruguru
Copy link

I see the same issue with 0.30 version

@JaMe76 JaMe76 added dependencies Pull requests that update a dependency file and removed answered Issue answered or reacted labels Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

3 participants