UnpicklingError: invalid load key, '\xef'.
#11
by
Sebas6k
- opened
2 days ago my code was working using colab:
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)
Now 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'.
the error is because the weights files is missing:
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'")