当前位置:   article > 正文

【已解决】RuntimeError: unexpected EOF, expected 884108 more bytes. The file might be corrupted._typed_storage._untyped_storage._set_from_file( run

typed_storage._untyped_storage._set_from_file( runtimeerror: unexpected eof,

问题描述

Traceback (most recent call last):
  File "mist_v3.py", line 342, in <module>
    config = init(epsilon=epsilon, steps=steps, mode=mode, rate=rate)
  File "mist_v3.py", line 184, in init
    model = load_model_from_config(config, ckpt_path).to(device)
  File "mist_v3.py", line 53, in load_model_from_config
    model = instantiate_from_config(config.model)
  File "/media/visionx/monica/project/modelwatermark/mist/ldm/util.py", line 85, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/media/visionx/monica/project/modelwatermark/mist/ldm/models/diffusion/ddpmAttack.py", line 460, in __init__
    self.instantiate_cond_stage(cond_stage_config)
  File "/media/visionx/monica/project/modelwatermark/mist/ldm/models/diffusion/ddpmAttack.py", line 518, in instantiate_cond_stage
    model = instantiate_from_config(config)
  File "/media/visionx/monica/project/modelwatermark/mist/ldm/util.py", line 85, in instantiate_from_config
    return get_obj_from_str(config["target"])(**config.get("params", dict()))
  File "/media/visionx/monica/project/modelwatermark/mist/ldm/util.py", line 93, in get_obj_from_str
    return getattr(importlib.import_module(module, package=None), cls)
  File "/home/visionx/anaconda3/envs/mist/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 "/media/visionx/monica/project/modelwatermark/mist/ldm/modules/encoders/modules.py", line 7, in <module>
    import kornia
  File "/home/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/kornia/__init__.py", line 10, in <module>
    from . import (
  File "/home/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/kornia/augmentation/__init__.py", line 43, in <module>
    from .container import AugmentationSequential, ImageSequential, PatchSequential, VideoSequential
  File "/home/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/kornia/augmentation/container/__init__.py", line 1, in <module>
    from .augment import AugmentationSequential
  File "/home/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/kornia/augmentation/container/augment.py", line 17, in <module>
    from .patch import PatchSequential
  File "/home/visionx/anaconda3/envs/mist/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/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/kornia/contrib/__init__.py", line 4, in <module>
    from .image_stitching import ImageStitcher
  File "/home/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/kornia/contrib/image_stitching.py", line 7, in <module>
    from kornia.feature import LocalFeatureMatcher, LoFTR
  File "/home/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/kornia/feature/__init__.py", line 4, in <module>
    from .integrated import (
  File "/home/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/kornia/feature/integrated.py", line 52, in <module>
    class LAFDescriptor(nn.Module):
  File "/home/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/kornia/feature/integrated.py", line 65, in LAFDescriptor
    patch_descriptor_module: nn.Module = HardNet(True),
  File "/home/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/kornia/feature/hardnet.py", line 66, in __init__
    pretrained_dict = torch.hub.load_state_dict_from_url(
  File "/home/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/torch/hub.py", line 595, in load_state_dict_from_url
    return torch.load(cached_file, map_location=map_location)
  File "/home/visionx/anaconda3/envs/mist/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/visionx/anaconda3/envs/mist/lib/python3.8/site-packages/torch/serialization.py", line 938, in _legacy_load
    typed_storage._storage._set_from_file(
RuntimeError: unexpected EOF, expected 884108 more bytes. The file might be corrupted.
 

问题解决

        这个是因为下载的模型文件损坏了,因为我这个只有modle.pt,所以肯定是这个文件有损坏,这个时候只要重新下载就可以了

wget -c https://huggingface.co/CompVis/stable-diffusion-v-1-4-original/resolve/main/sd-v1-4.ckpt

延伸阅读 

问题一:预训练权重文件损坏

        在使用深度学习训练时,运行trian.py文件,代码会自动连网下载预训练权重文件,由于权重文件一般在外网,网络不稳定,下载速度特别慢,下载失败后再次运行train.py文件就会提示出错,错误如下:RuntimeError: unexpected EOF, expected 441443 more bytes. The file might be corrupted出现这种情况的主要原因是第一次运行代码下载了部分预训练权重文件,因网络不稳定等原因中断了,就导致下载的权重文件损坏了,如果想重新下载,就必须删除最开始下载的损坏权重文件。那最开始下载的权重文件被自动保存到了哪个路径下呢?我们要注意第一次下载权重文件时的提示,会告诉你它保存到了哪个路径下

问题二:预训练权重文件多次下载失败

        学者如果删除了破损权重文件后,再次运行train.py后会重新下载权重文件,可能还是会下载失败,推荐学者将下载权重文件的下载链接直接复制到迅雷里面下载,速度很快,将下载好的权重文件在复制到最开始默认保存的位置,再运行代码就没问题了。


版权声明:本文为CSDN博主「佐咖」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:问题:RuntimeError: unexpected EOF, expected 441443 more bytes. The file might be corrupted.解决方法-CSDN博客文章浏览阅读6.7k次,点赞16次,收藏17次。在使用深度学习训练时,运行trian.py文件,代码会自动连网下载预训练权重文件,由于权重文件一般在外网,网络不稳定,下载速度特别慢,下载失败后再次运行train.py文件就会提示出错,错误如下:RuntimeError: unexpected EOF, expected 441443 more bytes. The file might be corruptedhttps://blog.csdn.net/qq_40280673/article/details/126664656

完结撒花

        人啊,生于尘土,又归于尘土,但这其间的经历却让我们受益良多。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/524280
推荐阅读
相关标签
  

闽ICP备14008679号