[TF Hub] Set seed for input data generation and fix integer input data (#19765)
* [TF Hub] Set seed for input data generation and fix integer input data Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com> * Clean-up workflow * Update precommit model scope * Avoid legacy generator --------- Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
This commit is contained in:
parent
9250d17e01
commit
d1a8c8f914
2
.github/workflows/linux.yml
vendored
2
.github/workflows/linux.yml
vendored
@ -850,8 +850,6 @@ jobs:
|
||||
|
||||
- name: TensorFlow Hub Tests - TF FE
|
||||
run: |
|
||||
python3 -m pip install openvino --find-links=${{ env.INSTALL_DIR }}/tools
|
||||
|
||||
python3 -m pip install -r ${{ env.MODEL_HUB_TESTS_INSTALL_DIR }}/tf_hub_tests/requirements.txt
|
||||
|
||||
export PYTHONPATH=${{ env.MODEL_HUB_TESTS_INSTALL_DIR }}:$PYTHONPATH
|
||||
|
@ -7,6 +7,10 @@ from models_hub_common.multiprocessing_utils import multiprocessing_run
|
||||
from openvino import convert_model
|
||||
from openvino.runtime import Core
|
||||
|
||||
# set seed to have deterministic input data generation
|
||||
# to avoid sporadic issues in inference results
|
||||
rng = np.random.default_rng(seed=56190)
|
||||
|
||||
|
||||
class TestConvertModel:
|
||||
infer_timeout = 600
|
||||
@ -19,15 +23,13 @@ class TestConvertModel:
|
||||
|
||||
def prepare_input(self, input_shape, input_type):
|
||||
if input_type in [np.float32, np.float64]:
|
||||
return np.random.randint(-2, 2, size=input_shape).astype(input_type)
|
||||
elif input_type in [np.int8, np.int16, np.int32, np.int64]:
|
||||
return np.random.randint(-5, 5, size=input_shape).astype(input_type)
|
||||
elif input_type in [np.uint8, np.uint16]:
|
||||
return np.random.randint(0, 5, size=input_shape).astype(input_type)
|
||||
return 2.0 * rng.random(size=input_shape, dtype=input_type)
|
||||
elif input_type in [np.uint8, np.uint16, np.int8, np.int16, np.int32, np.int64]:
|
||||
return rng.integers(0, 5, size=input_shape).astype(input_type)
|
||||
elif input_type in [str]:
|
||||
return np.broadcast_to("Some string", input_shape)
|
||||
elif input_type in [bool]:
|
||||
return np.random.randint(0, 2, size=input_shape).astype(input_type)
|
||||
return rng.integers(0, 2, size=input_shape).astype(input_type)
|
||||
else:
|
||||
assert False, "Unsupported type {}".format(input_type)
|
||||
|
||||
|
@ -8,9 +8,10 @@ movenet/multipose/lightning,https://tfhub.dev/google/movenet/multipose/lightning
|
||||
imagenet/efficientnet_v2_imagenet1k_b0/feature_vector,https://tfhub.dev/google/imagenet/efficientnet_v2_imagenet1k_b0/feature_vector/2?tf-hub-format=compressed
|
||||
imagenet/mobilenet_v1_100_224/classification,https://tfhub.dev/google/imagenet/mobilenet_v1_100_224/classification/5?tf-hub-format=compressed,skip,119718 - Accuracy issue
|
||||
magenta/arbitrary-image-stylization-v1-256,https://tfhub.dev/google/magenta/arbitrary-image-stylization-v1-256/2?tf-hub-format=compressed
|
||||
small_bert/bert_en_uncased_L-4_H-256_A-4,https://tfhub.dev/tensorflow/small_bert/bert_en_uncased_L-4_H-256_A-4/2?tf-hub-format=compressed,skip,119718 - Accuracy issue
|
||||
# secure notebook models
|
||||
unet/industrial/class_1,https://tfhub.dev/nvidia/unet/industrial/class_1/1?tf-hub-format=compressed
|
||||
movenet/singlepose/thunder,https://tfhub.dev/google/movenet/singlepose/thunder/4?tf-hub-format=compressed
|
||||
esrgan-tf2,https://tfhub.dev/captain-pool/esrgan-tf2/1?tf-hub-format=compressed
|
||||
film,https://tfhub.dev/google/film/1?tf-hub-format=compressed,skip,119907 - incorrect test data
|
||||
film,https://tfhub.dev/google/film/1?tf-hub-format=compressed,skip,119718 - Accuracy issue
|
||||
planet/vision/classifier/planet_v2,https://tfhub.dev/google/planet/vision/classifier/planet_v2/1?tf-hub-format=compressed
|
Loading…
Reference in New Issue
Block a user