From 830168d3d44816d4e4ee743826a9f354db8ea8aa Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 26 Feb 2024 05:54:33 -0800 Subject: [PATCH] Revert "Replace hashlib.sha256 with hashlib.file_digest so we don't need to load entire files into ram before hashing them. (#4383)" This reverts commit 0ced78fdfa5a1747257f28183836a76b2bfde2a5. --- download-model.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/download-model.py b/download-model.py index d7cf9273..f4e1f607 100644 --- a/download-model.py +++ b/download-model.py @@ -262,7 +262,8 @@ class ModelDownloader: continue with open(output_folder / sha256[i][0], "rb") as f: - file_hash = hashlib.file_digest(f, "sha256").hexdigest() + bytes = f.read() + file_hash = hashlib.sha256(bytes).hexdigest() if file_hash != sha256[i][1]: print(f'Checksum failed: {sha256[i][0]} {sha256[i][1]}') validated = False