[PT FE] Use system model cache when running torch hub tests locally (#21047)
* Use system model cache when running torch hub tests locally * Update tests/model_hub_tests/torch_tests/test_torchvision_models.py * Update tests/model_hub_tests/torch_tests/test_torchvision_models.py
This commit is contained in:
parent
5ef7c02bdf
commit
369831caef
|
|
@ -1435,6 +1435,7 @@ jobs:
|
|||
env:
|
||||
TYPE: ${{ github.event_name == 'schedule' && 'nightly' || 'precommit'}}
|
||||
TEST_DEVICE: CPU
|
||||
USE_SYSTEM_CACHE: False
|
||||
|
||||
- name: Available storage after tests
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ tf_hub_cache_dir = os.environ.get('TFHUB_CACHE_DIR',
|
|||
os.path.join(tempfile.gettempdir(), "tfhub_modules"))
|
||||
os.environ['TFHUB_CACHE_DIR'] = tf_hub_cache_dir
|
||||
|
||||
hf_hub_cache_dir = os.environ.get('HUGGINGFACE_HUB_CACHE',
|
||||
tempfile.gettempdir())
|
||||
os.environ['HUGGINGFACE_HUB_CACHE'] = hf_hub_cache_dir
|
||||
hf_hub_cache_dir = tempfile.gettempdir()
|
||||
if os.environ.get('USE_SYSTEM_CACHE', 'True') == 'False':
|
||||
os.environ['HUGGINGFACE_HUB_CACHE'] = hf_hub_cache_dir
|
||||
|
||||
# supported_devices : CPU, GPU, GNA
|
||||
test_device = os.environ.get('TEST_DEVICE', 'CPU;GPU').split(';')
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ class TestTorchHubConvertModel(TestConvertModel):
|
|||
def setup_class(self):
|
||||
self.cache_dir = tempfile.TemporaryDirectory()
|
||||
# set temp dir for torch cache
|
||||
torch.hub.set_dir(str(self.cache_dir.name))
|
||||
if os.environ.get('USE_SYSTEM_CACHE', 'True') == 'False':
|
||||
torch.hub.set_dir(str(self.cache_dir.name))
|
||||
|
||||
def load_model(self, model_name, model_link):
|
||||
m = torch.hub.load("pytorch/vision", model_name,
|
||||
|
|
|
|||
Loading…
Reference in New Issue