Skip to content

Commit 302fd50

Browse files
authored
[GHA] Replaced genai-tools pipeline (#1954)
Moved genai-tools to the Linux Tools workflow
1 parent ed77f66 commit 302fd50

File tree

4 files changed

+287
-187
lines changed

4 files changed

+287
-187
lines changed

.github/workflows/genai-tools.yml

Lines changed: 0 additions & 183 deletions
This file was deleted.

.github/workflows/linux.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ jobs:
578578
uses: ./src/.github/actions/install_wheel
579579
with:
580580
packages: "openvino_tokenizers[transformers];openvino_genai[testing]"
581-
requirements_files: "${{ env.SRC_DIR }}/samples/requirements.txt"
581+
requirements_files: "${{ env.SRC_DIR }}/samples/requirements.txt;${{ env.SRC_DIR }}/tools/llm_bench/requirements.txt"
582582
local_wheel_dir: ${{ env.INSTALL_DIR }}/wheels
583583

584584
- name: gtests
@@ -587,12 +587,19 @@ jobs:
587587
chmod +x ${{ env.INSTALL_DIR }}/tests/tests_continuous_batching
588588
${{ env.INSTALL_DIR }}/tests/tests_continuous_batching
589589
590-
- name: Test C++ Tools
590+
- name: Test Continuous Batching Tools
591591
run: |
592592
source ${{ env.INSTALL_DIR }}/setupvars.sh
593593
python -m pytest -vs ${{ env.SRC_DIR }}/tests/python_tests/samples/test_continuous_batching_tools.py -m "samples"
594594
env:
595595
SAMPLES_CPP_DIR: "${{ env.INSTALL_DIR }}/samples_bin"
596+
597+
- name: Test LLM Benchmark Tools
598+
run: |
599+
source ${{ env.INSTALL_DIR }}/setupvars.sh
600+
python -m pytest -vs ${{ env.SRC_DIR }}/tests/python_tests/samples/test_tools_llm_benchmark.py -m "samples"
601+
env:
602+
SAMPLES_PY_DIR: "${{ env.SRC_DIR }}/tools"
596603

597604
genai_nodejs_tests:
598605
name: Node.js bindings tests

tests/python_tests/samples/conftest.py

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import subprocess # nosec B404
22
import os
3+
import json
34
import pytest
45
import shutil
56
import logging
@@ -89,6 +90,30 @@
8990
"name": "Qwen/Qwen2-VL-2B-Instruct",
9091
"convert_args": ['--trust-remote-code']
9192
},
93+
"tiny-dummy-qwen2": {
94+
"name": "fxmarty/tiny-dummy-qwen2",
95+
"convert_args": ['--trust-remote-code']
96+
},
97+
"tiny-random-qwen2": {
98+
"name": "fxmarty/tiny-dummy-qwen2",
99+
"convert_args": ["--task", "text-generation-with-past", "--weight-format", "fp16"]
100+
},
101+
"tiny-random-qwen2-int8": {
102+
"name": "fxmarty/tiny-dummy-qwen2",
103+
"convert_args": ["--task", "text-generation-with-past", "--weight-format", "int8"]
104+
},
105+
"tiny-random-latent-consistency": {
106+
"name": "echarlaix/tiny-random-latent-consistency",
107+
"convert_args": ['--trust-remote-code', '--weight-format', 'fp16']
108+
},
109+
"tiny-random-latent-consistency-lora": {
110+
"name": "katuni4ka/tiny-random-latent-consistency-lora",
111+
"convert_args": []
112+
},
113+
"tiny-random-llava": {
114+
"name": "katuni4ka/tiny-random-llava",
115+
"convert_args": ["--trust-remote-code", "--task", "image-text-to-text"]
116+
},
92117
}
93118

