-
Notifications
You must be signed in to change notification settings - Fork 289
[OpenVINO backend] supporting inference for Gemma, Mistral and GPT2 with ov backend #2310
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
Open
Mohamed-Ashraf273
wants to merge
10
commits into
keras-team:master
Choose a base branch
from
Mohamed-Ashraf273:supporting_gemma_inference_with_ov_backend
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
692ae90
[OpenVINO backend] supporting inference for gemma with ov backend
Mohamed-Ashraf273 2044408
remove disc mechanism
Mohamed-Ashraf273 298a319
remove unwanted code
Mohamed-Ashraf273 248c6e4
supprt model reusing by hashing
Mohamed-Ashraf273 9491573
support GPT-2 & add some modifications
Mohamed-Ashraf273 b41265a
cleaning causal_lm and avoid keras.src imports
Mohamed-Ashraf273 85b7866
update wrapped_generate_function to be more general
Mohamed-Ashraf273 3d6a09b
exclude hgnetv2 model tests
Mohamed-Ashraf273 41f9a0f
Merge branch 'master' into supporting_gemma_inference_with_ov_backend
Mohamed-Ashraf273 407c700
disable export test
Mohamed-Ashraf273 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -2,6 +2,7 @@ | |||||||||||||||||||
|
||||||||||||||||||||
import keras | ||||||||||||||||||||
import pytest | ||||||||||||||||||||
from keras.src.backend import backend | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
def pytest_addoption(parser): | ||||||||||||||||||||
|
@@ -70,6 +71,10 @@ def pytest_configure(config): | |||||||||||||||||||
"markers", | ||||||||||||||||||||
"kaggle_key_required: mark test needing a kaggle key", | ||||||||||||||||||||
) | ||||||||||||||||||||
config.addinivalue_line( | ||||||||||||||||||||
"markers", | ||||||||||||||||||||
"requires_trainable_backend: mark test for trainable backend only", | ||||||||||||||||||||
) | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
def pytest_collection_modifyitems(config, items): | ||||||||||||||||||||
|
@@ -110,6 +115,44 @@ def pytest_collection_modifyitems(config, items): | |||||||||||||||||||
if "kaggle_key_required" in item.keywords: | ||||||||||||||||||||
item.add_marker(kaggle_key_required) | ||||||||||||||||||||
|
||||||||||||||||||||
openvino_skipped_tests = [] | ||||||||||||||||||||
if backend() == "openvino": | ||||||||||||||||||||
from pathlib import Path | ||||||||||||||||||||
|
||||||||||||||||||||
workspace_root = Path(__file__).resolve().parents[0] | ||||||||||||||||||||
file_path = workspace_root / "openvino_excluded_concrete_tests.txt" | ||||||||||||||||||||
with open(file_path, "r") as file: | ||||||||||||||||||||
openvino_skipped_tests = file.readlines() | ||||||||||||||||||||
# it is necessary to check if stripped line is not empty | ||||||||||||||||||||
# and exclude such lines | ||||||||||||||||||||
openvino_skipped_tests = [ | ||||||||||||||||||||
line.strip() for line in openvino_skipped_tests if line.strip() | ||||||||||||||||||||
] | ||||||||||||||||||||
Comment on lines
+125
to
+130
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This logic for reading and processing the skipped tests file can be made more concise and memory-efficient by iterating over the file object directly instead of using
Suggested change
|
||||||||||||||||||||
|
||||||||||||||||||||
requires_trainable_backend = pytest.mark.skipif( | ||||||||||||||||||||
backend() in ["openvino"], | ||||||||||||||||||||
reason="Trainer not implemented for OpenVINO backend.", | ||||||||||||||||||||
) | ||||||||||||||||||||
|
||||||||||||||||||||
for item in items: | ||||||||||||||||||||
if "requires_trainable_backend" in item.keywords: | ||||||||||||||||||||
item.add_marker(requires_trainable_backend) | ||||||||||||||||||||
# also, skip concrete tests for openvino, listed in the special file | ||||||||||||||||||||
# this is more granular mechanism to exclude tests rather | ||||||||||||||||||||
# than using --ignore option | ||||||||||||||||||||
for skipped_test in openvino_skipped_tests: | ||||||||||||||||||||
if skipped_test in item.nodeid: | ||||||||||||||||||||
item.add_marker( | ||||||||||||||||||||
skip_if_backend( | ||||||||||||||||||||
"openvino", | ||||||||||||||||||||
"Not supported operation by openvino backend", | ||||||||||||||||||||
) | ||||||||||||||||||||
) | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
def skip_if_backend(given_backend, reason): | ||||||||||||||||||||
return pytest.mark.skipif(backend() == given_backend, reason=reason) | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
# Disable traceback filtering for quicker debugging of tests failures. | ||||||||||||||||||||
keras.config.disable_traceback_filtering() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be removed for final merge