Gourieff / sd-webui-reactor

Fast and Simple Face Swap Extension for StableDiffusion WebUI (A1111 SD WebUI, SD WebUI Forge, SD.Next, Cagliostro)
GNU Affero General Public License v3.0
2.17k stars 235 forks source link

unexpected EOF, expected 1938045 more bytes. The file might be corrupted #417

Open 158zd opened 1 month ago

158zd commented 1 month ago

First, confirm

What happened?

For some reason, after reinstalling Reactor several times, the same issue persists:unexpected EOF, expected 1938045 more bytes. The file might be corrupted

Steps to reproduce the problem

Encountered the following error when using (mov2mov+reactor) to generate a face-swapped video.

Sysinfo

sysinfo.txt

Relevant console log

Python 3.10.6 | packaged by conda-forge | (main, Oct 24 2022, 16:02:16) [MSC v.1916 64 bit (AMD64)]
Version: v1.8.0
Commit hash: bef51aed032c0aaa5cfd80445bc4cf0d85b408b5
CUDA 12.1
Launching Web UI with arguments: --xformers
12:28:08 - ReActor - STATUS - Running v0.7.0-b7 on Device: CUDA
Loading weights [f8bf1b2f58] from D:\ai\stable-diffusion-webui\models\Stable-diffusion\t3_Ver13.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Creating model from config: D:\ai\stable-diffusion-webui\configs\v1-inference.yaml
Startup time: 28.1s (prepare environment: 8.7s, import torch: 8.9s, import gradio: 1.7s, setup paths: 2.0s, initialize shared: 0.4s, other imports: 1.0s, load scripts: 3.2s, create ui: 1.1s, gradio launch: 1.1s).
Applying attention optimization: xformers... done.
Model loaded in 5.5s (load weights from disk: 1.5s, create model: 1.0s, apply weights to model: 2.5s, calculate empty prompt: 0.2s).

Start parsing the number of mov frames
The video conversion is completed, images:110
current progress: 1/110
100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:01<00:00,  1.91s/it]
12:31:51 - ReActor - STATUS - Working: source face index [0], target face index [0]                                                     | 0/110 [00:00<?, ?it/s] 
12:31:51 - ReActor - STATUS - Analyzing Source Image...
12:31:54 - ReActor - STATUS - Analyzing Target Image...
12:31:56 - ReActor - STATUS - Detecting Source Face, Index = 0
12:31:56 - ReActor - STATUS - Detected: -31- y.o. Female
12:31:58 - ReActor - STATUS - Detecting Target Face, Index = 0
12:31:58 - ReActor - STATUS - Detected: -23- y.o. Female
12:31:58 - ReActor - STATUS - Swapping Source into Target
12:32:01 - ReActor - STATUS - Restoring the face with CodeFormer (weight: 0.5)
*** Error running postprocess_image: D:\ai\stable-diffusion-webui\extensions\sd-webui-reactor\scripts\reactor_faceswap.py
    Traceback (most recent call last):
      File "D:\ai\stable-diffusion-webui\modules\scripts.py", line 856, in postprocess_image
        script.postprocess_image(p, pp, *script_args)
      File "D:\ai\stable-diffusion-webui\extensions\sd-webui-reactor\scripts\reactor_faceswap.py", line 450, in postprocess_image
        result, output, swapped = swap_face(
      File "D:\ai\stable-diffusion-webui\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 616, in swap_face
        result_image, output, swapped = operate(source_img,target_img,target_img_orig,model,source_faces_index,faces_index,source_faces,target_faces,gender_source,gender_target,source_face,wrong_gender,source_age,source_gender,output,swapped,mask_face,entire_mask_image,enhancement_options,detection_options)
      File "D:\ai\stable-diffusion-webui\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 812, in operate
        result_image = enhance_image(result_image, enhancement_options)
      File "D:\ai\stable-diffusion-webui\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 217, in enhance_image
        result_image = restore_face(result_image, enhancement_options)
      File "D:\ai\stable-diffusion-webui\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 172, in restore_face
        numpy_image = codeformer_model.codeformer.restore(
      File "D:\ai\stable-diffusion-webui\modules\codeformer_model.py", line 55, in restore
        return self.restore_with_helper(np_image, restore_face)
      File "D:\ai\stable-diffusion-webui\modules\face_restoration_utils.py", line 156, in restore_with_helper
        self.send_model_to(self.get_device())
      File "D:\ai\stable-diffusion-webui\modules\face_restoration_utils.py", line 132, in send_model_to
        if self.face_helper:
      File "D:\ai\Anaconda\lib\functools.py", line 981, in __get__
        val = self.func(instance)
      File "D:\ai\stable-diffusion-webui\modules\face_restoration_utils.py", line 126, in face_helper
        return create_face_helper(self.get_device())
      File "D:\ai\stable-diffusion-webui\modules\face_restoration_utils.py", line 47, in create_face_helper
        return FaceRestoreHelper(
      File "D:\ai\stable-diffusion-webui\venv\lib\site-packages\facexlib\utils\face_restoration_helper.py", line 103, in __init__
        self.face_parse = init_parsing_model(model_name='parsenet', device=self.device, model_rootpath=model_rootpath)
      File "D:\ai\stable-diffusion-webui\venv\lib\site-packages\facexlib\parsing\__init__.py", line 20, in init_parsing_model
        load_net = torch.load(model_path, map_location=lambda storage, loc: storage)
      File "D:\ai\stable-diffusion-webui\modules\safe.py", line 108, in load
        return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs)
      File "D:\ai\stable-diffusion-webui\modules\safe.py", line 156, in load_with_extra
        return unsafe_torch_load(filename, *args, **kwargs)
      File "D:\ai\stable-diffusion-webui\venv\lib\site-packages\torch\serialization.py", line 1028, in load
        return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
      File "D:\ai\stable-diffusion-webui\venv\lib\site-packages\torch\serialization.py", line 1264, in _legacy_load
        typed_storage._untyped_storage._set_from_file(
    RuntimeError: unexpected EOF, expected 1938045 more bytes. The file might be corrupted.

Additional information

No response

Gourieff commented 1 month ago

RuntimeError: unexpected EOF, expected 1938045 more bytes. The file might be corrupted.

Your Codeformer model file is corrupted Just delete this file and let SD.WebUI to download it again without being interrupted

158zd commented 1 month ago

@Gourieff When I attempted to delete the Codeformer model alone, I still encountered the same error. However, when I removed the GFPGAN model as well, then it started working normally.