ArtBot2023 / CharacterFaceSwap

66 stars 6 forks source link

Error on MPS #7

Open discordinated opened 8 months ago

discordinated commented 8 months ago

Error occurred when executing Load RetinaFace:

Torch not compiled with CUDA enabled

File "/Users/s/ComfyUI/execution.py", line 154, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/s/ComfyUI/execution.py", line 84, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/s/ComfyUI/execution.py", line 72, in map_node_over_list results.append(getattr(obj, func)()) ^^^^^^^^^^^^^^^^^^^^ File "/Users/s/ComfyUI/custom_nodes/CharacterFaceSwap/nodes.py", line 85, in load return (init_detection_model("retinaface_resnet50", model_rootpath=self.models_dir), ) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/s/miniconda3/lib/python3.11/site-packages/facexlib/detection/init.py", line 10, in init_detection_model model = RetinaFace(network_name='resnet50', half=half, device=device) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/s/miniconda3/lib/python3.11/site-packages/facexlib/detection/retinaface.py", line 86, in init self.mean_tensor = torch.tensor([[[[104.]], [[117.]], [[123.]]]], device=self.device) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/s/miniconda3/lib/python3.11/site-packages/torch/cuda/init.py", line 289, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled")

liu-peiyu commented 8 months ago

me to @discordinated slove?

mattmusk commented 6 months ago

me to @discordinated slove?

You can change nodes.py in the root directory to fix it, in line 85: Change to below: return (init_detection_model("retinaface_resnet50", model_rootpath=self.models_dir, device='cuda' if torch.cuda.is_available() else 'cpu'), ) Remember to restart your comfyui. This error should be disapear.

Or: Just download my code to replace current one named ‘CharacterFaceSwap’ in your custom_nodes directory:
https://github.com/mattmusk/CharacterFaceSwap