timothybrooks / instruct-pix2pix

Other
6.41k stars 542 forks source link

RuntimeError: unexpected EOF, expected 2148876 more bytes. The file might be corrupted. #88

Open Vermillion-de opened 1 year ago

Vermillion-de commented 1 year ago

Hi, Nice job! My problem is about the ckpt or pretrained, the edit_cli.py failed to load model, and out put below

(ip2p) zq@node04:~/instruct-pix2pix$ python edit_cli.py --input imgs/example.jpg --output imgs/output.jpg --edit "turn him into a cyborg"
Loading model from checkpoints/instruct-pix2pix-00-22000.ckpt
Global Step: 22000
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.53 M params.
Keeping EMAs of 688.
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
Traceback (most recent call last):
  File "edit_cli.py", line 128, in <module>
    main()
  File "edit_cli.py", line 79, in main
    model = load_model_from_config(config, args.ckpt, args.vae_ckpt)
  File "edit_cli.py", line 52, in load_model_from_config
    model = instantiate_from_config(config.model)
  File "/home/zq/instruct-pix2pix/stable_diffusion/ldm/util.py", line 85, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "./stable_diffusion/ldm/models/diffusion/ddpm_edit.py", line 489, in __init__
    self.instantiate_cond_stage(cond_stage_config)
  File "./stable_diffusion/ldm/models/diffusion/ddpm_edit.py", line 551, in instantiate_cond_stage
    model = instantiate_from_config(config)
  File "./stable_diffusion/ldm/util.py", line 85, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "./stable_diffusion/ldm/util.py", line 93, in get_obj_from_str
    return getattr(importlib.import_module(module, package=None), cls)
  File "/home/zq/.conda/envs/ip2p/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "./stable_diffusion/ldm/modules/encoders/modules.py", line 7, in <module>
    import kornia
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/__init__.py", line 10, in <module>
    from . import (
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/augmentation/__init__.py", line 43, in <module>
    from .container import AugmentationSequential, ImageSequential, PatchSequential, VideoSequential
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/augmentation/container/__init__.py", line 1, in <module>
    from .augment import AugmentationSequential
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/augmentation/container/augment.py", line 17, in <module>
    from .patch import PatchSequential
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/augmentation/container/patch.py", line 9, in <module>
    from kornia.contrib.extract_patches import extract_tensor_patches
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/contrib/__init__.py", line 4, in <module>
    from .image_stitching import ImageStitcher
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/contrib/image_stitching.py", line 7, in <module>
    from kornia.feature import LocalFeatureMatcher, LoFTR
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/feature/__init__.py", line 4, in <module>
    from .integrated import (
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/feature/integrated.py", line 52, in <module>
    class LAFDescriptor(nn.Module):
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/feature/integrated.py", line 65, in LAFDescriptor
    patch_descriptor_module: nn.Module = HardNet(True),
  File "/home/zq/.local/lib/python3.8/site-packages/kornia/feature/hardnet.py", line 66, in __init__
    pretrained_dict = torch.hub.load_state_dict_from_url(
  File "/home/zq/.local/lib/python3.8/site-packages/torch/hub.py", line 731, in load_state_dict_from_url
    return torch.load(cached_file, map_location=map_location)
  File "/home/zq/.local/lib/python3.8/site-packages/torch/serialization.py", line 713, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/home/zq/.local/lib/python3.8/site-packages/torch/serialization.py", line 938, in _legacy_load
    typed_storage._storage._set_from_file(
RuntimeError: unexpected EOF, expected 2148876 more bytes. The file might be corrupted.

The download of the files are not stable but I sucessed, and it is the same error I got every time. Wondering how to solve this.