ShmuelRonen / ComfyUI_wav2lip

A custom node for ComfyUI that allows you to perform lip-syncing on videos using the Wav2Lip model. It takes an input video and an audio file and generates a lip-synced output video.
89 stars 20 forks source link

No module named 'wav2lip' #4

Closed pixelclub2024 closed 4 months ago

pixelclub2024 commented 4 months ago

I'm unable to get your latest version to run. This is the error upon starting comfyui:

Traceback (most recent call last): File "C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1866, in load_custom_node module_spec.loader.exec_module(module) File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip__init__.py", line 1, in from .wav2lip import Wav2Lip File "C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip\wav2lip.py", line 33, in from wav2lip import Wav2Lip ModuleNotFoundError: No module named 'wav2lip'

Cannot import C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip module for custom nodes: No module named 'wav2lip'

I have tried several variations of the include as well as a pip install wav2lip, with no success. I have all of the models loaded. Any ideas?

ShmuelRonen commented 4 months ago

I add dynamic path recognizing to wav2lip.py please get pull

pixelclub2024 commented 4 months ago

now i get circular import error

Traceback (most recent call last): File "C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\nodes.py", line 1866, in load_custom_node module_spec.loader.exec_module(module) File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed File "C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip__init__.py", line 1, in from .wav2lip import Wav2Lip File "C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip\wav2lip.py", line 35, in from wav2lip import Wav2Lip File "C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip\wav2lip.py", line 35, in from wav2lip import Wav2Lip ImportError: cannot import name 'Wav2Lip' from partially initialized module 'wav2lip' (most likely due to a circular import) (C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip\wav2lip.py)

Cannot import C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip module for custom nodes: cannot import name 'Wav2Lip' from partially initialized module 'wav2lip' (most likely due to a circular import) (C:\Users\user4\Desktop\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip\wav2lip.py)

ShmuelRonen commented 4 months ago

Try the new fix of wav2lip.py

pixelclub2024 commented 4 months ago

The module loads without error now. When I run the workflow it complains that is can not find the model for Wav2Lip because the path is hardcoded to an F drive in wav2lip_node.py in this line: model_path = "F:\Wav2Lip\checkpoints\wav2lip_gan.pth"

once i changed the path to the correct one, everything is working.

Thanks for your help!

start-life commented 4 months ago

Length of mel chunks: 984 Load checkpoint from: F:\Wav2Lip\checkpoints\wav2lip_gan.pth !!! Exception during processing !!! Traceback (most recent call last): File "C:\zxcv\ComfyUI_windows_portable\ComfyUI\execution.py", line 151, in recursive_execute output_data, output_ui = get_output_data(obj, input_data_all) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\zxcv\ComfyUI_windows_portable\ComfyUI\execution.py", line 81, in get_output_data return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\zxcv\ComfyUI_windows_portable\ComfyUI\execution.py", line 74, in map_node_over_list results.append(getattr(obj, func)(**slice_dict(input_data_all, i))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\zxcv\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip\wav2lip.py", line 179, in todo out_imglist = wav2lip(in_img_list, temp_audio_path, face_detect_batch, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\zxcv\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip\wav2lip\wav2lipnode.py", line 156, in wav2lip model = load_model(model_path) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\zxcv\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip\wav2lip\wav2lip_node.py", line 122, in load_model checkpoint = _load(path) ^^^^^^^^^^^ File "C:\zxcv\ComfyUI_windows_portable\ComfyUI\custom_nodes\ComfyUI_wav2lip\wav2lip\wav2lip_node.py", line 113, in _load checkpoint = torch.load(model_path) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\zxcv\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\serialization.py", line 998, in load with _open_file_like(f, 'rb') as opened_file: ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\zxcv\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\serialization.py", line 445, in _open_file_like return _open_file(name_or_buffer, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\zxcv\ComfyUI_windows_portable\python_embeded\Lib\site-packages\torch\serialization.py", line 426, in init super().init(open(name, mode)) ^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: 'F:\Wav2Lip\checkpoints\wav2lip_gan.pth'

Prompt executed in 8.07 seconds