Skip to content

Conversation

@mahimairaja
Copy link
Contributor

@mahimairaja mahimairaja commented Sep 19, 2023

Details:

Added single dispatch generic function implementation

Tickets:

Refactor torchvision preprocessing converter into Python singledispatch
Closes #19912

@mahimairaja mahimairaja requested a review from a team as a code owner September 19, 2023 17:15
@github-actions github-actions bot added the category: Python API OpenVINO Python bindings label Sep 19, 2023
@ilya-lavrenov
Copy link
Contributor

build_jenkins

@ilya-lavrenov ilya-lavrenov added the ExternalPR External contributor label Sep 19, 2023
@mahimairaja
Copy link
Contributor Author

I am new to jenkins, is there any docs to build jenkins...

@mlukasze
Copy link
Contributor

I am new to jenkins, is there any docs to build jenkins...

Ilya's comment was in a fact command to run our Jenkins for you, so no, you don't have to do anything :)

@mahimairaja
Copy link
Contributor Author

Gotcha!

Copy link
Contributor

@p-wysocki p-wysocki left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for your contribution!

@jiwaszki do you know if we can merge this PR before #19534 is merged? Python 3.7 does not have built-in singledispatch, but I see that data_dispatcher.py also doesn't do any magic with importing it, so I suppose this PR will work with Python 3.7, right? Until we get an answer, I'm putting on a do_not_merge label.

@mahimairaja could you please take a look at Python API checks? It seems that mypy is failing. Please keep in mind that if fixing the mypy issue isn't practical, skipping the line is an option too.

@mahimairaja
Copy link
Contributor Author

Thank you @p-wysocki :)

@mahimairaja
Copy link
Contributor Author

mahimairaja commented Sep 20, 2023

I am not sure, I added the return type and added the patches for linting only but the build has failed...

@p-wysocki
Copy link
Contributor

@mahimairaja that seems like a sporadic Azure error, I restarted the pipeline.

@p-wysocki
Copy link
Contributor

./src/openvino/preprocess/torchvision/torchvision_preprocessing.py:57:32: E261 at least two spaces before inline comment
    return int(size), int(size) # type: ignore

@ilya-lavrenov

This comment was marked as outdated.

@ilya-lavrenov ilya-lavrenov added this to the 2023.2 milestone Sep 20, 2023
@mahimairaja
Copy link
Contributor Author

Is the PR is good to go? @p-wysocki

@mlukasze
Copy link
Contributor

Is the PR is good to go? @p-wysocki

we are waiting for last CI checks, but from code review perspective it looks like ready to merge :)

@p-wysocki
Copy link
Contributor

There were some CI failures, but nothing on your side I think. I merged master, it helped on another PR with the same issue. Let's hope CI passes now.

@ilya-lavrenov

This comment was marked as outdated.

@ilya-lavrenov
Copy link
Contributor

build_jenkins

@jiwaszki
Copy link

LGTM, thank you for your contribution!

@jiwaszki do you know if we can merge this PR before #19534 is merged? Python 3.7 does not have built-in singledispatch, but I see that data_dispatcher.py also doesn't do any magic with importing it, so I suppose this PR will work with Python 3.7, right? Until we get an answer, I'm putting on a do_not_merge label.

@p-wysocki yes, it will work.

# TODO: remove this WA and refactor OVDict when Python3.8
# becomes minimal supported version.
try:
from functools import singledispatchmethod
except ImportError:
from singledispatchmethod import singledispatchmethod # type: ignore[no-redef]
-- only class methods are not "dispatchable" in <3.8.

I am going to remove the label.

Copy link

@jiwaszki jiwaszki left a comment

Choose a reason for hiding this comment

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

LGTM

@ilya-lavrenov ilya-lavrenov merged commit 39f6cbf into openvinotoolkit:master Sep 25, 2023
@mahimairaja
Copy link
Contributor Author

Thank you team :)

alvoron pushed a commit to alvoron/openvino that referenced this pull request Nov 6, 2023
…vinotoolkit#19958)

* Refactored with single dispatch generic function implementation

* Resolved mypy linting warnings

* Update src/bindings/python/src/openvino/preprocess/torchvision/torchvision_preprocessing.py

* Update src/bindings/python/src/openvino/preprocess/torchvision/torchvision_preprocessing.py

---------

Co-authored-by: Przemyslaw Wysocki <przemyslaw.wysocki@intel.com>
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 ExternalPR External contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Good First Issue]: Refactor torchvision preprocessing converter into Python singledispatch

6 participants