ltdrdata / ComfyUI-Impact-Pack

Custom nodes pack for ComfyUI This custom node helps to conveniently enhance images through Detector, Detailer, Upscaler, Pipe, and more.
GNU General Public License v3.0
1.91k stars 187 forks source link

FaceDetailerPipe RuntimeError: The default implementation of __deepcopy__() for non-wrapper subclasses only works for subclass types that implement new_empty() and for which that function returns another instance of the same subclass. #784

Closed DigitalBeer closed 1 month ago

DigitalBeer commented 1 month ago

Hi, I'm trying to run a workflow that builds character sheets. After the initial creation, it's upscaled by Ultimate SD Upscale, at the point it hands off to FaceDetailer (pipe) from the Impact-Pack it fails with the following error. I deleted the node folder and reinstalled from scratch, updated everything several times over a few days but I'm still seeing the same error. I couldn't find anyone else mentioning this same issue though. Happy to troubleshoot it if it helps or redirect it to comfyui if it's not a node issue.

Thank you.

ComfyUI Error Report

Error Details

## System Information
- **ComfyUI Version:** v0.2.3-10-gc695c4a
- **Arguments:** main.py --highvram --disable-auto-launch
- **OS:** nt
- **Python Version:** 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
- **Embedded Python:** false
- **PyTorch Version:** 2.3.1+cu121
## Devices

- **Name:** cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync
  - **Type:** cuda
  - **VRAM Total:** 25756696576
  - **VRAM Free:** 4376772760
  - **Torch VRAM Total:** 19730006016
  - **Torch VRAM Free:** 279183512

## Logs

