Skip to content

Commit

Permalink
Revert "Replace hashlib.sha256 with hashlib.file_digest so we don't n…
Browse files Browse the repository at this point in the history
…eed to load entire files into ram before hashing them. (#4383)"

This reverts commit 0ced78f.
  • Loading branch information
oobabooga committed Feb 26, 2024
1 parent 4164e29 commit 830168d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion download-model.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ def check_model_files(self, model, branch, links, sha256, output_folder):
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
Expand Down

0 comments on commit 830168d

Please sign in to comment.