From 697752f2d82318a5d355754390116e7fdfd0fe1b Mon Sep 17 00:00:00 2001 From: Benjamin Fineran Date: Tue, 17 Oct 2023 14:29:47 -0400 Subject: [PATCH] download compressed deployment directory (#1318) --- src/deepsparse/transformers/helpers.py | 5 +---- src/deepsparse/utils/onnx.py | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/deepsparse/transformers/helpers.py b/src/deepsparse/transformers/helpers.py index 62caabb64d..e527ab0b22 100644 --- a/src/deepsparse/transformers/helpers.py +++ b/src/deepsparse/transformers/helpers.py @@ -73,10 +73,7 @@ def get_deployment_path(model_path: str) -> Tuple[str, str]: elif model_path.startswith("zoo:"): zoo_model = Model(model_path) - deployment_path = zoo_model.deployment.path - for deployment_file in zoo_model.deployment.files: - # force download of any missing files in deployment directory - deployment_file.path + deployment_path = zoo_model.deployment_directory_path return deployment_path, os.path.join(deployment_path, _MODEL_DIR_ONNX_NAME) elif model_path.startswith("hf:"): from huggingface_hub import snapshot_download diff --git a/src/deepsparse/utils/onnx.py b/src/deepsparse/utils/onnx.py index afd10bf776..ca43cc112d 100644 --- a/src/deepsparse/utils/onnx.py +++ b/src/deepsparse/utils/onnx.py @@ -127,11 +127,8 @@ def model_to_path(model: Union[str, Model, File]) -> str: model = Model(model) if Model is not object and isinstance(model, Model): - # download any onnx data files in deployment directory - for deployment_file in model.deployment.files: - if ".data" in deployment_file.name: - # forces download of data file if not cached - deployment_file.path + # trigger download and unzipping of deployment directory if not cached + model.deployment_directory_path # default to the main onnx file for the model model = model.deployment.get_file(_MODEL_DIR_ONNX_NAME).path