Stability-AI / stablediffusion

High-Resolution Image Synthesis with Latent Diffusion Models
MIT License
39.29k stars 5.06k forks source link

RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory #413

Open Epiphanier opened 1 month ago

Epiphanier commented 1 month ago

When I run this command "python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt /home/wangyq/Projects/stablediffusion/checkpoints/v2-1_768-ema-pruned.ckpt --config /home/wangyq/Projects/stablediffusion/configs/stable-diffusion/v2-inference-v.yaml --H 768 --W 768", the following error occurred:

(stable_diffusion) [wangyq@gpu-a100-47 stablediffusion]$ python scripts/txt2img.py --prompt "a professional photograph of an astronaut riding a horse" --ckpt /home/wangyq/Projects/stablediffusion/checkpoints/v2-1_768-ema-pruned.ckpt --config /home/wangyq/Projects/stablediffusion/configs/stable-diffusion/v2-inference-v.yaml --H 768 --W 768 Global seed set to 42 Loading model from /home/wangyq/Projects/stablediffusion/checkpoints/v2-1_768-ema-pruned.ckpt /home/wangyq/Projects/stablediffusion/scripts/txt2img.py:32: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. pl_sd = torch.load(ckpt, map_location="cpu") Global Step: 110000 No module 'xformers'. Proceeding without it. LatentDiffusion: Running in v-prediction mode DiffusionWrapper has 865.91 M params. making attention of type 'vanilla' with 512 in_channels Working with z of shape (1, 4, 32, 32) = 4096 dimensions. making attention of type 'vanilla' with 512 in_channels /home/wangyq/anaconda3/envs/stable_diffusion/lib/python3.9/site-packages/torch/cuda/init.py:129: UserWarning: CUDA initialization: The NVIDIA driver on your system is too old (found version 11000). Please update your GPU driver by downloading and installing a new version from the URL: http://www.nvidia.com/Download/index.aspx Alternatively, go to: https://pytorch.org to install a PyTorch version that has been compiled with your version of the CUDA driver. (Triggered internally at ../c10/cuda/CUDAFunctions.cpp:108.) return torch._C._cuda_getDeviceCount() > 0 /home/wangyq/anaconda3/envs/stable_diffusion/lib/python3.9/site-packages/open_clip/factory.py:80: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(checkpoint_path, map_location=map_location) Traceback (most recent call last): File "/home/wangyq/Projects/stablediffusion/scripts/txt2img.py", line 402, in main(opt) File "/home/wangyq/Projects/stablediffusion/scripts/txt2img.py", line 223, in main model = load_model_from_config(config, f"{opt.ckpt}", device) File "/home/wangyq/Projects/stablediffusion/scripts/txt2img.py", line 36, in load_model_from_config model = instantiate_from_config(config.model) File "/home/wangyq/Projects/stablediffusion/ldm/util.py", line 89, in instantiate_from_config return get_obj_from_str(config["target"])(config.get("params", dict())) File "/home/wangyq/Projects/stablediffusion/ldm/models/diffusion/ddpm.py", line 563, in init self.instantiate_cond_stage(cond_stage_config) File "/home/wangyq/Projects/stablediffusion/ldm/models/diffusion/ddpm.py", line 630, in instantiate_cond_stage model = instantiate_from_config(config) File "/home/wangyq/Projects/stablediffusion/ldm/util.py", line 89, in instantiate_from_config return get_obj_from_str(config["target"])(config.get("params", dict())) File "/home/wangyq/Projects/stablediffusion/ldm/modules/encoders/modules.py", line 190, in init model, , = open_clip.create_model_and_transforms(arch, device=torch.device('cpu'), pretrained=version) File "/home/wangyq/anaconda3/envs/stable_diffusion/lib/python3.9/site-packages/open_clip/factory.py", line 197, in create_model_and_transforms model = create_model( File "/home/wangyq/anaconda3/envs/stable_diffusion/lib/python3.9/site-packages/open_clip/factory.py", line 162, in create_model load_checkpoint(model, checkpoint_path) File "/home/wangyq/anaconda3/envs/stable_diffusion/lib/python3.9/site-packages/open_clip/factory.py", line 91, in load_checkpoint state_dict = load_state_dict(checkpoint_path) File "/home/wangyq/anaconda3/envs/stable_diffusion/lib/python3.9/site-packages/open_clip/factory.py", line 80, in load_state_dict checkpoint = torch.load(checkpoint_path, map_location=map_location) File "/home/wangyq/anaconda3/envs/stable_diffusion/lib/python3.9/site-packages/torch/serialization.py", line 1326, in load with _open_zipfile_reader(opened_file) as opened_zipfile: File "/home/wangyq/anaconda3/envs/stable_diffusion/lib/python3.9/site-packages/torch/serialization.py", line 671, in init super().init(torch._C.PyTorchFileReader(name_or_buffer)) RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

And I searched this issue on Github, only find it likely to be a corrupted checkpoint files problem, but I have tried many times to redownload different files completely without interruption, still this problem exists.

Does anybody know the reason? Thank you so much!