From 0ced78fdfa5a1747257f28183836a76b2bfde2a5 Mon Sep 17 00:00:00 2001 From: LightningDragon Date: Wed, 25 Oct 2023 09:15:34 -0600 Subject: [PATCH] Replace hashlib.sha256 with hashlib.file_digest so we don't need to load entire files into ram before hashing them. (#4383) --- download-model.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/download-model.py b/download-model.py index 25d9c804..65f4fa52 100644 --- a/download-model.py +++ b/download-model.py @@ -236,8 +236,7 @@ class ModelDownloader: continue with open(output_folder / sha256[i][0], "rb") as f: - bytes = f.read() - file_hash = hashlib.sha256(bytes).hexdigest() + file_hash = hashlib.file_digest(f, "sha256").hexdigest() if file_hash != sha256[i][1]: print(f'Checksum failed: {sha256[i][0]} {sha256[i][1]}') validated = False