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

UnpicklingError: invalid load key, '\xef'. #5263

Open
sebastianfernandezgarcia opened this issue Apr 19, 2024 · 2 comments
Open

UnpicklingError: invalid load key, '\xef'. #5263

sebastianfernandezgarcia opened this issue Apr 19, 2024 · 2 comments

Comments

@sebastianfernandezgarcia
Copy link

sebastianfernandezgarcia commented Apr 19, 2024

3 days ago my code was working cloning the repo and using:

from detectron2.config import CfgNode as CN
from detectron2.config import get_cfg
from detectron2.utils.visualizer import ColorMode, Visualizer
from detectron2.data import MetadataCatalog
from detectron2.engine import DefaultPredictor

cfg = get_cfg()
add_vit_config(cfg)
cfg.merge_from_file("cascade_dit_base.yml")
cfg.MODEL.WEIGHTS = "publaynet_dit-b_cascade.pth"

predictor = DefaultPredictor(cfg)

After the last commit in the repo, gives me this error:

---------------------------------------------------------------------------
UnpicklingError                           Traceback (most recent call last)
[<ipython-input-4-ffffa6d6dad1>](https://localhost:8080/#) in <cell line: 20>()
     18 
     19 # Step 4: define model
---> 20 predictor = DefaultPredictor(cfg)
     21 
     22 def analyze_image(img):

7 frames
[/usr/local/lib/python3.10/dist-packages/torch/serialization.py](https://localhost:8080/#) in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
    918             "functionality.")
    919 
--> 920     magic_number = pickle_module.load(f, **pickle_load_args)
    921     if magic_number != MAGIC_NUMBER:
    922         raise RuntimeError("Invalid magic number; corrupt file?")

UnpicklingError: invalid load key, '\xef'.

"Instructions To Reproduce the Issue and Full Logs";
Clone repo and use cfg in colab

"Your Environment";
Google colab

@github-actions github-actions bot added the needs-more-info More info is needed to complete the issue label Apr 19, 2024
Copy link

You've chosen to report an unexpected problem or bug. Unless you already know the root cause of it, please include details about it by filling the issue template.
The following information is missing: "Instructions To Reproduce the Issue and Full Logs"; "Your Environment";

@github-actions github-actions bot removed the needs-more-info More info is needed to complete the issue label Apr 19, 2024
@sebastianfernandezgarcia
Copy link
Author

The error is beacause there is a missing file when downloading some utils.

This file:
os.system("curl -LJ -o publaynet_dit-b_cascade.pth 'https://layoutlm.blob.core.windows.net/dit/dit-fts/publaynet_dit-b_cascade.pth?sv=2022-11-02&ss=b&srt=o&sp=r&se=2033-06-08T16:48:15Z&st=2023-06-08T08:48:15Z&spr=https&sig=a9VXrihTzbWyVfaIDlIT1Z0FoR1073VB0RLQUMuudD4%3D'")

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

No branches or pull requests

1 participant