From 73ab0dd065fd720fe9a082d14852adea370834a1 Mon Sep 17 00:00:00 2001 From: Bogdan Pereanu Date: Wed, 5 Apr 2023 11:16:27 +0300 Subject: [PATCH] Fixing run_timest python script for input and output precision (#16661) * Fixing run_timest python script for input and output precision * Update code according to the PR review * Update run_timetest according to the last review * Add input_precision and output_precision to test_timetest as well * Set input/output precision per model --- tests/time_tests/scripts/run_timetest.py | 10 ++++++---- tests/time_tests/test_runner/test_timetest.py | 8 ++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/time_tests/scripts/run_timetest.py b/tests/time_tests/scripts/run_timetest.py index d935f48aa7d..24795f790e4 100644 --- a/tests/time_tests/scripts/run_timetest.py +++ b/tests/time_tests/scripts/run_timetest.py @@ -61,8 +61,8 @@ def prepare_executable_cmd(args: dict): str(args["executable"].resolve(strict=True)), "-m", str(args["model"].resolve(strict=True)), "-d", args["device"], - "-ip", args["input_precision"], - "-op", args["output_precision"], + *["-ip", args["input_precision"] if args["input_precision"] else ""], + *["-op", args["output_precision"] if args["output_precision"] else ""], "-c" if args["model_cache"] else "" ] @@ -146,13 +146,15 @@ def cli_parser(): action="store_true", help="Enable model cache usage") parser.add_argument("-ip", + default="", dest="input_precision", type=str, - help="Model input precision") + help="Change input model precision") parser.add_argument("-op", + default="", dest="output_precision", type=str, - help="Model output precision") + help="Change output model precision") args = parser.parse_args() diff --git a/tests/time_tests/test_runner/test_timetest.py b/tests/time_tests/test_runner/test_timetest.py index 1ada3f82f2d..28acb628545 100644 --- a/tests/time_tests/test_runner/test_timetest.py +++ b/tests/time_tests/test_runner/test_timetest.py @@ -56,6 +56,12 @@ def test_timetest(instance, executable, niter, cl_cache_dir, model_cache, model_ assert model_path, "Model path is empty" model_path = Path(expand_env_vars(model_path)) + # Prepare input precision from model configuration + input_precision = instance["model"].get("input_precision") + + # Prepare output precision from model configuration + output_precision = instance["model"].get("output_precision") + # Copy model to a local temporary directory model_dir = temp_dir / "model" shutil.copytree(model_path.parent, model_dir) @@ -67,6 +73,8 @@ def test_timetest(instance, executable, niter, cl_cache_dir, model_cache, model_ "model": Path(model_path), "device": instance["device"]["name"], "niter": niter, + "input_precision": input_precision, + "output_precision": output_precision, "model_cache": model_cache, } logging.info("Run timetest once to generate any cache")