From bc636d08b798412c7eecda974f0019b90566dc57 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 8 Apr 2024 22:55:18 +0200 Subject: [PATCH] Improve PNNX download robustness (#9884) --- ultralytics/engine/exporter.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index 1b95d76a..be750a3a 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -529,12 +529,12 @@ class Exporter: f"or in {ROOT}. See PNNX repo for full installation instructions." ) system = "macos" if MACOS else "windows" if WINDOWS else "linux-aarch64" if ARM64 else "linux" - _, assets = get_github_assets(repo="pnnx/pnnx", retry=True) - if assets: + try: + _, assets = get_github_assets(repo="pnnx/pnnx", retry=True) url = [x for x in assets if f"{system}.zip" in x][0] - else: + except Exception as e: url = f"https://github.com/pnnx/pnnx/releases/download/20240226/pnnx-20240226-{system}.zip" - LOGGER.warning(f"{prefix} WARNING ⚠️ PNNX GitHub assets not found, using default {url}") + LOGGER.warning(f"{prefix} WARNING ⚠️ PNNX GitHub assets not found: {e}, using default {url}") asset = attempt_download_asset(url, repo="pnnx/pnnx", release="latest") if check_is_path_safe(Path.cwd(), asset): # avoid path traversal security vulnerability unzip_dir = Path(asset).with_suffix("")