Skip to content

Conversation

akashchi
Copy link
Contributor

@akashchi akashchi commented Oct 1, 2025

No description provided.

@akashchi akashchi added this to the 2025.4 milestone Oct 1, 2025
@akashchi akashchi added the WIP label Oct 1, 2025
@github-actions github-actions bot added the category: WWB PR changes WWB label Oct 1, 2025
@as-suvorov
Copy link
Collaborator

@akashchi any ideas about: https://github.com/openvinotoolkit/openvino.genai/actions/runs/18162007204/job/51697457952#step:7:4574

ERROR tools/who_what_benchmark/tests/test_cli_text.py::test_text_target_model - OSError: Can't load tokenizer for 'facebook/opt-125m'. If you were trying to load it from 'https://huggingface.co/models', make sure you don't have a local directory with the same name. Otherwise, make sure 'facebook/opt-125m' is the correct path to a directory containing all relevant files for a GPT2TokenizerFast tokenizer. ?

],
)
def test_image_model_types(model_id, model_type, backend, tmp_path):
MODEL_PATH = os.path.join(MODEL_CACHE, model_id.replace("/", "--"))
Copy link

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("/", "--"))
Copy link

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

Copy link

@sgonorov sgonorov left a 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.

@akashchi
Copy link
Contributor Author

akashchi commented Oct 1, 2025

I believe that this

Looks like a new Path intervenes with old string paths. Better check it once more.

and the error reported by @as-suvorov are not because of the Path/os.path but because models were not present on the share and thus could not be used by path and firstly needed to be downloaded by model_id and then used by the full paths. I am working on it.

@akashchi akashchi marked this pull request as ready for review October 2, 2025 07:30
@Copilot Copilot AI review requested due to automatic review settings October 2, 2025 07:30
Copy link
Contributor

@Copilot Copilot AI left a 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.

@github-actions github-actions bot added category: continuous batching Continuous batching category: whisper Whisper pipeline category: GGUF GGUF file reader labels Oct 2, 2025
@github-actions github-actions bot added category: GHA CI based on Github actions and removed category: continuous batching Continuous batching category: whisper Whisper pipeline category: GGUF GGUF file reader labels Oct 2, 2025
@akashchi akashchi requested a review from Copilot October 6, 2025 12:12
Copy link
Contributor

@Copilot Copilot AI left a 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
Copy link

Copilot AI Oct 6, 2025

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.

Suggested change
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.

Copy link
Contributor Author

@akashchi akashchi Oct 6, 2025

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',
Copy link

Copilot AI Oct 6, 2025

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.

Suggested change
'Qwen/Qwen2-0.5B',
"Qwen/Qwen2-0.5B",

Copilot uses AI. Check for mistakes.

@as-suvorov as-suvorov requested a review from sbalandi October 6, 2025 14:05
@akashchi akashchi requested a review from as-suvorov October 7, 2025 08:49
@as-suvorov as-suvorov mentioned this pull request Oct 7, 2025
3 tasks
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("/", "--")
Copy link
Contributor

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

Comment on lines +14 to +18
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}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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}"

Comment on lines +22 to +23
ov_cache = temp_dir.name
return Path(ov_cache) / "wwb_cache"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
ov_cache = temp_dir.name
return Path(ov_cache) / "wwb_cache"
ov_cache = Path(temp_dir.name)
return ov_cache / "wwb_cache"

Copy link
Contributor

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.

Comment on lines 39 to +48
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)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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)

@as-suvorov
Copy link
Collaborator

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: GHA CI based on Github actions category: WWB PR changes WWB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants