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
This commit is contained in:
parent
f2d4c96032
commit
73ab0dd065
@ -61,8 +61,8 @@ def prepare_executable_cmd(args: dict):
|
|||||||
str(args["executable"].resolve(strict=True)),
|
str(args["executable"].resolve(strict=True)),
|
||||||
"-m", str(args["model"].resolve(strict=True)),
|
"-m", str(args["model"].resolve(strict=True)),
|
||||||
"-d", args["device"],
|
"-d", args["device"],
|
||||||
"-ip", args["input_precision"],
|
*["-ip", args["input_precision"] if args["input_precision"] else ""],
|
||||||
"-op", args["output_precision"],
|
*["-op", args["output_precision"] if args["output_precision"] else ""],
|
||||||
"-c" if args["model_cache"] else ""
|
"-c" if args["model_cache"] else ""
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -146,13 +146,15 @@ def cli_parser():
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="Enable model cache usage")
|
help="Enable model cache usage")
|
||||||
parser.add_argument("-ip",
|
parser.add_argument("-ip",
|
||||||
|
default="",
|
||||||
dest="input_precision",
|
dest="input_precision",
|
||||||
type=str,
|
type=str,
|
||||||
help="Model input precision")
|
help="Change input model precision")
|
||||||
parser.add_argument("-op",
|
parser.add_argument("-op",
|
||||||
|
default="",
|
||||||
dest="output_precision",
|
dest="output_precision",
|
||||||
type=str,
|
type=str,
|
||||||
help="Model output precision")
|
help="Change output model precision")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -56,6 +56,12 @@ def test_timetest(instance, executable, niter, cl_cache_dir, model_cache, model_
|
|||||||
assert model_path, "Model path is empty"
|
assert model_path, "Model path is empty"
|
||||||
model_path = Path(expand_env_vars(model_path))
|
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
|
# Copy model to a local temporary directory
|
||||||
model_dir = temp_dir / "model"
|
model_dir = temp_dir / "model"
|
||||||
shutil.copytree(model_path.parent, model_dir)
|
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),
|
"model": Path(model_path),
|
||||||
"device": instance["device"]["name"],
|
"device": instance["device"]["name"],
|
||||||
"niter": niter,
|
"niter": niter,
|
||||||
|
"input_precision": input_precision,
|
||||||
|
"output_precision": output_precision,
|
||||||
"model_cache": model_cache,
|
"model_cache": model_cache,
|
||||||
}
|
}
|
||||||
logging.info("Run timetest once to generate any cache")
|
logging.info("Run timetest once to generate any cache")
|
||||||
|
Loading…
Reference in New Issue
Block a user