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

Error occurred when executing Load Face Swap Model (mtb) [bug] #95

Closed
conniecombs opened this issue Sep 10, 2023 · 6 comments
Closed

Error occurred when executing Load Face Swap Model (mtb) [bug] #95

conniecombs opened this issue Sep 10, 2023 · 6 comments
Assignees
Labels
🎭 Face nodes Related to the faceswap or facerestore nodes status: 🧹 needs triage This issue needs to triage, applied to new issues type: 🐛 bug Something isn't working

Comments

@conniecombs
Copy link

Describe the bug

I am getting an error when using Load Face Swap Model (mtb) using the inswapper_128.onnx model.

[ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from G:\ComfyUI_windows_portable\ComfyUI\models\insightface\inswapper_128.onnx failed:Protobuf parsing failed.

File "G:\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
File "G:\ComfyUI_windows_portable\ComfyUI\execution.py", line 82, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
File "G:\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
File "G:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfy_mtb\nodes\faceswap.py", line 98, in load_model
onnxruntime.InferenceSession(
File "G:\ComfyUI_windows_portable\python_embeded\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 383, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "G:\ComfyUI_windows_portable\python_embeded\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 424, in _create_inference_session
sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)

Any assistance would be appreciated

Reproduction

I have not been able to stop the behavior other than removing the node from the workflow

Expected behavior

No response

Operating System

Windows (Default)

Comfy Mode

Comfy Portable (embed) (Default)

Console output

!!! Exception during processing !!!
Traceback (most recent call last):
  File "G:\ComfyUI_windows_portable\ComfyUI\execution.py", line 152, in recursive_execute
    output_data, output_ui = get_output_data(obj, input_data_all)
  File "G:\ComfyUI_windows_portable\ComfyUI\execution.py", line 82, in get_output_data
    return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
  File "G:\ComfyUI_windows_portable\ComfyUI\execution.py", line 75, in map_node_over_list
    results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
  File "G:\ComfyUI_windows_portable\ComfyUI\custom_nodes\comfy_mtb\nodes\faceswap.py", line 98, in load_model
    onnxruntime.InferenceSession(
  File "G:\ComfyUI_windows_portable\python_embeded\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 383, in __init__
    self._create_inference_session(providers, provider_options, disabled_optimizers)
  File "G:\ComfyUI_windows_portable\python_embeded\lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py", line 424, in _create_inference_session
    sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidProtobuf: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from G:\ComfyUI_windows_portable\ComfyUI\models\insightface\inswapper_128.onnx failed:Protobuf parsing failed.

Additional context

No response

@conniecombs conniecombs added status: 🧹 needs triage This issue needs to triage, applied to new issues type: 🐛 bug Something isn't working labels Sep 10, 2023
@melMass
Copy link
Owner

melMass commented Sep 10, 2023

Hi please post logs in the section called Console output in the issue template.

The error is pretty clear: INVALID_PROTOBUF

There is a growing raise of issues here about onnx unfortunately none provide information useful to help sort it out.

In your case I think it's just a protobuf compatibility issue.
If you know how to run pip you can just install protobuf==3.19.6 in your comfy env

@melMass melMass added the 🎭 Face nodes Related to the faceswap or facerestore nodes label Sep 13, 2023
@mard
Copy link

mard commented Sep 15, 2023

I had the same issue, I was able to work around that on my own.

If you use Windows, first make sure you installed required dependencies from custom_nodes\comfy_mtb\reqs_windows.txt. If you use virtual environment, you can do it by typing.

python -m venv venv
.\venv\Scripts\pip.exe install -r .\custom_nodes\comfy_mtb\reqs_windows.txt

Be aware that insightface removed their inswapper_128.onnx model from releases, and maintainer didn't update download URLs. File created is just a plain text file with "Not Found" or something like that. To get it fixed, you must find and download inswapper_128.onnx manually, then replace the corrupted model file in your ComfyUI\models\insightface directory. You can find the link to it in the issue comments in the URL above.

Same story with buffalo_m model. It can be found here.

Then I was successful with using both inswapper_128.onnx and buffalo_m with no issues.

As for pth models, they don't work with Load Face Swap Model. I think it's supposed to worth with onnx models anyway.

I also found some additional PTH files to download, but I'm not sure if they can be useful or not.

@alenknight
Copy link

custom_nodes\comfy_mtb\reqs_windows.txt

I'm having same issue. how do you install dependencies from reqs_windows.txt?

@melMass melMass added this to the Release of v0.2.0 milestone Sep 25, 2023
@Famekrafts
Copy link

I had the same issue, I was able to work around that on my own.

If you use Windows, first make sure you installed required dependencies from custom_nodes\comfy_mtb\reqs_windows.txt. If you use virtual environment, you can do it by typing.

python -m venv venv
.\venv\Scripts\pip.exe install -r .\custom_nodes\comfy_mtb\reqs_windows.txt

Be aware that insightface removed their inswapper_128.onnx model from releases, and maintainer didn't update download URLs. File created is just a plain text file with "Not Found" or something like that. To get it fixed, you must find and download inswapper_128.onnx manually, then replace the corrupted model file in your ComfyUI\models\insightface directory. You can find the link to it in the issue comments in the URL above.

Same story with buffalo_m model. It can be found here.

Then I was successful with using both inswapper_128.onnx and buffalo_m with no issues.

As for pth models, they don't work with Load Face Swap Model. I think it's supposed to worth with onnx models anyway.

I also found some additional PTH files to download, but I'm not sure if they can be useful or not.

Where to install the buffalo file?

It is reading the inswapper_128.onx now but not reading the Buffalo file.

This is an error I get -
face swap error

I am not a coder so no idea what error it is and cannot find anything on google about how to fix this.

@melMass
Copy link
Owner

melMass commented Oct 4, 2023

@Famekrafts you probably did not run the install. There are issues with it that will get fixed this week so in the meantime:

Download anthelopev2 from here: https://drive.google.com/uc?id=18wEUfMNohBJ4K3Ly5wpTejPfDzp-8fI8

And extract it to "ComfyUI/models/insightface/models/antelopev2" like so:

image

@Famekrafts
Copy link

Ok Mel. I will wait for the issues to get fixed.

Till then I am using photoshop and image to image to swap faces.

@melMass melMass closed this as completed in 5dfea51 Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎭 Face nodes Related to the faceswap or facerestore nodes status: 🧹 needs triage This issue needs to triage, applied to new issues type: 🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants