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

File downloaded from deepdoctection/d2_casc_rcnn_X_32xd4_50_FPN_GN_2FC_publaynet_inference_only does not match the expected size #312

Open
rogerbarretocode opened this issue Apr 11, 2024 · 6 comments

Comments

@rogerbarretocode
Copy link

i read in another issue that this was solved (#290 ). in 0.31

but i am still encountering this in latest version(0.31).

the error is this :

[0411 09:49.23 @model.py:1012] ERR File downloaded from deepdoctection/d2_casc_rcnn_X_32xd4_50_FPN_GN_2FC_publaynet_inference_only does not match the expected size! You may have downloaded a broken file, or the upstream may have modified the file.
Traceback (most recent call last):
File "/home/admin/HINGES-ERP/deep2.py", line 5, in
analyzer = dd.get_dd_analyzer() # instantiate the built-in analyzer similar to the Hugging Face space demo
File "/home/admin/.local/lib/python3.10/site-packages/deepdoctection/analyzer/dd.py", line 459, in get_dd_analyzer
return build_analyzer(cfg)
File "/home/admin/.local/lib/python3.10/site-packages/deepdoctection/analyzer/dd.py", line 274, in build_analyzer
d_layout = build_detector(cfg, "LAYOUT")
File "/home/admin/.local/lib/python3.10/site-packages/deepdoctection/analyzer/dd.py", line 153, in build_detector
return D2FrcnnTracingDetector(config_path, weights_path, categories, filter_categories=filter_categories)
NameError: name 'D2FrcnnTracingDetector' is not defined

can someone please suggest a solution ?

i am running on ubuntu

@JaMe76
Copy link
Contributor

JaMe76 commented Apr 11, 2024

This NameError generally pops up if something is not installed. In this case I suppose that PyTorch is missing.

Check, if

import deepdoctection as dd

print(dd.pytorch_available())

prints True. If not, please follow the PyTorch installation guidelines.

Note, that PyTorch must be installed independently.

@damian-nplan
Copy link

I am getting a similar error, this time complaining about META_ARCHITECTURE when running this script:

import deepdoctection as dd
analyzer = dd.get_dd_analyzer()
print("Hello world")

Error:

[0411 11:56.21 @model.py:1012]  ERR  File downloaded from deepdoctection/d2_casc_rcnn_X_32xd4_50_FPN_GN_2FC_publaynet_inference_only does not match the expected size! You may have downloaded a broken file, or the upstream may have modified the file.
Traceback (most recent call last):
  File "/home/user/stextract/main.py", line 7, in <module>
    analyzer = dd.get_dd_analyzer()
  File "/home/user/.cache/pypoetry/virtualenvs/stextract-kaiB8QvC-py3.10/lib/python3.10/site-packages/deepdoctection/analyzer/dd.py", line 459, in get_dd_analyzer
    return build_analyzer(cfg)
  File "/home/user/.cache/pypoetry/virtualenvs/stextract-kaiB8QvC-py3.10/lib/python3.10/site-packages/deepdoctection/analyzer/dd.py", line 274, in build_analyzer
    d_layout = build_detector(cfg, "LAYOUT")
  File "/home/user/.cache/pypoetry/virtualenvs/stextract-kaiB8QvC-py3.10/lib/python3.10/site-packages/deepdoctection/analyzer/dd.py", line 153, in build_detector
    return D2FrcnnTracingDetector(config_path, weights_path, categories, filter_categories=filter_categories)
  File "/home/user/.cache/pypoetry/virtualenvs/stextract-kaiB8QvC-py3.10/lib/python3.10/site-packages/deepdoctection/extern/d2detect.py", line 441, in __init__
    self.name = self.get_name(path_weights, self.cfg.MODEL.META_ARCHITECTURE)
  File "/home/user/.cache/pypoetry/virtualenvs/stextract-kaiB8QvC-py3.10/lib/python3.10/site-packages/deepdoctection/utils/metacfg.py", line 46, in __getattr__
    raise AttributeError(name)
AttributeError: META_ARCHITECTURE

@rogerbarretocode
Copy link
Author

@JaMe76

when i try your suggestion it says AttributeError: module deepdoctection has no attribute pytorch_available. Did you mean: 'boto3_available'?

also i am trying to run this using tensorflow .

while using tensorflow it says that GPU is missing and all tesnforflow models require a GPU . could this be the issue ?

@JaMe76
Copy link
Contributor

JaMe76 commented Apr 11, 2024

@damian-nplan: This is something else.

The config files of layout/segmentation models have changed recently.

Unfortunately, there is no automatic way to force downloading model config files and this has to be done manually:

Download this config file from the Huggingface Hub

and replace the file with the file in your .cache, e.g. somewhere in "~/.cache/deepdoctection/configs/dd/d2/layout"

@JaMe76
Copy link
Contributor

JaMe76 commented Apr 11, 2024

@JaMe76

when i try your suggestion it says AttributeError: module deepdoctection has no attribute pytorch_available. Did you mean: 'boto3_available'?

also i am trying to run this using tensorflow .

while using tensorflow it says that GPU is missing and all tesnforflow models require a GPU . could this be the issue ?

Yes, this is likely:

deepdoctection looks what DL library has been installed. If Tensorflow is installed it will check if a GPU is available. If not it will default to Pytorch. If Pytorch is not installed the it might result in this error.

Can you try something like:

from deepdoctection.utils.file_utils import pytorch_available
from deepdoctection.utils.env_info import auto_select_lib_and_device
from os import environ

    print(pytorch_available())
    auto_select_lib_and_device()
    print(environ.get("USE_TENSORFLOW"))
    print(environ.get("USE_PYTORCH"))
    print(environ.get("USE_CUDA"))
    print(environ.get("USE_TF"))
    print(environ.get("USE_TORCH"))

and paste the output here?

@MrBerac
Copy link

MrBerac commented Apr 17, 2024

Hey @JaMe76

I'm currently working on a university project and have exactly the same error as everyone here.
The config of Huggingface is at least the same as I have already installed.

The outpunt of your code is the one here:

True
False
True
False
None
None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants