stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: codeformer - RuntimeError: unexpected EOF, expected X more bytes. The file might be corrupted.

Open alamanxp opened this issue 2 years ago • 8 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits

What happened?

When I select face restoration, the console can see that it is downloading, and then he tells me that it is not the right size?

Steps to reproduce the problem

1.Check face restoration 2.Download codeformer-v0.1.0.pth 3. error

What should have happened?

It should run normally after downloading

Commit where the problem happens

0cc0ee1

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

YES
@echo off
set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS= --listen
call webui.bat

List of extensions

yes https://github.com/dtlnor/stable-diffusion-webui-localization-zh_CN.git

Console logs

To create a public link, set `share=True` in `launch()`.
100%|██████████████████████████████████████████████████████████████████████████████████| 20/20 [00:04<00:00,  4.90it/s]
Downloading: "https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth" to F:\Noviai\newsteble\new\stable-diffusion-webui-master\models\Codeformer\codeformer-v0.1.0.pth

100%|███████████████████████████████████████████████████████████████████████████████| 359M/359M [00:16<00:00, 23.2MB/s]
Error completing request
Arguments: ('task(yap3w3yng0gndcu)', 'AI', '', [], 20, 0, True, False, 1, 1, 7, -1.0, -1.0, 0, 0, 0, False, 512, 512, False, 0.7, 2, 'Latent', 0, 0, 0, [], 0, False, False, 'positive', 'comma', 0, False, False, '', 1, '', 0, '', 0, '', True, False, False, False, 0) {}
Traceback (most recent call last):
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\modules\call_queue.py", line 56, in f
    res = list(func(*args, **kwargs))
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\modules\call_queue.py", line 37, in f
    res = func(*args, **kwargs)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\modules\txt2img.py", line 56, in txt2img
    processed = process_images(p)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\modules\processing.py", line 486, in process_images
    res = process_images_inner(p)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\modules\processing.py", line 661, in process_images_inner
    x_sample = modules.face_restoration.restore_faces(x_sample)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\modules\face_restoration.py", line 19, in restore_faces
    return face_restorer.restore(np_image)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\modules\codeformer_model.py", line 88, in restore
    self.create_models()
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\modules\codeformer_model.py", line 71, in create_models
    face_helper = FaceRestoreHelper(1, face_size=512, crop_ratio=(1, 1), det_model='retinaface_resnet50', save_ext='png', use_parse=True, device=devices.device_codeformer)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\repositories\CodeFormer\facelib\utils\face_restoration_helper.py", line 105, in __init__
    self.face_det = init_detection_model(det_model, half=False, device=self.device)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\repositories\CodeFormer\facelib\detection\__init__.py", line 16, in init_detection_model
    model = init_retinaface_model(model_name, half, device)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\repositories\CodeFormer\facelib\detection\__init__.py", line 36, in init_retinaface_model
    load_net = torch.load(model_path, map_location=lambda storage, loc: storage)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\modules\safe.py", line 106, in load
    return load_with_extra(filename, extra_handler=global_extra_handler, *args, **kwargs)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\modules\safe.py", line 151, in load_with_extra
    return unsafe_torch_load(filename, *args, **kwargs)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\venv\lib\site-packages\torch\serialization.py", line 795, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "F:\Noviai\newsteble\new\stable-diffusion-webui-master\venv\lib\site-packages\torch\serialization.py", line 1020, in _legacy_load
    typed_storage._storage._set_from_file(
RuntimeError: unexpected EOF, expected 375406 more bytes. The file might be corrupted.

Additional information

No response

alamanxp avatar Feb 27 '23 02:02 alamanxp

+1 same bug occured

fuacici avatar Mar 03 '23 00:03 fuacici

+1

shijunti19 avatar Mar 04 '23 04:03 shijunti19

https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/4951

Samyak404 avatar Mar 04 '23 09:03 Samyak404

set COMMANDLINE_ARGS= --xformers, 也出现同样的错误

hfhfn avatar Mar 07 '23 10:03 hfhfn

stable-diffusion-webui\repositories\CodeFormer\weights\facelib File directory under detection_Resnet50_Final.pth Error, suggest retry

notebook-mi avatar Mar 16 '23 08:03 notebook-mi

#4951

It works! I find my parsing_parsenet.pth at "stable-diffusion-webui\repositories\CodeFormer\weights\facelib" is only 12.5MB, and it should be 81.3MB. I guess the connection was dropped while downloading the file through e.g. a VPN.

YuSitong1999 avatar Apr 05 '23 13:04 YuSitong1999

delect stable-diffusion-webui/models/GFPGAN mkdir stable-diffusion-webui/models/GFPGAN

run

pangzheng avatar Jun 08 '23 10:06 pangzheng

Thanks @pangzheng , thats worked for me!

macedobernardo avatar Jun 20 '23 01:06 macedobernardo

Same mistake

wen2034 avatar Jul 13 '23 06:07 wen2034

delect stable-diffusion-webui/models/GFPGAN mkdir stable-diffusion-webui/models/GFPGAN

run

it works. but why??

shihaiyang-world avatar Jan 09 '24 13:01 shihaiyang-world