94119
TEST_FILES = {
@@ -99,6 +124,11 @@
99124
"ShareGPT_V3_unfiltered_cleaned_split.json": "https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json",
100125
"images/image.png": "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png",
101126
"mask_image.png": "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png",
127+
"overture-creations.png": "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png",
128+
"overture-creations-mask.png": "https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png",
129+
"cat.png": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png",
130+
"cat": "https://github.com/openvinotoolkit/openvino_notebooks/assets/29454499/d5fbbd1a-d484-415c-88cb-9986625b7b11",
131+
"3283_1447_000.tar.gz": "https://huggingface.co/datasets/facebook/multilingual_librispeech/resolve/main/data/mls_polish/train/audio/3283_1447_000.tar.gz"
102132
}
103133

104134
SAMPLES_PY_DIR = os.environ.get("SAMPLES_PY_DIR", os.path.abspath(os.path.join(os.path.dirname(__file__), "../../../samples/python")))
@@ -196,13 +226,14 @@ def download_model(request):
196226

197227
@pytest.fixture(scope="session")
198228
def download_test_content(request):
199-
"""Download the test content from the given URL and return the file path."""
229+
"""Download the test content from the given URL and return the file path or extracted folder."""
200230

201231
test_data = request.config.cache.get("TEST_DATA", None)
202232

203233
file_name = request.param
204234
file_url = TEST_FILES[file_name]
205235
file_path = os.path.join(test_data, file_name)
236+
206237
if not os.path.exists(file_path):
207238
logger.info(f"Downloading test content from {file_url} to {file_path}...")
208239
os.makedirs(os.path.dirname(file_path), exist_ok=True)
@@ -214,9 +245,26 @@ def download_test_content(request):
214245
logger.info(f"Downloaded test content to {file_path}")
215246
else:
216247
logger.info(f"Test content already exists at {file_path}")
217-
yield file_path
248+
249+
# If the file is a tarball, extract it
250+
extracted_dir = None
251+
if file_name.endswith(".tar.gz"):
252+
extracted_dir = os.path.join(test_data, os.path.splitext(file_name)[0])
253+
if not os.path.exists(extracted_dir):
254+
os.makedirs(extracted_dir, exist_ok=True)
255+
shutil.unpack_archive(file_path, extracted_dir)
256+
logger.info(f"Extracted tarball to {extracted_dir}")
257+
else:
258+
logger.info(f"Extracted folder already exists at {extracted_dir}")
259+
yield extracted_dir
260+
else:
261+
yield file_path
262+
218263
# Cleanup the test content after tests
219264
if os.environ.get("CLEANUP_CACHE", "false").lower() == "true":
265+
if extracted_dir and os.path.exists(extracted_dir):
266+
logger.info(f"Removing extracted folder: {extracted_dir}")
267+
shutil.rmtree(extracted_dir)
220268
if os.path.exists(file_path):
221269
logger.info(f"Removing test content: {file_path}")
222270
os.remove(file_path)
@@ -250,6 +298,32 @@ def generate_test_content(request):
250298
logger.info(f"Removing test content: {file_path}")
251299
os.remove(file_path)
252300

301+
@pytest.fixture(scope="session")
302+
def generate_image_generation_jsonl(request):
303+
"""Generate a JSONL file for image generation prompts."""
304+
305+
test_data = request.config.cache.get("TEST_DATA", None)
306+
file_name, json_entries = request.param
307+
file_path = os.path.join(test_data, file_name)
308+
309+
if not os.path.exists(file_path):
310+
os.makedirs(os.path.dirname(file_path), exist_ok=True)
311+
312+
with open(file_path, "w") as f:
313+
for entry in json_entries:
314+
f.write(json.dumps(entry) + "\n")
315+
316+
logger.info(f"Generated image generation JSONL file at {file_path}")
317+
else:
318+
logger.info(f"Image generation JSONL file already exists at {file_path}")
319+
320+
yield file_path
321+
322+
# Cleanup the JSONL file after tests
323+
if os.environ.get("CLEANUP_CACHE", "false").lower() == "true":
324+
if os.path.exists(file_path):
325+
logger.info(f"Removing JSONL file: {file_path}")
326+
os.remove(file_path)
253327

254328
@pytest.fixture(scope="module", autouse=True)
255329
def run_gc_after_test():

0 commit comments

Comments
 (0)