AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
139.14k stars 26.41k forks source link

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

Open alamanxp opened 1 year ago

alamanxp commented 1 year ago

Is there an existing issue for this?

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

  1. 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

fuacici commented 1 year ago

+1 same bug occured

shijunti19 commented 1 year ago

+1

Samyak404 commented 1 year ago

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

hfhfn commented 1 year ago

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

notebook-mi commented 1 year ago

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

YuSitong1999 commented 1 year ago

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.

pangzheng commented 1 year ago

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

run

macedobernardo commented 1 year ago

Thanks @pangzheng , thats worked for me!

wen2034 commented 1 year ago

Same mistake

shihaiyang-world commented 8 months ago

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

run

it works. but why??