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

Remove duplicate backend registration from torch 2.5 #27245

Merged
merged 4 commits into from
Oct 27, 2024

Conversation

suryasidd
Copy link
Contributor

Details:

  • In torch 2.5.0, pytorch is registering the backends from entrypoints and we don't have to register the backend again. If we register it twice, torch throws a duplicate registration error.

Tickets:

  • ticket-id

@suryasidd suryasidd requested a review from a team as a code owner October 25, 2024 07:26
@github-actions github-actions bot added category: Python API OpenVINO Python bindings category: PyTorch FE OpenVINO PyTorch Frontend labels Oct 25, 2024
@akuporos akuporos requested a review from mvafin October 25, 2024 07:32
Comment on lines +64 to +68
from packaging import version

if version.parse(torch.__version__) < version.parse("2.5.0"):
register_backend(compiler_fn=openvino, name="openvino")
except ImportError:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

may be it is better to check if backend is registered by this code?

if not hasattr(torch.backends, 'openvino') or not torch.backends.openvino.is_available()

that is torch version agnostic approach

Copy link
Contributor

@mvafin mvafin Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, this can be improved. However I am not sure if the registered backends list can be easily accessible. Lets merge this PR as is and consider this improvement for future @suryasidd

@mvafin mvafin enabled auto-merge October 25, 2024 09:10
@mvafin
Copy link
Contributor

mvafin commented Oct 25, 2024

build_jenkins

@suryasidd
Copy link
Contributor Author

build_jenkins

@mvafin mvafin added this pull request to the merge queue Oct 27, 2024
Merged via the queue into openvinotoolkit:master with commit 4a33ad8 Oct 27, 2024
165 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Python API OpenVINO Python bindings category: PyTorch FE OpenVINO PyTorch Frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants