Expand description
Detecting duplicate model weights by size then a cheap content fingerprint.
Structs§
- Duplicate
Group - A set of files found to be duplicates of one another.
Constants§
- DEFAULT_
THRESHOLD - The default minimum file size (256 MiB) considered for duplicate detection — small files are not worth reporting.
Functions§
- content_
fingerprint - A content fingerprint for the file at
path: the lowercase-hex SHA-256 of its first and last megabyte (or the whole file, if small).Noneif unreadable. Two files with the same fingerprint and size are treated as the same weights. - detect
- Find groups of duplicate weight files among
candidates(name, path pairs). Files smaller thanthresholdare ignored. Candidates are bucketed by exact size, then confirmed by a fingerprint over the first and last megabyte, so only same-size, same-fingerprint files are reported. Groups are returned most-wasteful first.