[Model Hub Tests] Fix caching for read_model scenario (#24355)

**Details:** Fix caching for read_model scenario

**Ticket:** TBD

---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
This commit is contained in:
Roman Kazantsev 2024-05-15 17:58:54 +04:00 committed by GitHub
parent cf5bf71802
commit da66abcbe9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1 additions and 8 deletions

View File

@ -22,6 +22,7 @@ tf_hub_cache_dir = os.environ.get('TFHUB_CACHE_DIR',
os.path.join(tempfile.gettempdir(), "tfhub_modules"))
hf_cache_dir = os.environ.get('HF_HUB_CACHE',
os.path.join(tempfile.gettempdir(), "hugging_face"))
# update environment variables if temporal directory is used
os.environ['TFHUB_CACHE_DIR'] = tf_hub_cache_dir
os.environ['HF_HUB_CACHE'] = hf_cache_dir

View File

@ -13,7 +13,6 @@ import tensorflow.compat.v1 as tf_v1
import tensorflow_hub as hub
# noinspection PyUnresolvedReferences
import tensorflow_text # do not delete, needed for text models
from models_hub_common.constants import tf_hub_cache_dir, hf_cache_dir
from models_hub_common.test_convert_model import TestConvertModel
from models_hub_common.utils import get_models_list
from openvino import Core

View File

@ -10,7 +10,6 @@ import tensorflow as tf
import tensorflow_hub as hub
# noinspection PyUnresolvedReferences
import tensorflow_text # do not delete, needed for text models
from models_hub_common.constants import tf_hub_cache_dir, hf_cache_dir
from models_hub_common.test_convert_model import TestConvertModel
from models_hub_common.utils import get_models_list
from openvino import Core, PartialShape
@ -126,12 +125,6 @@ class TestTFReadModel(TestConvertModel):
pass
def teardown_method(self):
# remove all downloaded files for TF Hub models
self._clean_dir(tf_hub_cache_dir)
# remove all downloaded files for HF models
self._clean_dir(hf_cache_dir)
# deallocate memory after each test case
gc.collect()