Repository navigation
[utils] Only read a hash of 8+ hex digits from the file name in download_from_url - #2209
Merged
felixdittrich92 merged 1 commit intoOct 31, 2026
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2209 +/- ##
==========================================
+ Coverage 97.76% 97.78% +0.01%
==========================================
Files 170 170
Lines 10982 10986 +4
==========================================
+ Hits 10737 10743 +6
+ Misses 245 243 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…oad_from_urlWhen no hash is given, download_from_url reads one from the file name with
-([a-f0-9]*)\.. That also matchesshort runs of hex digits that are part of the name, so for a URL ending in
checkpoint-10.ptormodel-face.pt,"10" or "face" is taken as the hash. The SHA256 never starts with it, so a correct download is deleted and
reported as corrupted. This happens with
load_pretrained_params(model, url)on your own checkpoints.The hash in docTR file names is always 8 hex digits (e.g.
db_resnet50-79bd7d70.pt), so the pattern now needsat least 8. Tests: names without a hash load the cached file without downloading, and a hashed name is still checked.