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

[Issue]: Insightface inswapper onnx error #3812

Open
2 tasks done
bli1348 opened this issue Mar 12, 2025 · 3 comments
Open
2 tasks done

[Issue]: Insightface inswapper onnx error #3812

bli1348 opened this issue Mar 12, 2025 · 3 comments
Labels
cannot reproduce Reported issue cannot be easily reproducible question Further information is requested

Comments

@bli1348
Copy link

bli1348 commented Mar 12, 2025

Issue Description

Since reactor extension's shut down, I try to use script->insightface inswapper, but onxx runtime error occurs
running onnx 1.17.0 onnxruntime 1.20.1

23:49:53-025499 DEBUG    InsightFace: mp=buffalo_l provider=['OpenVINOExecutionProvider', 'CPUExecutionProvider']
23:49:55-582665 ERROR    Exception: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from
                         C:\Users\bb\.cache\huggingface\hub\models--ezioruan--inswapper_128.onnx\snapshots\6ffdf0e83c599
                         6cc425e77b59913fc48d79441be\inswapper_128.onnx failed:Protobuf parsing failed.
23:49:55-584666 ERROR    Arguments: args=('task(bwpt3ca05di82eh)', '', 'a girl, bikin, climbing out of a swimming pool',
                         'low quality', [], 20, 0, 46, 'Full', False, False, False, '', '', 10, 0.3, 1, 1, 6, 6, 0.7, 0,
                         0.5, 1, 1, -1.0, -1.0, 0, 0, 0, 1024, 1024, False, 0.3, 1, 1, 'Add with forward', 'None',
                         False, 20, 0, 0, 20, 0, '', '', 0, 0, 0, 0, False, 4, 0.95, False, 0.6, 1, '#000000', 0, [], 6,
                         1, False, 'None', 'None', 'None', 'None', 0.5, 0.5, 0.5, 0.5, None, None, None, None, False,
                         False, False, False, 0, 0, 0, 0, 1, 1, 1, 1, None, None, None, None, False, '', False, 0, '',
                         [], 0, '', [], 0, '', [], False, True, False, True, False, False, False, False, 0, False,
                         'None', 2, True, 1, 0, 1, -0.5, 0, 'constant', 1, 'constant', 1, '', '', '', 0.5, True, True,
                         False, True, True, False, '0.6, 0.4, 1.1, 1.2', '10, 20, 0.8', False, '', 0.5, 5, None, '',
                         0.5, 5, None, 3, 1, 1, 0.8, 8, 64, True, 'FaceSwap', [{'name':
                         'C:\\Users\\bb\\AppData\\Local\\Temp\\gradio\\tmp9a7cpkf3.png', 'data':
                         'http://localhost:7860/file=C:\\Users\\bb\\AppData\\Local\\Temp\\gradio\\tmp9a7cpkf3.png',
                         'is_file': True}], 'ReSwapper 256 0.2', False, 'FaceID Base', True, True, 1, 1, 1, 0.5, True,
                         'PhotoMaker v2', '', 1, 0.5, True, 2, True, 1, 35, True, 1, 0.75, True, 2, 0.75, False, 3,
                         0.75, False, 4, 0.75, 0.65, True, False, 1, 1, 1, '', True, 0.5, 600.0, 1.0, True, None, 1, 0,
                         0, 0, 0, 0, 0, 0, 1, 1, 1, 0.5, 0.5, 1, 1, 128, 128, '', '', '', '', '', '', '', '', '', '',
                         '', '', '', '', '', '', 'OpenGVLab/InternVL-14B-224px', 20, False, 0.7, 1.2, 128, False, False,
                         'positive', 'comma', 0, False, False, '', [], 0.8, 20, 'dpmpp_sde', 'v2', False, True, 'v1.1',
                         'None', '', 1, '', 'None', 1, '7,8,9', 1, 0.01, 0.2, None, '', False, ['attention',
                         'adain_queries', 'adain_keys'], 1, 0, 0, True, 10, 22, True, 'None', 2, True, 1, 0, 'None', 16,
                         'None', 1, True, 'None', 2, True, 1, 0, True, 'none', 3, 4, 0.25, 0.25, 'THUDM/CogVideoX-2b',
                         'DDIM', 49, 6, 'balanced', True, 'None', 2, True, 1, 0, None, None, 'HunyuanVideo', 45, 16,
                         True, 7, 'Describe the video by detailing the following aspects:\n1. The main content and theme
                         of the video.\n2. The color, shape, size, texture, quantity, text, and spatial relationships of
                         the objects.\n3. Actions, events, behaviors temporal relationships, physical movement changes
                         of the objects.\n4. Background environment, light, style and atmosphere.\n5. Camera angles,
                         movements, and transitions used in the video.\n6. Thematic and aesthetic concepts associated
                         with the scene, i.e. realistic, futuristic, fairy tale, etc.\n', 'None', 2, True, 1, 0,
                         '0.9.1', '', 'diffusers', True, 41, 'None', 2, True, 1, 0, False, 0.03, 45, 'None', 2, True, 1,
                         0, 'None', True, 0, 'None', 2, True, 1, 0, 0, '', [], 0, '', [], 0, '', [], False, True, False,
                         True, False, False, False, False, 0, False, 'None', 2, True, 1, 0) kwargs={}
23:49:55-593132 ERROR    gradio call: InvalidProtobuf
╭───────────────────────────────────────── Traceback (most recent call last) ──────────────────────────────────────────╮
│ C:\Users\bb\sdnext\modules\call_queue.py:31 in f                                                                     │
│                                                                                                                      │
│   30 │   │   │   try:                                                                                                │
│ ❱ 31 │   │   │   │   res = func(*args, **kwargs)                                                                     │
│   32 │   │   │   │   progress.record_results(id_task, res)                                                           │
│                                                                                                                      │
│ C:\Users\bb\sdnext\modules\txt2img.py:96 in txt2img                                                                  │
│                                                                                                                      │
│    95 │   p.state = state                                                                                            │
│ ❱  96 │   processed: processing.Processed = scripts.scripts_txt2img.run(p, *args)                                    │
│    97 │   if processed is None:                                                                                      │
│                                                                                                                      │
│ C:\Users\bb\sdnext\modules\scripts.py:528 in run                                                                     │
│                                                                                                                      │
│   527 │   │   if hasattr(script, 'run'):                                                                             │
│ ❱ 528 │   │   │   processed = script.run(p, *parsed)                                                                 │
│   529 │   │   else:                                                                                                  │
│                                                                                                                      │
│ C:\Users\bb\sdnext\modules\face\__init__.py:161 in run                                                               │
│                                                                                                                      │
│   160 │   │   │   from modules.face.faceswap import face_swap                                                        │
│ ❱ 161 │   │   │   processed.images = face_swap(p, app=app, input_images=processed.images, source_image=input_images[ │
│   162 │   │   elif mode == 'ReSwapper':                                                                              │
│                                                                                                                      │
│ C:\Users\bb\sdnext\modules\face\faceswap.py:22 in face_swap                                                          │
│                                                                                                                      │
│   21 │   │   router: insightface.model_zoo.model_zoo.INSwapper = insightface.model_zoo.model_zoo.ModelRouter(model_p │
│ ❱ 22 │   │   swapper = router.get_model()                                                                            │
│   23                                                                                                                 │
│                                                                                                                      │
│ C:\Users\bb\sdnext\venv\Lib\site-packages\insightface\model_zoo\model_zoo.py:40 in get_model                         │
│                                                                                                                      │
│   39 │   def get_model(self, **kwargs):                                                                              │
│ ❱ 40 │   │   session = PickableInferenceSession(self.onnx_file, **kwargs)                                            │
│   41 │   │   print(f'Applied providers: {session._providers}, with options: {session._provider_options}')            │
│                                                                                                                      │
│ C:\Users\bb\sdnext\venv\Lib\site-packages\insightface\model_zoo\model_zoo.py:25 in __init__                          │
│                                                                                                                      │
│   24 │   def __init__(self, model_path, **kwargs):                                                                   │
│ ❱ 25 │   │   super().__init__(model_path, **kwargs)                                                                  │
│   26 │   │   self.model_path = model_path                                                                            │
│                                                                                                                      │
│ C:\Users\bb\sdnext\venv\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py:465 in __init__       │
│                                                                                                                      │
│    464 │   │   try:                                                                                                  │
│ ❱  465 │   │   │   self._create_inference_session(providers, provider_options, disabled_optimizers)                  │
│    466 │   │   except (ValueError, RuntimeError) as e:                                                               │
│                                                                                                                      │
│ C:\Users\bb\sdnext\venv\Lib\site-packages\onnxruntime\capi\onnxruntime_inference_collection.py:526 in _create_infere │
│                                                                                                                      │
│    525 │   │   if self._model_path:                                                                                  │
│ ❱  526 │   │   │   sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)  │
│    527 │   │   else:                                                                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
InvalidProtobuf: [ONNXRuntimeError] : 7 : INVALID_PROTOBUF : Load model from C:\Users\bb\.cache\huggingface\hub\models--ezioruan--inswapper_128.onnx\snapshots\6ffdf0e83c5996cc425e77b59913fc48d79441be\inswapper_128.onnx failed:Protobuf parsing failed.

Version Platform Description

No response

Relevant log output

Backend

Diffusers

UI

Standard

Branch

Master

Model

StableDiffusion XL

Acknowledgements

  • I have read the above and searched for existing issues
  • I confirm that this is classified correctly and its not an extension issue
@vladmandic
Copy link
Owner

i cant reproduce.
i just pushed an update that will log additional info, so please update (using dev branch)
uninstall insightface first and delete folder C:\Users\bb\.cache\huggingface\hub\models--ezioruan--inswapper_128.onnx

@vladmandic vladmandic added question Further information is requested cannot reproduce Reported issue cannot be easily reproducible labels Mar 16, 2025
@bli1348
Copy link
Author

bli1348 commented Mar 18, 2025

followed your instructoin using dev. Now insightface works but having the following error when installing insightface

23:13:55-801301 DEBUG Install: package="insightface" install required
23:14:00-441353 DEBUG Server: alive=True requests=325 memory=6.61/15.87 status='running' task='Image'
timestamp='20250318231140' id='task(xzeateo32y9rhty)' job=0 jobs=0 total=1 step=0 steps=0
queued=0 uptime=354 elapsed=139.99 eta=None progress=0
23:14:44-952444 ERROR Install: pip: install --upgrade --force pydantic==1.10.21
23:14:44-954445 DEBUG Install: pip output Collecting pydantic==1.10.21
Downloading pydantic-1.10.21-cp311-cp311-win_amd64.whl.metadata (155 kB)
------------------------------------- 155.3/155.3 kB 81.4 kB/s eta 0:00:00
Collecting typing-extensions>=4.2.0 (from pydantic==1.10.21)
Downloading typing_extensions-4.12.2-py3-none-any.whl.metadata (3.0 kB)
Downloading pydantic-1.10.21-cp311-cp311-win_amd64.whl (2.3 MB)
--------------------- 1.3/2.3 MB 77.8 kB/s eta 0:00:14

                     ERROR: Exception:
                     Traceback (most recent call last):
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 438,
                     in _error_catcher
                         yield
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 561,
                     in read
                         data = self._fp_read(amt) if not fp_closed else b""
                                ^^^^^^^^^^^^^^^^^^
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 527,
                     in _fp_read
                         return self._fp.read(amt) if amt is not None else self._fp.read()
                                ^^^^^^^^^^^^^^^^^^
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py",
                     line 98, in read
                         data: bytes = self.__fp.read(amt)
                                       ^^^^^^^^^^^^^^^^^^^
                       File "C:\Users\bb\AppData\Local\Programs\Python\Python311\Lib\http\client.py", line 473, in
                     read
                         s = self.fp.read(amt)
                             ^^^^^^^^^^^^^^^^^
                       File "C:\Users\bb\AppData\Local\Programs\Python\Python311\Lib\socket.py", line 706, in
                     readinto
                         return self._sock.recv_into(b)
                                ^^^^^^^^^^^^^^^^^^^^^^^
                       File "C:\Users\bb\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1314, in
                     recv_into
                         return self.read(nbytes, buffer)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^
                       File "C:\Users\bb\AppData\Local\Programs\Python\Python311\Lib\ssl.py", line 1166, in read
                         return self._sslobj.read(len, buffer)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     TimeoutError: The read operation timed out

                     During handling of the above exception, another exception occurred:

                     Traceback (most recent call last):
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_internal\cli\base_command.py", line 180,
                     in exc_logging_wrapper
                         status = run_func(*args)
                                  ^^^^^^^^^^^^^^^
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_internal\cli\req_command.py", line 245,
                     in wrapper
                         return func(self, options, args)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_internal\commands\install.py", line 377,
                     in run
                         requirement_set = resolver.resolve(
                                           ^^^^^^^^^^^^^^^^^
                       File
                     "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py",
                     line 179, in resolve
                         self.factory.preparer.prepare_linked_requirements_more(reqs)
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_internal\operations\prepare.py", line
                     552, in prepare_linked_requirements_more
                         self._complete_partial_requirements(
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_internal\operations\prepare.py", line
                     467, in _complete_partial_requirements
                         for link, (filepath, _) in batch_download:
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_internal\network\download.py", line 183,
                     in __call__
                         for chunk in chunks:
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_internal\cli\progress_bars.py", line 53,
                     in _rich_progress_bar
                         for chunk in iterable:
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_internal\network\utils.py", line 63, in
                     response_chunks
                         for chunk in response.raw.stream(
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 622,
                     in stream
                         data = self.read(amt=amt, decode_content=decode_content)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 560,
                     in read
                         with self._error_catcher():
                       File "C:\Users\bb\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 158, in
                     __exit__
                         self.gen.throw(typ, value, traceback)
                       File "C:\Users\bb\sdnext\venv\Lib\site-packages\pip\_vendor\urllib3\response.py", line 443,
                     in _error_catcher
                         raise ReadTimeoutError(self._pool, None, "Read timed out.")
                     pip._vendor.urllib3.exceptions.ReadTimeoutError:
                     HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

                     [notice] A new release of pip is available: 24.0 -> 25.0.1
                     [notice] To update, run: C:\Users\bb\sdnext\venv\Scripts\python.exe -m pip install --upgrade
                     pip

23:14:45-037464 DEBUG Reload: package=pydantic version=1.10.21
23:14:45-829643 DEBUG InsightFace: version=0.7.3 mp=buffalo_l provider=['OpenVINOExecutionProvider',
'CPUExecutionProvider']
*************** EP Error ***************
EP Error C:\Users\Administrator\Desktop\windows_perf\release_validation_1.20.0\final_build\onnxruntime\onnxruntime\core\session\provider_bridge_ort.cc:1539 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\bb\sdnext\venv\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_openvino.dll"
when using ['OpenVINOExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CPUExecutionProvider'] and retrying.


*************** EP Error ***************
EP Error C:\Users\Administrator\Desktop\windows_perf\release_validation_1.20.0\final_build\onnxruntime\onnxruntime\core\session\provider_bridge_ort.cc:1539 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\bb\sdnext\venv\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_openvino.dll"
when using ['OpenVINOExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CPUExecutionProvider'] and retrying.


*************** EP Error ***************
EP Error C:\Users\Administrator\Desktop\windows_perf\release_validation_1.20.0\final_build\onnxruntime\onnxruntime\core\session\provider_bridge_ort.cc:1539 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\bb\sdnext\venv\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_openvino.dll"
when using ['OpenVINOExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CPUExecutionProvider'] and retrying.


*************** EP Error ***************
EP Error C:\Users\Administrator\Desktop\windows_perf\release_validation_1.20.0\final_build\onnxruntime\onnxruntime\core\session\provider_bridge_ort.cc:1539 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\bb\sdnext\venv\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_openvino.dll"
when using ['OpenVINOExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CPUExecutionProvider'] and retrying.


*************** EP Error ***************
EP Error C:\Users\Administrator\Desktop\windows_perf\release_validation_1.20.0\final_build\onnxruntime\onnxruntime\core\session\provider_bridge_ort.cc:1539 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\Users\bb\sdnext\venv\Lib\site-packages\onnxruntime\capi\onnxruntime_providers_openvino.dll"
when using ['OpenVINOExecutionProvider', 'CPUExecutionProvider']
Falling back to ['CPUExecutionProvider'] and retrying.


inswapper_128.onnx: 66%|███████████████████████████████████████ | 367M/554M [01:09<00:44, 4.25MB/s]23:16:00-064473 DEBUG Server: alive=True requests=349 memory=7.01/15.87 status='running' task='Image'
timestamp='20250318231140' id='task(xzeateo32y9rhty)' job=0 jobs=0 total=1 step=0 steps=0
queued=0 uptime=474 elapsed=259.62 eta=None progress=0
inswapper_128.onnx: 100%|███████████████████████████████████████████████████████████| 554M/554M [01:52<00:00, 4.91MB/s]
23:16:42-095001 DEBUG FaceSwap load: repo="ezioruan/inswapper_128.onnx"
path="C:\Users\bb.cache\huggingface\hub\models--ezioruan--inswapper_128.onnx\snapshots\6ffdf0e
83c5996cc425e77b59913fc48d79441be\inswapper_128.onnx"
inswapper-shape: [1, 3, 128, 128]
23:16:45-257734 INFO Save: image="outputs\image\00018-2025-03-18-Juggernaut-XL_v9_RunDiffusionPhoto_v2.jpg"
type=JPEG width=1024 height=1024 size=189682
23:18:00-392767 DEBUG Server: alive=True requests=375 memory=7.74/15.87 status='running' task='Image'
timestamp='20250318231140' id='' job=0 jobs=0 total=1 step=0 steps=0 queued=0 uptime=594
elapsed=379.94 eta=None progress=0

@vladmandic
Copy link
Owner

try settings ONNX Execution Provider = CPUExecutionProvider in system -> settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cannot reproduce Reported issue cannot be easily reproducible question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants