Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[GHA] Enable parallel execution of MO Python API python tests (#26512)

Hubert Błaszczykd84bb3c2b923
diff --git a/.github/workflows/job_python_unit_tests.yml b/.github/workflows/job_python_unit_tests.yml
index 81767c7805f..5ce582bc144 100644
--- a/.github/workflows/job_python_unit_tests.yml
+++ b/.github/workflows/job_python_unit_tests.yml
@@ -177,7 +177,7 @@ jobs:
export LD_PRELOAD=${GOMP_LIB}
fi
- python3 -m pytest ${LAYER_TESTS_INSTALL_DIR}/mo_python_api_tests --junitxml=${INSTALL_TEST_DIR}/TEST-test_mo_convert.xml
+ python3 -m pytest ${LAYER_TESTS_INSTALL_DIR}/mo_python_api_tests -n logical --junitxml=${INSTALL_TEST_DIR}/TEST-test_mo_convert.xml
env:
TEST_DEVICE: CPU
TEST_PRECISION: FP16
diff --git a/tests/layer_tests/mo_python_api_tests/test_mo_convert_onnx.py b/tests/layer_tests/mo_python_api_tests/test_mo_convert_onnx.py
index 66e76ccef79..ddc636c4efe 100644
--- a/tests/layer_tests/mo_python_api_tests/test_mo_convert_onnx.py
+++ b/tests/layer_tests/mo_python_api_tests/test_mo_convert_onnx.py
@@ -67,13 +67,13 @@ def create_bytes_io():
class TestMoConvertONNX(CommonMOConvertTest):
- test_data = [create_bytes_io]
+ test_data = ['create_bytes_io']
@pytest.mark.parametrize("create_model", test_data)
@pytest.mark.nightly
@pytest.mark.precommit
def test_mo_convert_onnx(self, create_model, ie_device, precision, ir_version,
temp_dir):
- fw_model, graph_ref, mo_params = create_model()
+ fw_model, graph_ref, mo_params = eval(create_model)()
test_params = {'input_model': fw_model}
if mo_params is not None:
diff --git a/tests/layer_tests/mo_python_api_tests/test_mo_convert_paddle.py b/tests/layer_tests/mo_python_api_tests/test_mo_convert_paddle.py
index cff20f45ae2..600646e4589 100644
--- a/tests/layer_tests/mo_python_api_tests/test_mo_convert_paddle.py
+++ b/tests/layer_tests/mo_python_api_tests/test_mo_convert_paddle.py
@@ -88,15 +88,15 @@ def create_paddle_hapi_module(tmp_dir):
class TestMoConvertPaddle(CommonMOConvertTest):
test_data = [
- create_paddle_dynamic_module,
- create_paddle_static_module,
- create_paddle_hapi_module
+ 'create_paddle_dynamic_module',
+ 'create_paddle_static_module',
+ 'create_paddle_hapi_module'
]
@pytest.mark.skip(reason="Paddlepaddle has incompatible protobuf. Ticket: 95904")
@pytest.mark.parametrize("create_model", test_data)
def test_mo_import_from_memory_paddle_fe(self, create_model, ie_device, precision, ir_version,
temp_dir):
- fw_model, graph_ref, mo_params = create_model(temp_dir)
+ fw_model, graph_ref, mo_params = eval(create_model)(temp_dir)
test_params = {'input_model': fw_model}
if mo_params is not None:
test_params.update(mo_params)
diff --git a/tests/layer_tests/mo_python_api_tests/test_mo_convert_pytorch.py b/tests/layer_tests/mo_python_api_tests/test_mo_convert_pytorch.py
index 3085a24c22c..f08bf42822f 100644
--- a/tests/layer_tests/mo_python_api_tests/test_mo_convert_pytorch.py
+++ b/tests/layer_tests/mo_python_api_tests/test_mo_convert_pytorch.py
@@ -958,53 +958,53 @@ def create_pytorch_module_with_nested_inputs6(tmp_dir):
class TestMoConvertPyTorch(CommonMOConvertTest):
test_data = [
- create_pytorch_nn_module_case1,
- create_pytorch_nn_module_case2,
- create_pytorch_nn_module_case3,
- create_pytorch_nn_module_case4,
- create_pytorch_nn_module_case5,
- create_pytorch_nn_module_case6,
- create_pytorch_nn_module_case7,
- create_pytorch_nn_module_torch_size,
- create_pytorch_nn_module_sample_input_int32,
- create_pytorch_nn_module_sample_input_int32_two_inputs,
- create_pytorch_jit_script_module,
- create_pytorch_jit_script_function,
- create_pytorch_nn_module_layout_list,
- create_pytorch_nn_module_layout_list_case2,
- create_pytorch_nn_module_mean_list_compression_default,
- create_pytorch_nn_module_mean_list_compression_disabled,
- create_pytorch_nn_module_mean_list_compression_enabled,
- create_pytorch_nn_module_scale_list_compression_default,
- create_pytorch_nn_module_scale_list_compression_disabled,
- create_pytorch_nn_module_scale_list_compression_enabled,
- create_pytorch_nn_module_shapes_list_static,
- create_pytorch_nn_module_shapes_list_static_via_input,
- create_pytorch_nn_module_shapes_list_dynamic,
- create_pytorch_nn_module_shapes_list_dynamic_via_input,
- create_pytorch_nn_module_shapes_list_dynamic_single_input,
- create_pytorch_nn_module_shapes_list_static_single_input,
- create_pytorch_nn_module_shapes_list_dynamic_single_input_via_input,
- create_pytorch_nn_module_shapes_list_static_single_input_via_input,
- create_pytorch_nn_module_convert_pytorch_frontend1,
- create_pytorch_nn_module_convert_pytorch_frontend2,
- create_pytorch_nn_module_convert_pytorch_frontend3,
- create_pytorch_nn_module_convert_pytorch_frontend4,
- create_pytorch_jit_script_module_convert_pytorch_frontend,
- create_pytorch_jit_trace_module_convert_pytorch_frontend,
- create_pytorch_module_convert_pytorch_frontend_oob,
- create_pytorch_module_with_optional_inputs_case1,
- create_pytorch_module_with_optional_inputs_case2,
- create_pytorch_module_with_optional_inputs_case3,
- create_pytorch_nn_module_with_scalar_input,
- create_pytorch_module_with_compressed_int8_constant,
- create_pytorch_module_with_compressed_int8_constant_compress_to_fp16_default,
- create_pytorch_module_with_nested_inputs,
- create_pytorch_module_with_nested_inputs2,
- create_pytorch_module_with_nested_inputs3,
- create_pytorch_module_with_nested_inputs4,
- create_pytorch_module_with_nested_inputs5,
- create_pytorch_module_with_nested_inputs6
+ 'create_pytorch_nn_module_case1',
+ 'create_pytorch_nn_module_case2',
+ 'create_pytorch_nn_module_case3',
+ 'create_pytorch_nn_module_case4',
+ 'create_pytorch_nn_module_case5',
+ 'create_pytorch_nn_module_case6',
+ 'create_pytorch_nn_module_case7',
+ 'create_pytorch_nn_module_torch_size',
+ 'create_pytorch_nn_module_sample_input_int32',
+ 'create_pytorch_nn_module_sample_input_int32_two_inputs',
+ 'create_pytorch_jit_script_module',
+ 'create_pytorch_jit_script_function',
+ 'create_pytorch_nn_module_layout_list',
+ 'create_pytorch_nn_module_layout_list_case2',
+ 'create_pytorch_nn_module_mean_list_compression_default',
+ 'create_pytorch_nn_module_mean_list_compression_disabled',
+ 'create_pytorch_nn_module_mean_list_compression_enabled',
+ 'create_pytorch_nn_module_scale_list_compression_default',
+ 'create_pytorch_nn_module_scale_list_compression_disabled',
+ 'create_pytorch_nn_module_scale_list_compression_enabled',
+ 'create_pytorch_nn_module_shapes_list_static',
+ 'create_pytorch_nn_module_shapes_list_static_via_input',
+ 'create_pytorch_nn_module_shapes_list_dynamic',
+ 'create_pytorch_nn_module_shapes_list_dynamic_via_input',
+ 'create_pytorch_nn_module_shapes_list_dynamic_single_input',
+ 'create_pytorch_nn_module_shapes_list_static_single_input',
+ 'create_pytorch_nn_module_shapes_list_dynamic_single_input_via_input',
+ 'create_pytorch_nn_module_shapes_list_static_single_input_via_input',
+ 'create_pytorch_nn_module_convert_pytorch_frontend1',
+ 'create_pytorch_nn_module_convert_pytorch_frontend2',
+ 'create_pytorch_nn_module_convert_pytorch_frontend3',
+ 'create_pytorch_nn_module_convert_pytorch_frontend4',
+ 'create_pytorch_jit_script_module_convert_pytorch_frontend',
+ 'create_pytorch_jit_trace_module_convert_pytorch_frontend',
+ 'create_pytorch_module_convert_pytorch_frontend_oob',
+ 'create_pytorch_module_with_optional_inputs_case1',
+ 'create_pytorch_module_with_optional_inputs_case2',
+ 'create_pytorch_module_with_optional_inputs_case3',
+ 'create_pytorch_nn_module_with_scalar_input',
+ 'create_pytorch_module_with_compressed_int8_constant',
+ 'create_pytorch_module_with_compressed_int8_constant_compress_to_fp16_default',
+ 'create_pytorch_module_with_nested_inputs',
+ 'create_pytorch_module_with_nested_inputs2',
+ 'create_pytorch_module_with_nested_inputs3',
+ 'create_pytorch_module_with_nested_inputs4',
+ 'create_pytorch_module_with_nested_inputs5',
+ 'create_pytorch_module_with_nested_inputs6'
]
@pytest.mark.parametrize("create_model", test_data)
@@ -1012,7 +1012,7 @@ class TestMoConvertPyTorch(CommonMOConvertTest):
@pytest.mark.precommit
def test_mo_import_from_memory(self, create_model, ie_device, precision, ir_version,
temp_dir, use_legacy_frontend):
- fw_model, graph_ref, mo_params = create_model(temp_dir)
+ fw_model, graph_ref, mo_params = eval(create_model)(temp_dir)
test_params = {'input_model': fw_model}
test_params.update({'use_convert_model_from_mo': True})
@@ -1225,13 +1225,13 @@ def create_pytorch_not_precision_sensitive(tmp_dir):
class TestPrecisionSensitive():
test_data = [
- create_pytorch_layer_norm,
- create_pytorch_normalize,
- create_pytorch_precision_sensitive_with_div,
- create_pytorch_precision_sensitive_div_as_pow,
- create_pytorch_precision_sensitive_for_exp_reduce,
- create_pytorch_precision_sensitive_two_inp_1,
- create_pytorch_precision_sensitive_two_inp_2,
+ 'create_pytorch_layer_norm',
+ 'create_pytorch_normalize',
+ 'create_pytorch_precision_sensitive_with_div',
+ 'create_pytorch_precision_sensitive_div_as_pow',
+ 'create_pytorch_precision_sensitive_for_exp_reduce',
+ 'create_pytorch_precision_sensitive_two_inp_1',
+ 'create_pytorch_precision_sensitive_two_inp_2',
]
@pytest.mark.parametrize("create_model", test_data)
@@ -1245,7 +1245,7 @@ class TestPrecisionSensitive():
import numpy.testing as npt
from pathlib import Path
- fw_model, ref_model, mo_params = create_model(temp_dir)
+ fw_model, ref_model, mo_params = eval(create_model)(temp_dir)
test_params = {'input_model': fw_model}
if mo_params is not None:
diff --git a/tests/layer_tests/mo_python_api_tests/test_mo_convert_tf.py b/tests/layer_tests/mo_python_api_tests/test_mo_convert_tf.py
index 8dfd99a594a..960e8e08457 100644
--- a/tests/layer_tests/mo_python_api_tests/test_mo_convert_tf.py
+++ b/tests/layer_tests/mo_python_api_tests/test_mo_convert_tf.py
@@ -749,36 +749,36 @@ def static_shape_false(temp_dir):
class TestMoConvertTF(CommonMOConvertTest):
test_data = [
# TF2
- create_keras_model,
- create_keras_layer,
- create_tf_function,
- create_tf_module,
- create_tf_checkpoint,
- create_keras_layer_dynamic,
- create_tf_module_dynamic,
- create_tf_module_layout_list,
- create_tf_stateful_partioned_call_net,
- create_keras_layer_with_example_input_1,
- create_keras_layer_with_example_input_2,
- create_keras_layer_with_input_shapes_case1,
- create_keras_layer_with_input_shapes_case2,
- create_keras_layer_with_input_shapes_case3,
+ 'create_keras_model',
+ 'create_keras_layer',
+ 'create_tf_function',
+ 'create_tf_module',
+ 'create_tf_checkpoint',
+ 'create_keras_layer_dynamic',
+ 'create_tf_module_dynamic',
+ 'create_tf_module_layout_list',
+ 'create_tf_stateful_partioned_call_net',
+ 'create_keras_layer_with_example_input_1',
+ 'create_keras_layer_with_example_input_2',
+ 'create_keras_layer_with_input_shapes_case1',
+ 'create_keras_layer_with_input_shapes_case2',
+ 'create_keras_layer_with_input_shapes_case3',
# can skip since this is legacy MO
# create_keras_layer_with_input_shapes_case4,
- create_keras_layer_with_tf_function_call,
- create_keras_layer_with_tf_function_call_default_compressed_to_fp16,
- create_keras_layer_with_tf_function_call_no_signature,
- create_keras_layer_with_tf_function_call_no_signature_single_input,
- create_keras_layer_with_string_tensor,
- shape_of_const_fold_test,
- static_shape_true,
- static_shape_false,
+ 'create_keras_layer_with_tf_function_call',
+ 'create_keras_layer_with_tf_function_call_default_compressed_to_fp16',
+ 'create_keras_layer_with_tf_function_call_no_signature',
+ 'create_keras_layer_with_tf_function_call_no_signature_single_input',
+ 'create_keras_layer_with_string_tensor',
+ 'shape_of_const_fold_test',
+ 'static_shape_true',
+ 'static_shape_false',
# TF1
- create_tf_graph,
- create_tf_graph_def,
- create_tf1_wrap_function,
- create_tf_session,
+ 'create_tf_graph',
+ 'create_tf_graph_def',
+ 'create_tf1_wrap_function',
+ 'create_tf_session',
]
@pytest.mark.parametrize("create_model", test_data)
@@ -787,7 +787,7 @@ class TestMoConvertTF(CommonMOConvertTest):
@pytest.mark.precommit
def test_mo_import_from_memory_tf_fe(self, create_model, ie_device, precision, ir_version,
temp_dir):
- fw_model, graph_ref, mo_params = create_model(temp_dir)
+ fw_model, graph_ref, mo_params = eval(create_model)(temp_dir)
test_params = {'input_model': fw_model}
test_params.update({'use_convert_model_from_mo': True})