RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
Machao-be-simple opened this issue · 6 comments
Great work, but I get this error when I try to run the demo. I looked it up because the file XrayPULSE_ckpt.pth is corrupted. Can you reproduce it using the provided file 'XrayPULSE_ckpt.pth'?
Can you provide me with the running environment?
Can you provide me with the running environment?
I built the environment using conda and successfully ran the following two commands:
conda env create -f env.yml
conda activate xraypulse
Perhaps you could tell me what further specific environmental information I can provide you?
/home/cma/miniconda3/envs/xraypulse/lib/python3.9/site-packages/torchvision/io/image.py:13: UserWarning: Failed to load image Python extension: libtorch_cuda_cu.so: cannot open shared object file: No such file or directory
warn(f"Failed to load image Python extension: {e}")
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/cma/code/XrayPULSE/demo.py:62 in │
│ │
│ 59 model_config.device_8bit = args.gpu_id │
│ 60 model_cls = registry.get_model_class(model_config.arch) │
│ 61 print(model_cls) │
│ ❱ 62 model = model_cls.from_config(model_config).to('cuda:{}'.format(args.gpu_id)) │
│ 63 │
│ 64 vis_processor_cfg = cfg.datasets_cfg.openi.vis_processor.train │
│ 65 vis_processor = registry.get_processor_class(vis_processor_cfg.name).from_config(vis_pro │
│ │
│ /home/cma/code/XrayPULSE/xraypulse/models/xray_pulse.py:348 in from_config │
│ │
│ 345 │ │ max_txt_len = cfg.get("max_txt_len", 32) │
│ 346 │ │ end_sym = cfg.get("end_sym", '\n') │
│ 347 │ │ │
│ ❱ 348 │ │ model = cls( │
│ 349 │ │ │ vit_model=vit_model, │
│ 350 │ │ │ q_former_model=q_former_model, │
│ 351 │ │ │ img_size=img_size, │
│ │
│ /home/cma/code/XrayPULSE/xraypulse/models/xray_pulse.py:71 in init │
│ │
│ 68 │ │ self.low_resource = low_resource │
│ 69 │ │ │
│ 70 │ │ print('Loading VIT') │
│ ❱ 71 │ │ self.visual_encoder, self.ln_vision = self.init_vision_encoder( │
│ 72 │ │ │ vit_model, img_size, drop_path_rate, use_grad_checkpoint, vit_precision │
│ 73 │ │ ) │
│ 74 │ │ if freeze_vit: │
│ │
│ /home/cma/code/XrayPULSE/xraypulse/models/blip2.py:65 in init_vision_encoder │
│ │
│ 62 │ │ cls, model_name, img_size, drop_path_rate, use_grad_checkpoint, precision │
│ 63 │ ): │
│ 64 │ │ assert model_name == "eva_clip_g", "vit model must be eva_clip_g for current ver │
│ ❱ 65 │ │ visual_encoder = create_eva_vit_g( │
│ 66 │ │ │ img_size, drop_path_rate, use_grad_checkpoint, precision │
│ 67 │ │ ) │
│ 68 │
│ │
│ /home/cma/code/XrayPULSE/xraypulse/models/eva_vit.py:433 in create_eva_vit_g │
│ │
│ 430 │ cached_file = download_cached_file( │
│ 431 │ │ url, check_hash=False, progress=True │
│ 432 │ ) │
│ ❱ 433 │ state_dict = torch.load(cached_file, map_location="cpu") │
│ 434 │ interpolate_pos_embed(model,state_dict) │
│ 435 │ │
│ 436 │ incompatible_keys = model.load_state_dict(state_dict, strict=False) │
│ │
│ /home/cma/miniconda3/envs/xraypulse/lib/python3.9/site-packages/torch/serialization.py:797 in │
│ load │
│ │
│ 794 │ │ │ # If we want to actually tail call to torch.jit.load, we need to │
│ 795 │ │ │ # reset back to the original position. │
│ 796 │ │ │ orig_position = opened_file.tell() │
│ ❱ 797 │ │ │ with _open_zipfile_reader(opened_file) as opened_zipfile: │
│ 798 │ │ │ │ if _is_torchscript_zip(opened_zipfile): │
│ 799 │ │ │ │ │ warnings.warn("'torch.load' received a zip file that looks like a To │
│ 800 │ │ │ │ │ │ │ │ " dispatching to 'torch.jit.load' (call 'torch.jit.loa │
│ │
│ /home/cma/miniconda3/envs/xraypulse/lib/python3.9/site-packages/torch/serialization.py:283 in │
│ init │
│ │
│ 280 │
│ 281 class _open_zipfile_reader(_opener): │
│ 282 │ def init(self, name_or_buffer) -> None: │
│ ❱ 283 │ │ super().init(torch._C.PyTorchFileReader(name_or_buffer)) │
│ 284 │
│ 285 │
│ 286 class _open_zipfile_writer_file(_opener): │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory
This is the detailed error message.
Can you provide me with your system environment? And this problem may be caused by failing to download the
"https://storage.googleapis.com/sfr-vision-language-research/LAVIS/models/BLIP2/eva_vit_g.pth", you can check your network connection or download it offline.
Can you provide me with your system environment? And this problem may be caused by failing to download the "https://storage.googleapis.com/sfr-vision-language-research/LAVIS/models/BLIP2/eva_vit_g.pth", you can check your network connection or download it offline.
Thanks again. It was done after I downloaded the file you mentioned offline, so it seems that the file was not completely downloaded before.