ototadana / sd-face-editor

Face Editor for Stable Diffusion
MIT License
1.03k stars 86 forks source link

(Solved!) Face Editor: Error: unexpected EOF, expected 865185 more bytes. The file might be corrupted. #112

Closed vaguetrox closed 1 year ago

vaguetrox commented 1 year ago

Error completing request Arguments: ('', 'https://github.com/ototadana/sd-face-editor.git', '') {} Traceback (most recent call last): File "D:\stable-diffusion\stable-diffusion-webui\modules\call_queue.py", line 57, in f res = list(func(*args, *kwargs)) File "D:\stable-diffusion\stable-diffusion-webui\modules\ui_extensions.py", line 595, in fn=modules.ui.wrap_gradio_call(lambda args: [gr.update(), install_extension_from_url(args)], extra_outputs=[gr.update(), gr.update()]), File "D:\stable-diffusion\stable-diffusion-webui\modules\ui_extensions.py", line 337, in install_extension_from_url assert not os.path.exists(target_dir), f'Extension directory already exists: {target_dir}' AssertionError: Extension directory already exists: D:\stable-diffusion\stable-diffusion-webui\extensions\sd-face-editor

I tried to uninstall and reinstall again. I restarted my computer every time I uninstall the script. Each time I see this error.

ototadana commented 1 year ago

Thanks for trying this extension.

The following error message may help to solve the problem.

File "D:\stable-diffusion\stable-diffusion-webui\modules\ui_extensions.py", line 337, in install_extension_from_url assert not os.path.exists(target_dir), f'Extension directory already exists: {target_dir}'

Could you first remove "D:\stable-diffusion\stable-diffusion-webui\extensions\sd-face-editor" and then try the install operation again?

swumagic commented 1 year ago

Perhaps the "D:\tools\sd-webui-aki\sd-webui-aki-v4\sd-webui-aki-v4\models\GFPGAN\parsing_bisenet.pth" file is corrupt, so delete that file first, then try again.

vaguetrox commented 1 year ago

I removed the files completely and also I removed the "parsing_bisenet.pth" file. I reinstall again but still problem persist.

Now, I am seeing this issue:

Traceback (most recent call last): File "D:\stable-diffusion\stable-diffusion-webui\extensions\sd-face-editor\scripts\use_cases\registry.py", line 14, in create c = cls() File "D:\stable-diffusion\stable-diffusion-webui\extensions\sd-face-editor\scripts\inferencers\retinaface_detector.py", line 16, in init self.detection_model = init_detection_model("retinaface_resnet50", device=shared.device) File "D:\stable-diffusion\stable-diffusion-webui\venv\lib\site-packages\facexlib\detection__init__.py", line 22, in init_detection_model load_net = torch.load(model_path, map_location=lambda storage, loc: storage) File "D:\stable-diffusion\stable-diffusion-webui\modules\safe.py", line 107, in load return load_with_extra(filename, *args, extra_handler=global_extra_handler, *kwargs) File "D:\stable-diffusion\stable-diffusion-webui\modules\safe.py", line 152, in load_with_extra return unsafe_torch_load(filename, args, kwargs) File "D:\stable-diffusion\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 "D:\stable-diffusion\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 865185 more bytes. The file might be corrupted.

Face Editor: <class 'module.name.RetinafaceDetector'>, Error: unexpected EOF, expected 865185 more bytes. The file might be corrupted.

It seems problem related to with "RetinafaceDetector" but I do not know which file related to this.

swumagic commented 1 year ago

Download the following 3 files and put them in this SD\models\GFPGAN folder

1、parsing_bisenet.pth parsing_bisenet.pth: https://github.com/xinntao/facexlib/releases/download/v0.2.2/parsing_parsenet.pth

2、detection_Resnet50_Final.pth (https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth)

3、GFPGANv1.4.pth https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.4.pth

https://github.com/TencentARC/GFPGAN

完成请求时错误 参数:('', ' https://github.com/ototadana/sd-face-editor.git ', '') {} 回溯(最近调用一次): 文件“D:\stable-diffusion \stable-diffusion-webui\modules\call_queue.py”,第 57 行,在 f res = list(func(*args, *kwargs)) 文件“D:\stable-diffusion\stable-diffusion-webui\modules \ ui_extensions.py”,第 595 行,在 fn=modules.ui.wrap_gradio_call(lambda args: [gr.update(), install_extension_from_url(args)], extra_outputs=[gr.update(), gr.update () ]), 文件“D:\stable-diffusion\stable-diffusion-webui\modules\ui_extensions.py”,第 337 行,在 install_extension_from_url 中 断言不是 os.path.exists(target_dir),f'Extension 目录已存在:{目标目录}' AssertionError:扩展目录已存在:D:\stable-diffusion\stable-diffusion-webui\extensions\sd-face-editor

我尝试卸载并重新安装。每次卸载脚本时我都会重新启动计算机。每次我都会看到这个错误。

vaguetrox commented 1 year ago

Thank you very much. This fixed the issue. I don't see the error anymore.

ototadana commented 1 year ago

@swumagic

I also tried deleting all the files under the models/GFPGAN folder and restarting webui. Unfortunately, I could not reproduce the error because the automatic download worked fine in my environment as shown below.

Downloading: "https://github.com/xinntao/facexlib/releases/download/v0.1.0/detection_Resnet50_Final.pth" to /home/ototadana/stable-diffusion-webui/models/GFPGAN/detection_Resnet50_Final.pth

100%|████████████████████████████████████████| 104M/104M [00:02<00:00, 46.4MB/s]
Downloading: "https://github.com/xinntao/facexlib/releases/download/v0.2.0/parsing_bisenet.pth" to /home/ototadana/stable-diffusion-webui/models/GFPGAN/parsing_bisenet.pth

100%|██████████████████████████████████████| 50.8M/50.8M [00:02<00:00, 22.1MB/s]

In any case, your information was very valuable as there seems to be more than a certain number of people in the environment who are unable to download automatically. Thank you so much for your help.

swumagic commented 1 year ago

Thank you for your plugin and update, the new version can run now, there is no error, I can close this problem