diff --git a/api/onnx_web/convert/__main__.py b/api/onnx_web/convert/__main__.py index 46967563..bf900d01 100644 --- a/api/onnx_web/convert/__main__.py +++ b/api/onnx_web/convert/__main__.py @@ -136,6 +136,13 @@ def fetch_model( ctx: ConversionContext, name: str, source: str, model_format: Optional[str] = None ) -> str: cache_name = path.join(ctx.cache_path, name) + model_path = path.join(ctx.model_path, name) + model_onnx = model_path + ".onnx" + + for p in [model_path, model_onnx]: + if path.exists(p): + logger.debug("Model already exists, skipping fetch.") + return p # add an extension if possible, some of the conversion code checks for it if model_format is None: diff --git a/api/onnx_web/convert/utils.py b/api/onnx_web/convert/utils.py index 689af692..22186ad5 100644 --- a/api/onnx_web/convert/utils.py +++ b/api/onnx_web/convert/utils.py @@ -49,7 +49,7 @@ def download_progress(urls: List[Tuple[str, str]]): dest_path.parent.mkdir(parents=True, exist_ok=True) if dest_path.exists(): - logger.info("Destination already exists: %s", dest_path) + logger.debug("Destination already exists: %s", dest_path) return str(dest_path.absolute()) req = requests.get(