stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: Error message when using codeformer for face restoration
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
first time I use GFPGAN, it automatically download the necessary files and the run correctly after that, but when I choose CodeFormer nothing download and I get this error message .... PS I use git pull to update to the latest version
Steps to reproduce the problem
just using CodeFormer in the settings and check the face restoration checkbox would create this error message
What should have happened?
I think it should work like GFPGAN
Commit where the problem happens
when using CodeFormer as face restooration method
What platforms do you use to access the UI ?
Windows
What browsers do you use to access the UI ?
Google Chrome
Command Line Arguments
@echo off
set PYTHON=
set GIT=
set VENV_DIR=
set COMMANDLINE_ARGS= --xformers --api
call webui.bat
List of extensions
Just Dynamic Prompt (the error happened even before installing the extension)
Console logs
venv "C:\AI\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Commit hash: ea9bd9fc7409109adcd61b897abc2c8881161256
Installing requirements for Web UI
Installing sd-dynamic-prompts requirements.txt
Launching Web UI with arguments: --xformers --api
Loading weights [cc6cb27103] from C:\AI\stable-diffusion-webui\models\Stable-diffusion\v1-5-pruned-emaonly.ckpt
Creating model from config: C:\AI\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Loading VAE weights specified in settings: C:\AI\stable-diffusion-webui\models\VAE\vae-ft-ema-560000-ema-pruned.ckpt
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(2): Style-Autumn, Style-Empire
Model loaded in 5.6s (load weights from disk: 1.6s, create model: 0.6s, apply weights to model: 0.6s, apply half(): 0.7s, load VAE: 0.3s, move model to device: 0.6s, load textual inversion embeddings: 1.1s).
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
100%|██████████████████████████████████████████████████████████████████████████████████| 10/10 [00:05<00:00, 1.81it/s]
Error verifying pickled file from C:\AI\stable-diffusion-webui\models\Codeformer\tmp3f6l0lvr:0 [00:04<00:00, 2.07it/s]
Traceback (most recent call last):
File "C:\AI\stable-diffusion-webui\modules\safe.py", line 81, in check_pt
with zipfile.ZipFile(filename) as z:
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\zipfile.py", line 1267, in __init__
self._RealGetContents()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\zipfile.py", line 1334, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\AI\stable-diffusion-webui\modules\safe.py", line 135, in load_with_extra
check_pt(filename, extra_handler)
File "C:\AI\stable-diffusion-webui\modules\safe.py", line 102, in check_pt
unpickler.load()
_pickle.UnpicklingError: persistent IDs in protocol 0 must be ASCII strings
-----> !!!! The file is most likely corrupted !!!! <-----
You can skip this check with --disable-safe-unpickle commandline argument, but that is not going to help you.
Error completing request
Arguments: ('task(rcvbkvr13o9kgze)', 'a man looking into camera', '', [], 10, 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, True, False, 1, False, False, False, 1.1, 1.5, 100, 0.7, False, False, True, False, False, 0, 'Gustavosta/MagicPrompt-Stable-Diffusion', '', False, False, 'positive', 'comma', 0, False, False, '', 1, '', 0, '', 0, '', True, False, False, False, 0) {}
Traceback (most recent call last):
File "C:\AI\stable-diffusion-webui\modules\call_queue.py", line 56, in f
res = list(func(*args, **kwargs))
File "C:\AI\stable-diffusion-webui\modules\call_queue.py", line 37, in f
res = func(*args, **kwargs)
File "C:\AI\stable-diffusion-webui\modules\txt2img.py", line 56, in txt2img
processed = process_images(p)
File "C:\AI\stable-diffusion-webui\modules\processing.py", line 486, in process_images
res = process_images_inner(p)
File "C:\AI\stable-diffusion-webui\modules\processing.py", line 657, in process_images_inner
x_sample = modules.face_restoration.restore_faces(x_sample)
File "C:\AI\stable-diffusion-webui\modules\face_restoration.py", line 19, in restore_faces
return face_restorer.restore(np_image)
File "C:\AI\stable-diffusion-webui\modules\codeformer_model.py", line 88, in restore
self.create_models()
File "C:\AI\stable-diffusion-webui\modules\codeformer_model.py", line 65, in create_models
checkpoint = torch.load(ckpt_path)['params_ema']
TypeError: 'NoneType' object is not subscriptable
Additional information
Beside CodeFormer everything else works fine. thank you
Get the same error here and find the solution:
The reason for this, is the downloading of CodeFormer's pre-trained model, is not finished. But it created a broken model file. So webui won't download it again. And it doesn't know this model file is broken.
So, you need to go to models/CodeFormer
, check this codeformer-v0.1.0.pth
file's size. It should be 359.19mb. If it is smaller, means your downloading is failed. You have to delete it and download it manually, from:
https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth
Then re-name it into: codeformer-v0.1.0.pth
, it must be this name.
There should be a checker in the code for this. If that downloading is not finished, it should not create that file, or just delete it, so next time, it can be downloaded again.
Get the same error here and find the solution:
The reason for this, is the downloading of CodeFormer's pre-trained model, is not finished. But it created a broken model file. So webui won't download it again. And it doesn't know this model file is broken.
So, you need to go to
models/CodeFormer
, check thiscodeformer-v0.1.0.pth
file's size. It should be 359.19mb. If it is smaller, means your downloading is failed. You have to delete it and download it manually, from:https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth
Then re-name it into:
codeformer-v0.1.0.pth
, it must be this name.There should be a checker in the code for this. If that downloading is not finished, it should not create that file, or just delete it, so next time, it can be downloaded again.
After I did exactly what you said and did a test using Codeformer It start downloading a punch of more .pth files (for the first time) and now it works properly You are a life-saver mate! Thank you very much
omg thinks you!!
Get the same error here and find the solution:
The reason for this, is the downloading of CodeFormer's pre-trained model, is not finished. But it created a broken model file. So webui won't download it again. And it doesn't know this model file is broken.
So, you need to go to
models/CodeFormer
, check thiscodeformer-v0.1.0.pth
file's size. It should be 359.19mb. If it is smaller, means your downloading is failed. You have to delete it and download it manually, from:https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth
Then re-name it into:
codeformer-v0.1.0.pth
, it must be this name.There should be a checker in the code for this. If that downloading is not finished, it should not create that file, or just delete it, so next time, it can be downloaded again.
thank you!
Hello. Just small message to thank you. It's working here, Restore Faces working well with Code Former. Good day
Get the same error here and find the solution: The reason for this, is the downloading of CodeFormer's pre-trained model, is not finished. But it created a broken model file. So webui won't download it again. And it doesn't know this model file is broken. So, you need to go to
models/CodeFormer
, check thiscodeformer-v0.1.0.pth
file's size. It should be 359.19mb. If it is smaller, means your downloading is failed. You have to delete it and download it manually, from:https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth
Then re-name it into:codeformer-v0.1.0.pth
, it must be this name. There should be a checker in the code for this. If that downloading is not finished, it should not create that file, or just delete it, so next time, it can be downloaded again.After I did exactly what you said and did a test using Codeformer It start downloading a punch of more .pth files (for the first time) and now it works properly You are a life-saver mate! Thank you very much
I solved,thank you very much
long story short. I made as it way written above, but i had in code formers file also another (like an old one) codeformer file (right weight, just name wrong). i delete it and installation began all by itself (in webui terminall). installation of all the 3 files was ok.
error still exist HELPPP
File C:\AI\stable-diffusion-webui\extensions\stable-diffusion-webui-wildcards\wildcards\brunet.txt not found for the brunet wildcard. 100%|██████████████████████████████████████████████████████████████████████████████████| 16/16 [00:05<00:00, 2.99it/s] *** Error completing request███████████████████████████████████████████████████████████| 16/16 [00:04<00:00, 3.53it/s] *** Arguments: ('task(5dsbmewkbjxqtsw)', 0, 'brunet', '', [], <PIL.Image.Image image mode=RGBA size=512x512 at 0x297C9776DD0>, None, None, None, None, None, None, 20, 0, 4, 0, 1, True, False, 1, 1, 7, 1.5, 0.75, -1.0, -1.0, 0, 0, 0, False, 0, 512, 512, 1, 0, 0, 32, 0, '', '', '', [], False, [], '', <gradio.routes.Request object at 0x00000297C9776920>, 0, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000297C9777E20>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000297C9774130>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000297C9774190>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x00000297C97778B0>, 0.9, 5, '0.0001', False, 'None', '', 0.1, False, '
- \n
CFG Scale
should be 2 or lower. \n
Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8
', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', 'Will upscale the image by the selected scale factor; use width and height sliders to set tile size
', 64, 0, 2, 1, '', [], 0, '', [], 0, '', [], True, False, False, False, 0, None, None, False, None, None, False, None, None, False, None, None, False, 50) {} Traceback (most recent call last): File "C:\AI\stable-diffusion-webui\modules\call_queue.py", line 58, in f res = list(func(*args, **kwargs)) File "C:\AI\stable-diffusion-webui\modules\call_queue.py", line 37, in f res = func(*args, **kwargs) File "C:\AI\stable-diffusion-webui\modules\img2img.py", line 232, in img2img processed = process_images(p) File "C:\AI\stable-diffusion-webui\modules\processing.py", line 677, in process_images res = process_images_inner(p) File "C:\AI\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 42, in processing_process_images_hijack return getattr(processing, '_controlnet_original_process_images_inner')(p, *args, **kwargs) File "C:\AI\stable-diffusion-webui\modules\processing.py", line 832, in process_images_inner x_sample = modules.face_restoration.restore_faces(x_sample) File "C:\AI\stable-diffusion-webui\modules\face_restoration.py", line 19, in restore_faces return face_restorer.restore(np_image) File "C:\AI\stable-diffusion-webui\modules\codeformer_model.py", line 81, in restore self.create_models() File "C:\AI\stable-diffusion-webui\modules\codeformer_model.py", line 64, 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 "C:\AI\stable-diffusion-webui\repositories\CodeFormer\facelib\utils\face_restoration_helper.py", line 109, in init self.face_parse = init_parsing_model(model_name='parsenet', device=self.device) File "C:\AI\stable-diffusion-webui\repositories\CodeFormer\facelib\parsing_init.py", line 19, in init_parsing_model load_net = torch.load(model_path, map_location=lambda storage, loc: storage) File "C:\AI\stable-diffusion-webui\modules\safe.py", line 108, in load return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs) File "C:\AI\stable-diffusion-webui\modules\safe.py", line 156, in load_with_extra return unsafe_torch_load(filename, *args, **kwargs) File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\torch\serialization.py", line 815, in load return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args) File "C:\AI\stable-diffusion-webui\venv\lib\site-packages\torch\serialization.py", line 1051, in _legacy_load typed_storage._untyped_storage._set_from_file( RuntimeError: unexpected EOF, expected 380599 more bytes. The file might be corrupted.