-
Notifications
You must be signed in to change notification settings - Fork 286
[CI] [GHA] Use OV_CACHE
in the WWB tests
#2781
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
base: master
Are you sure you want to change the base?
Conversation
@akashchi any ideas about: https://github.com/openvinotoolkit/openvino.genai/actions/runs/18162007204/job/51697457952#step:7:4574
|
], | ||
) | ||
def test_image_model_types(model_id, model_type, backend, tmp_path): | ||
MODEL_PATH = os.path.join(MODEL_CACHE, model_id.replace("/", "--")) |
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.
I think we should use Path syntax there, not os
) | ||
def test_image_custom_dataset(model_id, model_type, backend, tmp_path): | ||
GT_FILE = tmp_path / "test_sd.csv" | ||
MODEL_PATH = os.path.join(MODEL_CACHE, model_id.replace("/", "--")) |
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.
Same here - looks like it's better to use Path syntax here
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.
Looks like a new Path intervenes with old string paths. Better check it once more.
I believe that this
and the error reported by @as-suvorov are not because of the |
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.
Pull Request Overview
This PR implements caching functionality in the WHO WHAT BENCHMARK (WWB) tests by leveraging the OV_CACHE
environment variable. The changes optimize test performance by reusing cached models across test runs instead of creating temporary directories each time.
- Introduces centralized cache path configuration using
OV_CACHE
environment variable - Updates all test files to use shared cache directory instead of temporary paths
- Adds conditional cleanup logic based on
CLEANUP_CACHE
environment variable
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
tools/who_what_benchmark/tests/constants.py | New file defining cache path and cleanup configuration |
tools/who_what_benchmark/tests/test_cli_vlm.py | Updates VLM tests to use cached models and remove tmp_path dependency |
tools/who_what_benchmark/tests/test_cli_text.py | Converts text tests from temporary directories to cache-based approach |
tools/who_what_benchmark/tests/test_cli_image.py | Migrates image tests to use centralized cache directory |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This reverts commit 72ab81a.
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.
Pull Request Overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
GT_FILE = tmp_path / "gt.csv" | ||
MODEL_PATH = os.path.join(MODEL_CACHE, model_id.replace("/", "--")) | ||
MODEL_PATH = MODEL_CACHE.joinpath(model_id.replace("/", "--")) | ||
MODEL_PATH = MODEL_PATH if MODEL_PATH.exists() else model_id |
Copilot
AI
Oct 6, 2025
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.
The fallback logic reassigns MODEL_PATH from a Path object to a string, creating inconsistent types. Consider using str(MODEL_PATH)
in the conditional or ensuring consistent Path usage throughout.
MODEL_PATH = MODEL_PATH if MODEL_PATH.exists() else model_id | |
MODEL_PATH = str(MODEL_PATH) if MODEL_PATH.exists() else model_id |
Copilot uses AI. Check for mistakes.
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.
The underlying from_pretrained
method accepts both str
/Path
types, so this should not be an issue.
run_wwb([ | ||
"--base-model", | ||
"Qwen/Qwen2-0.5B", | ||
'Qwen/Qwen2-0.5B', |
Copilot
AI
Oct 6, 2025
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.
[nitpick] Inconsistent quote style. The surrounding code uses double quotes, but this line uses single quotes. Consider using double quotes for consistency.
'Qwen/Qwen2-0.5B', | |
"Qwen/Qwen2-0.5B", |
Copilot uses AI. Check for mistakes.
Co-authored-by: Alexander Suvorov <[email protected]>
def setup_module(): | ||
for model_id in OV_IMAGE_MODELS: | ||
MODEL_PATH = os.path.join(MODEL_CACHE, model_id.replace("/", "--")) | ||
MODEL_PATH = MODEL_CACHE / model_id.replace("/", "--") |
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.
It seems that WWB and GenAI tests use different replacement strategies. .replace("/", "_")
in GenAI
ov_cache = os.path.join(os.environ["OV_CACHE"], date_subfolder) | ||
try: | ||
optimum_intel_version = metadata.version("optimum-intel") | ||
transformers_version = metadata.version("transformers") | ||
ov_cache = os.path.join(ov_cache, f"optimum-intel-{optimum_intel_version}_transformers-{transformers_version}") |
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.
ov_cache = os.path.join(os.environ["OV_CACHE"], date_subfolder) | |
try: | |
optimum_intel_version = metadata.version("optimum-intel") | |
transformers_version = metadata.version("transformers") | |
ov_cache = os.path.join(ov_cache, f"optimum-intel-{optimum_intel_version}_transformers-{transformers_version}") | |
ov_cache = Path(os.environ["OV_CACHE"]) / date_subfolder | |
try: | |
optimum_intel_version = metadata.version("optimum-intel") | |
transformers_version = metadata.version("transformers") | |
ov_cache = ov_cache / f"optimum-intel-{optimum_intel_version}_transformers-{transformers_version}" |
ov_cache = temp_dir.name | ||
return Path(ov_cache) / "wwb_cache" |
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.
ov_cache = temp_dir.name | |
return Path(ov_cache) / "wwb_cache" | |
ov_cache = Path(temp_dir.name) | |
return ov_cache / "wwb_cache" |
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.
Could be a conftest.py
. should_cleanup
and wwb_cache_path
could be session fixtures.
def setup_module(): | ||
for model_id in OV_IMAGE_MODELS: | ||
MODEL_PATH = os.path.join(MODEL_CACHE, model_id.replace("/", "--")) | ||
MODEL_PATH = MODEL_CACHE / model_id.replace("/", "--") | ||
subprocess.run(["optimum-cli", "export", "openvino", "--model", model_id, MODEL_PATH], capture_output=True, text=True) | ||
|
||
|
||
def teardown_module(): | ||
logger.info("Remove models") | ||
shutil.rmtree(MODEL_CACHE) | ||
if SHOULD_CLEANUP: | ||
logger.info("Removing models") | ||
shutil.rmtree(MODEL_CACHE) |
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.
def setup_module(): | |
for model_id in OV_IMAGE_MODELS: | |
MODEL_PATH = os.path.join(MODEL_CACHE, model_id.replace("/", "--")) | |
MODEL_PATH = MODEL_CACHE / model_id.replace("/", "--") | |
subprocess.run(["optimum-cli", "export", "openvino", "--model", model_id, MODEL_PATH], capture_output=True, text=True) | |
def teardown_module(): | |
logger.info("Remove models") | |
shutil.rmtree(MODEL_CACHE) | |
if SHOULD_CLEANUP: | |
logger.info("Removing models") | |
shutil.rmtree(MODEL_CACHE) | |
@pytest.fixture(scope="module", autouse=True) | |
def setup_module(wwb_cache_path, should_cleanup): | |
for model_id in OV_IMAGE_MODELS: | |
MODEL_PATH = wwb_cache_path / model_id.replace("/", "--") | |
subprocess.run(["optimum-cli", "export", "openvino", "--model", model_id, MODEL_PATH], capture_output=True, text=True) | |
yield | |
if should_cleanup: | |
logger.info("Removing models") | |
shutil.rmtree(wwb_cache_path) |
@apaniukov good comments. Don't you mind to address them in a separate PR? I want to merge this PR asap to unblock other PR |
…nvino.genai into ci/gha/ov-cache-wwb
No description provided.