From e9def85f1ff0a5be8b7c162d755116ea478f58eb Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Mon, 18 Dec 2023 16:22:30 +0100 Subject: [PATCH] Fix PNNX `ubuntu` -> `linux` bug (#7050) --- ultralytics/engine/exporter.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py index 2d0d45ad..de502522 100644 --- a/ultralytics/engine/exporter.py +++ b/ultralytics/engine/exporter.py @@ -459,11 +459,14 @@ class Exporter: f'{prefix} WARNING ⚠️ PNNX not found. Attempting to download binary file from ' 'https://github.com/pnnx/pnnx/.\nNote PNNX Binary file must be placed in current working directory ' f'or in {ROOT}. See PNNX repo for full installation instructions.') - _, assets = get_github_assets(repo='pnnx/pnnx', retry=True) - system = 'macos' if MACOS else 'ubuntu' if LINUX else 'windows' # operating system - asset = [x for x in assets if system in x][0] if assets else \ - f'https://github.com/pnnx/pnnx/releases/download/20230816/pnnx-20230816-{system}.zip' # fallback - asset = attempt_download_asset(asset, repo='pnnx/pnnx', release='latest') + system = ['macos'] if MACOS else ['windows'] if WINDOWS else ['ubuntu', 'linux'] # operating system + try: + _, assets = get_github_assets(repo='pnnx/pnnx', retry=True) + url = [x for x in assets if any(s in x for s in system)][0] + except Exception as e: + url = f'https://github.com/pnnx/pnnx/releases/download/20231127/pnnx-20231127-{system[0]}.zip' + 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('') (unzip_dir / name).rename(pnnx) # move binary to ROOT