Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add asset integrity check for asset downloads #840

Merged
merged 6 commits into from
Nov 22, 2024

Conversation

PeanutButterRat
Copy link
Contributor

@PeanutButterRat PeanutButterRat commented Oct 19, 2024

What does this PR do? Please describe:
This PR adds a file integrity check for tokenizers, models, and datasets to ensure they were downloaded properly with a SHA-1 checksum. If the checksum listed on the asset card doesn't match, the download_manager will raise an AssetDownloadError. If there is no listed checksum on the asset card, the download_manager will proceed like normal but make a call to log.warning about the missing checksum field.

Fixes #839

Does your PR introduce any breaking changes? If yes, please list them:
Adds an additional checksum parameter to the download_manager's methods for downloading tokenizers, models, and datasets.

Check list:

  • Was the content of this PR discussed and approved via a GitHub issue? (no need for typos or documentation improvements)
  • Did you read the contributor guideline?
  • Did you make sure that your PR does only one thing instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests?
  • Did you verify new and existing tests pass locally with your changes?
  • Did you update the CHANGELOG? (no need for typos, documentation, or minor internal changes)

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 19, 2024
@PeanutButterRat
Copy link
Contributor Author

I added a check to see if the checksum is None before calculating the hash. If there is no checksum on the asset card, it will just skip the integrity check and make a call to log.warning.

@PeanutButterRat PeanutButterRat changed the title Add asset integrity check for tokenizer downloads Add asset integrity check for asset downloads Oct 25, 2024
@PeanutButterRat PeanutButterRat marked this pull request as ready for review October 29, 2024 03:48
Copy link
Contributor

@cbalioglu cbalioglu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@cbalioglu cbalioglu merged commit a96a146 into facebookresearch:main Nov 22, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support checksum in AssetDownloadManager
3 participants