Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

please help me~always Error,how to fix it? #450

Open
3 tasks done
sparkshou opened this issue May 14, 2024 · 2 comments
Open
3 tasks done

please help me~always Error,how to fix it? #450

sparkshou opened this issue May 14, 2024 · 2 comments

Comments

@sparkshou
Copy link

First, confirm

  • I have read the instruction carefully
  • I have searched the existing issues
  • I have updated the extension to the latest version

What happened?

13:47:58 - ReActor - STATUS - Working: source face index [0], target face index [0]
13:47:58 - ReActor - STATUS - Using Hashed Source Face(s) Model...
13:47:58 - ReActor - STATUS - Analyzing Target Image...
13:47:59 - ReActor - STATUS - Detecting Source Face, Index = 0
13:47:59 - ReActor - STATUS - Detected: -21- y.o. Male
13:47:59 - ReActor - STATUS - Detecting Target Face, Index = 0
13:47:59 - ReActor - STATUS - Detected: -67- y.o. Male
13:47:59 - ReActor - STATUS - Swapping Source into Target
13:47:59 - ReActor - STATUS - Restoring the face with CodeFormer (weight: 0.5)
*** Error running postprocess_image: D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_faceswap.py
Traceback (most recent call last):
File "D:\Program Files (x86)\stable diffusion\modules\scripts.py", line 897, in postprocess_image
script.postprocess_image(p, pp, *script_args)
File "D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_faceswap.py", line 450, in postprocess_image
result, output, swapped = swap_face(
File "D:\Program Files (x86)\stable diffusion\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:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 812, in operate
result_image = enhance_image(result_image, enhancement_options)
File "D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 217, in enhance_image
result_image = restore_face(result_image, enhancement_options)
File "D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 172, in restore_face
numpy_image = codeformer_model.codeformer.restore(
File "D:\Program Files (x86)\stable diffusion\modules\codeformer_model.py", line 55, in restore
return self.restore_with_helper(np_image, restore_face)
File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 156, in restore_with_helper
self.send_model_to(self.get_device())
File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 132, in send_model_to
if self.face_helper:
File "D:\Program Files (x86)\stable diffusion\python\lib\functools.py", line 981, in get
val = self.func(instance)
File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 126, in face_helper
return create_face_helper(self.get_device())
File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 47, in create_face_helper
return FaceRestoreHelper(
File "D:\Program Files (x86)\stable diffusion\python\lib\site-packages\facexlib\utils\face_restoration_helper.py", line 99, in init
self.face_det = init_detection_model(det_model, half=False, device=self.device, model_rootpath=model_rootpath)
File "D:\Program Files (x86)\stable diffusion\python\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:\Program Files (x86)\stable diffusion\modules\safe.py", line 108, in load
return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs)
File "D:\Program Files (x86)\stable diffusion\modules\safe.py", line 156, in load_with_extra
return unsafe_torch_load(filename, *args, **kwargs)
File "D:\Program Files (x86)\stable diffusion\python\lib\site-packages\torch\serialization.py", line 1040, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "D:\Program Files (x86)\stable diffusion\python\lib\site-packages\torch\serialization.py", line 1276, in _legacy_load
typed_storage._untyped_storage._set_from_file(
RuntimeError: unexpected EOF, expected 11537 more bytes. The file might be corrupted.


Steps to reproduce the problem

i dont know whats happend

Sysinfo

windows 10
python 3.11

Relevant console log

13:47:58 - ReActor - STATUS - Working: source face index [0], target face index [0]
13:47:58 - ReActor - STATUS - Using Hashed Source Face(s) Model...
13:47:58 - ReActor - STATUS - Analyzing Target Image...
13:47:59 - ReActor - STATUS - Detecting Source Face, Index = 0
13:47:59 - ReActor - STATUS - Detected: -21- y.o. Male
13:47:59 - ReActor - STATUS - Detecting Target Face, Index = 0
13:47:59 - ReActor - STATUS - Detected: -67- y.o. Male
13:47:59 - ReActor - STATUS - Swapping Source into Target
13:47:59 - ReActor - STATUS - Restoring the face with CodeFormer (weight: 0.5)
*** Error running postprocess_image: D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_faceswap.py
    Traceback (most recent call last):
      File "D:\Program Files (x86)\stable diffusion\modules\scripts.py", line 897, in postprocess_image
        script.postprocess_image(p, pp, *script_args)
      File "D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_faceswap.py", line 450, in postprocess_image
        result, output, swapped = swap_face(
      File "D:\Program Files (x86)\stable diffusion\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:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 812, in operate
        result_image = enhance_image(result_image, enhancement_options)
      File "D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 217, in enhance_image
        result_image = restore_face(result_image, enhancement_options)
      File "D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 172, in restore_face
        numpy_image = codeformer_model.codeformer.restore(
      File "D:\Program Files (x86)\stable diffusion\modules\codeformer_model.py", line 55, in restore
        return self.restore_with_helper(np_image, restore_face)
      File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 156, in restore_with_helper
        self.send_model_to(self.get_device())
      File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 132, in send_model_to
        if self.face_helper:
      File "D:\Program Files (x86)\stable diffusion\python\lib\functools.py", line 981, in __get__
        val = self.func(instance)
      File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 126, in face_helper
        return create_face_helper(self.get_device())
      File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 47, in create_face_helper
        return FaceRestoreHelper(
      File "D:\Program Files (x86)\stable diffusion\python\lib\site-packages\facexlib\utils\face_restoration_helper.py", line 99, in __init__
        self.face_det = init_detection_model(det_model, half=False, device=self.device, model_rootpath=model_rootpath)
      File "D:\Program Files (x86)\stable diffusion\python\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:\Program Files (x86)\stable diffusion\modules\safe.py", line 108, in load
        return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs)
      File "D:\Program Files (x86)\stable diffusion\modules\safe.py", line 156, in load_with_extra
        return unsafe_torch_load(filename, *args, **kwargs)
      File "D:\Program Files (x86)\stable diffusion\python\lib\site-packages\torch\serialization.py", line 1040, in load
        return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
      File "D:\Program Files (x86)\stable diffusion\python\lib\site-packages\torch\serialization.py", line 1276, in _legacy_load
        typed_storage._untyped_storage._set_from_file(
    RuntimeError: unexpected EOF, expected 11537 more bytes. The file might be corrupted.

---

Additional information

No response

@sparkshou sparkshou added bug Something isn't working new labels May 14, 2024
@Gourieff
Copy link
Owner

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

Here is the answer
Codeformer model is corrupted
Just delete the codeformer model file (models\CodeFormer\codeformer-v0.1.0.pth) and let SD WebUI to download it again

@Gourieff Gourieff removed bug Something isn't working new labels May 14, 2024
@sparkshou
Copy link
Author

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

Here is the answer Codeformer model is corrupted Just delete the codeformer model file (models\CodeFormer\codeformer-v0.1.0.pth) and let SD WebUI to download it again

it doest work, still print Error.It's really hard to me. the target picture's face didt change. :(


15:33:51 - ReActor - STATUS - Working: source face index [0], target face index [0]
15:33:51 - ReActor - STATUS - Analyzing Source Image...
15:33:55 - ReActor - STATUS - Analyzing Target Image...
15:33:56 - ReActor - STATUS - Detecting Source Face, Index = 0
15:33:56 - ReActor - STATUS - Detected: -26- y.o. Male
15:33:57 - ReActor - STATUS - Detecting Target Face, Index = 0
15:33:57 - ReActor - STATUS - Detected: -26- y.o. Female
15:33:57 - ReActor - STATUS - Swapping Source into Target
15:34:02 - ReActor - STATUS - Restoring the face with CodeFormer (weight: 0.5)
Downloading: "https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth" to D:\Program Files (x86)\stable diffusion\models\Codeformer\codeformer-v0.1.0.pth

*** Error running postprocess_image: D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_faceswap.py
Traceback (most recent call last):
File "D:\Program Files (x86)\stable diffusion\modules\scripts.py", line 897, in postprocess_image
script.postprocess_image(p, pp, *script_args)
File "D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_faceswap.py", line 450, in postprocess_image
result, output, swapped = swap_face(
File "D:\Program Files (x86)\stable diffusion\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:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 812, in operate
result_image = enhance_image(result_image, enhancement_options)
File "D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 217, in enhance_image
result_image = restore_face(result_image, enhancement_options)
File "D:\Program Files (x86)\stable diffusion\extensions\sd-webui-reactor\scripts\reactor_swapper.py", line 172, in restore_face
numpy_image = codeformer_model.codeformer.restore(
File "D:\Program Files (x86)\stable diffusion\modules\codeformer_model.py", line 55, in restore
return self.restore_with_helper(np_image, restore_face)
File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 156, in restore_with_helper
self.send_model_to(self.get_device())
File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 132, in send_model_to
if self.face_helper:
File "D:\Program Files (x86)\stable diffusion\python\lib\functools.py", line 981, in get
val = self.func(instance)
File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 126, in face_helper
return create_face_helper(self.get_device())
File "D:\Program Files (x86)\stable diffusion\modules\face_restoration_utils.py", line 47, in create_face_helper
return FaceRestoreHelper(
File "D:\Program Files (x86)\stable diffusion\python\lib\site-packages\facexlib\utils\face_restoration_helper.py", line 99, in init
self.face_det = init_detection_model(det_model, half=False, device=self.device, model_rootpath=model_rootpath)
File "D:\Program Files (x86)\stable diffusion\python\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:\Program Files (x86)\stable diffusion\modules\safe.py", line 108, in load
return load_with_extra(filename, *args, extra_handler=global_extra_handler, **kwargs)
File "D:\Program Files (x86)\stable diffusion\modules\safe.py", line 156, in load_with_extra
return unsafe_torch_load(filename, *args, **kwargs)
File "D:\Program Files (x86)\stable diffusion\python\lib\site-packages\torch\serialization.py", line 1040, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "D:\Program Files (x86)\stable diffusion\python\lib\site-packages\torch\serialization.py", line 1276, in _legacy_load
typed_storage._untyped_storage._set_from_file(
RuntimeError: unexpected EOF, expected 11537 more bytes. The file might be corrupted.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants