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

Fix of cusolver error on GPU #110

Merged
merged 17 commits into from
Sep 12, 2023
Merged

Fix of cusolver error on GPU #110

merged 17 commits into from
Sep 12, 2023

Conversation

Ghassen-Chaabouni
Copy link
Contributor

@Ghassen-Chaabouni Ghassen-Chaabouni commented Sep 5, 2023

Description

A fix for this error

torch\nn\functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at  ..\c10/core/TensorImpl.h:1156.)
  return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
torch\nn\functional.py:3609: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
  warnings.warn(
Exception in Tkinter callback

Traceback (most recent call last):
  File "tkinter\__init__.py", line 1892, in __call__
  File "customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked
    self._command()
  File "ui.py", line 702, in start_button_event
  File "dot\__main__.py", line 67, in run
  File "dot\dot.py", line 131, in generate
  File "dot\commons\model_option.py", line 185, in generate_from_camera
  File "dot\commons\camera_utils.py", line 71, in camera_pipeline
  File "dot\simswap\option.py", line 180, in process_image
  File "dot\simswap\util\reverse2original.py", line 136, in reverse2wholeimage
RuntimeError: cusolver error: CUSOLVER_STATUS_INTERNAL_ERROR, when calling `cusolverDnCreate(handle)`

Using torch.linalg.inv results in an error on GPU RTX 4000 series.

Fixes #94, #106

Changelog:

Added:

  • Added cupy to the requirements

Updated:

  • everse2original.py to use cp.linalg.inv instead of torch.linalg.inv on GPU

Fixed:

  • cusolver error on GPU

@Ghassen-Chaabouni Ghassen-Chaabouni added the bug Something isn't working label Sep 5, 2023
@Ghassen-Chaabouni Ghassen-Chaabouni self-assigned this Sep 5, 2023
@Ghassen-Chaabouni
Copy link
Contributor Author

I generated the executable. It's available here. It needs to be tested.

@Ghassen-Chaabouni
Copy link
Contributor Author

This error is due the torch.linalg.inv function. I replaced it with the same function from cupy.
The executable was tested and this change seemed to fix the error
#106 (comment)

@Ghassen-Chaabouni Ghassen-Chaabouni marked this pull request as ready for review September 7, 2023 10:22
@Ghassen-Chaabouni Ghassen-Chaabouni merged commit e13d4b0 into main Sep 12, 2023
2 checks passed
@Ghassen-Chaabouni Ghassen-Chaabouni deleted the fix-RuntimeError branch September 12, 2023 12:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants