[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:
parent
cf5bf71802
commit
da66abcbe9
|
|
@ -22,6 +22,7 @@ tf_hub_cache_dir = os.environ.get('TFHUB_CACHE_DIR',
|
||||||
os.path.join(tempfile.gettempdir(), "tfhub_modules"))
|
os.path.join(tempfile.gettempdir(), "tfhub_modules"))
|
||||||
hf_cache_dir = os.environ.get('HF_HUB_CACHE',
|
hf_cache_dir = os.environ.get('HF_HUB_CACHE',
|
||||||
os.path.join(tempfile.gettempdir(), "hugging_face"))
|
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['TFHUB_CACHE_DIR'] = tf_hub_cache_dir
|
||||||
os.environ['HF_HUB_CACHE'] = hf_cache_dir
|
os.environ['HF_HUB_CACHE'] = hf_cache_dir
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import tensorflow.compat.v1 as tf_v1
|
||||||
import tensorflow_hub as hub
|
import tensorflow_hub as hub
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
import tensorflow_text # do not delete, needed for text models
|
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.test_convert_model import TestConvertModel
|
||||||
from models_hub_common.utils import get_models_list
|
from models_hub_common.utils import get_models_list
|
||||||
from openvino import Core
|
from openvino import Core
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import tensorflow as tf
|
||||||
import tensorflow_hub as hub
|
import tensorflow_hub as hub
|
||||||
# noinspection PyUnresolvedReferences
|
# noinspection PyUnresolvedReferences
|
||||||
import tensorflow_text # do not delete, needed for text models
|
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.test_convert_model import TestConvertModel
|
||||||
from models_hub_common.utils import get_models_list
|
from models_hub_common.utils import get_models_list
|
||||||
from openvino import Core, PartialShape
|
from openvino import Core, PartialShape
|
||||||
|
|
@ -126,12 +125,6 @@ class TestTFReadModel(TestConvertModel):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def teardown_method(self):
|
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
|
# deallocate memory after each test case
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue