From 2345f01dd30bf343ed26f04696f04c24f1b6498c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Deltheil?= Date: Tue, 26 Mar 2024 14:39:12 +0000 Subject: [PATCH] test weights: check hash of pre-downloaded weights --- scripts/prepare_test_weights.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/prepare_test_weights.py b/scripts/prepare_test_weights.py index b518ace..357d175 100644 --- a/scripts/prepare_test_weights.py +++ b/scripts/prepare_test_weights.py @@ -96,8 +96,10 @@ def download_file( print(f"❌{skip_icon} {response.status_code} ERROR {readable_size:<8} {url}") return - if skip_existing and os.path.exists(dest_filename): + if skip_existing and is_downloaded: print(f"{skip_icon}️ Skipping previously downloaded {url}") + if expected_hash is not None: + check_hash(dest_filename, expected_hash) return os.makedirs(dest_folder, exist_ok=True)