2024-10-16 12:31:23,655 - root - ERROR - !!! Exception during processing !!! The default implementation of deepcopy() for non-wrapper subclasses only works for subclass types that implement new_empty() and for which that function returns another instance of the same subclass. You should either properly implement new_empty() for your subclass or override deepcopy() if it is intended behavior for new_empty() to return an instance of a different type. 2024-10-16 12:31:23,656 - root - ERROR - Traceback (most recent call last): File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 323, in execute output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 198, in get_output_data return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb) File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 169, in _map_node_over_list process_inputs(input_dict, i) File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 158, in process_inputs results.append(getattr(obj, func)(inputs)) File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\impact_pack.py", line 1396, in doit enhanced_img, cropped_enhanced, cropped_enhanced_alpha, mask, cnet_pil_list = FaceDetailer.enhance_face( File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\impact_pack.py", line 547, in enhance_face DetailerForEach.do_detail(image, segs, model, clip, vae, guide_size, guide_size_for_bbox, max_size, seed, steps, cfg, File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\impact_pack.py", line 323, in do_detail enhanced_image, cnet_pils = core.enhance_detail(cropped_image, model, clip, vae, guide_size, guide_size_for_bbox, max_size, File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\core.py", line 356, in enhance_detail refined_latent = detailer_hook.pre_decode(refined_latent) File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\hooks.py", line 235, in pre_decode new_samples = copy.deepcopy(samples) File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\copy.py", line 146, in deepcopy y = copier(x, memo) File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\copy.py", line 231, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\copy.py", line 153, in deepcopy y = copier(memo) File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-GGUF\ops.py", line 44, in deepcopy new = super().deepcopy(*args, *kwargs) File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch_tensor.py", line 84, in deepcopy return handle_torch_function(Tensor.deepcopy, (self,), self, memo) File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\overrides.py", line 1636, in handle_torch_function result = torch_func_method(public_api, types, args, kwargs) File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch_tensor.py", line 1443, in __torch_function__ ret = func(args, kwargs) File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch_tensor.py", line 174, in deepcopy raise RuntimeError( RuntimeError: The default implementation of deepcopy() for non-wrapper subclasses only works for subclass types that implement new_empty() and for which that function returns another instance of the same subclass. You should either properly implement new_empty() for your subclass or override deepcopy() if it is intended behavior for new_empty() to return an instance of a different type.

2024-10-16 12:31:23,659 - root - INFO - Prompt executed in 576.68 seconds


## Attached Workflow
[241011_MICKMUMPITZ_CHARACTER_SHEET_V04_FLUX_SMPL.json](https://github.com/user-attachments/files/17395110/241011_MICKMUMPITZ_CHARACTER_SHEET_V04_FLUX_SMPL.json)
ltdrdata commented 1 month ago

This is an issue of ComfyUI-GGUF not a Impact Pack issue.

trihook commented 2 weeks ago

Hi, I'm trying to run a workflow that builds character sheets. After the initial creation, it's upscaled by Ultimate SD Upscale, at the point it hands off to FaceDetailer (pipe) from the Impact-Pack it fails with the following error. I deleted the node folder and reinstalled from scratch, updated everything several times over a few days but I'm still seeing the same error. I couldn't find anyone else mentioning this same issue though. Happy to troubleshoot it if it helps or redirect it to comfyui if it's not a node issue.

Thank you.

ComfyUI Error Report

Error Details

  • Node Type: FaceDetailerPipe
  • Exception Type: RuntimeError
  • Exception Message: The default implementation of deepcopy() for non-wrapper subclasses only works for subclass types that implement new_empty() and for which that function returns another instance of the same subclass. You should either properly implement new_empty() for your subclass or override deepcopy() if it is intended behavior for new_empty() to return an instance of a different type.

Stack Trace

  File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)

  File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)

  File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)

  File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))

  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\impact_pack.py", line 1396, in doit
    enhanced_img, cropped_enhanced, cropped_enhanced_alpha, mask, cnet_pil_list = FaceDetailer.enhance_face(

  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\impact_pack.py", line 547, in enhance_face
    DetailerForEach.do_detail(image, segs, model, clip, vae, guide_size, guide_size_for_bbox, max_size, seed, steps, cfg,

  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\impact_pack.py", line 323, in do_detail
    enhanced_image, cnet_pils = core.enhance_detail(cropped_image, model, clip, vae, guide_size, guide_size_for_bbox, max_size,

  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\core.py", line 356, in enhance_detail
    refined_latent = detailer_hook.pre_decode(refined_latent)

  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\hooks.py", line 235, in pre_decode
    new_samples = copy.deepcopy(samples)

  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\copy.py", line 146, in deepcopy
    y = copier(x, memo)

  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)

  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\copy.py", line 153, in deepcopy
    y = copier(memo)

  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-GGUF\ops.py", line 44, in __deepcopy__
    new = super().__deepcopy__(*args, **kwargs)

  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\_tensor.py", line 84, in __deepcopy__
    return handle_torch_function(Tensor.__deepcopy__, (self,), self, memo)

  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\overrides.py", line 1636, in handle_torch_function
    result = torch_func_method(public_api, types, args, kwargs)

  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\_tensor.py", line 1443, in __torch_function__
    ret = func(*args, **kwargs)

  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\_tensor.py", line 174, in __deepcopy__
    raise RuntimeError(

System Information

  • ComfyUI Version: v0.2.3-10-gc695c4a
  • Arguments: main.py --highvram --disable-auto-launch
  • OS: nt
  • Python Version: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
  • Embedded Python: false
  • PyTorch Version: 2.3.1+cu121

Devices

  • Name: cuda:0 NVIDIA GeForce RTX 4090 : cudaMallocAsync

    • Type: cuda
    • VRAM Total: 25756696576
    • VRAM Free: 4376772760
    • Torch VRAM Total: 19730006016
    • Torch VRAM Free: 279183512

Logs


2024-10-16 12:31:23,655 - root - ERROR - !!! Exception during processing !!! The default implementation of __deepcopy__() for non-wrapper subclasses only works for subclass types that implement new_empty() and for which that function returns another instance of the same subclass. You should either properly implement new_empty() for your subclass or override __deepcopy__() if it is intended behavior for new_empty() to return an instance of a different type.
2024-10-16 12:31:23,656 - root - ERROR - Traceback (most recent call last):
  File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 323, in execute
    output_data, output_ui, has_subgraph = get_output_data(obj, input_data_all, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
  File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 198, in get_output_data
    return_values = _map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True, execution_block_cb=execution_block_cb, pre_execute_cb=pre_execute_cb)
  File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 169, in _map_node_over_list
    process_inputs(input_dict, i)
  File "D:\aitools\ComfyUI\ComfyUI\execution.py", line 158, in process_inputs
    results.append(getattr(obj, func)(**inputs))
  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\impact_pack.py", line 1396, in doit
    enhanced_img, cropped_enhanced, cropped_enhanced_alpha, mask, cnet_pil_list = FaceDetailer.enhance_face(
  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\impact_pack.py", line 547, in enhance_face
    DetailerForEach.do_detail(image, segs, model, clip, vae, guide_size, guide_size_for_bbox, max_size, seed, steps, cfg,
  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\impact_pack.py", line 323, in do_detail
    enhanced_image, cnet_pils = core.enhance_detail(cropped_image, model, clip, vae, guide_size, guide_size_for_bbox, max_size,
  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\core.py", line 356, in enhance_detail
    refined_latent = detailer_hook.pre_decode(refined_latent)
  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-Impact-Pack\modules\impact\hooks.py", line 235, in pre_decode
    new_samples = copy.deepcopy(samples)
  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\copy.py", line 146, in deepcopy
    y = copier(x, memo)
  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\copy.py", line 231, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\copy.py", line 153, in deepcopy
    y = copier(memo)
  File "D:\aitools\ComfyUI\ComfyUI\custom_nodes\ComfyUI-GGUF\ops.py", line 44, in __deepcopy__
    new = super().__deepcopy__(*args, **kwargs)
  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\_tensor.py", line 84, in __deepcopy__
    return handle_torch_function(Tensor.__deepcopy__, (self,), self, memo)
  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\overrides.py", line 1636, in handle_torch_function
    result = torch_func_method(public_api, types, args, kwargs)
  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\_tensor.py", line 1443, in __torch_function__
    ret = func(*args, **kwargs)
  File "C:\Users\matde\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\_tensor.py", line 174, in __deepcopy__
    raise RuntimeError(
RuntimeError: The default implementation of __deepcopy__() for non-wrapper subclasses only works for subclass types that implement new_empty() and for which that function returns another instance of the same subclass. You should either properly implement new_empty() for your subclass or override __deepcopy__() if it is intended behavior for new_empty() to return an instance of a different type.

2024-10-16 12:31:23,659 - root - INFO - Prompt executed in 576.68 seconds

Attached Workflow

241011_MICKMUMPITZ_CHARACTER_SHEET_V04_FLUX_SMPL.json

you can use FaceDetailer replace FaceDetailer (pipe)