Add self-healing cache validation for DeepFace weight files#3
Draft
Add self-healing cache validation for DeepFace weight files#3
Conversation
- Add GitHub Actions cache for ~/.deepface/weights with dynamic key based on requirements.txt hash - Implement H5 file integrity validation using h5py to detect corrupted weight files - Remove both suspiciously small (<100KB) and corrupted H5 files before tests - Gracefully fall back to size-based cleanup if h5py is unavailable - Cache key invalidates when dependencies change to prevent stale cache reuse Fixes issue where corrupted/truncated model weight files in CI cache cause ValueError during model.load_weights() and cascade into API test failures. Agent-Logs-Url: https://github.com/JayNightmare/Deepface-Mirror/sessions/a5d961cd-5f82-40c9-8b22-1c3bac0cfc54 Co-authored-by: JayNightmare <34739807+JayNightmare@users.noreply.github.com>
Claude created this pull request from a session on behalf of
JayNightmare
March 27, 2026 16:07
View session
2 tasks
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.
Tickets
N/A - Fixing CI test failures caused by corrupted cached model weight files.
What has been done
With this PR, the CI workflow now validates cached DeepFace weight files before tests run. Corrupted
.h5files that pass the size check (>100KB) but have invalid HDF5 structure now get detected and removed, allowing DeepFace to re-download clean weights.Changes:
~/.deepface/weightswith dynamic key based onrequirements.txthashh5py.File()to detect corrupted weightsRoot cause: Truncated/corrupted weight files in CI cache were causing
ValueErrorinmodel.load_weights(), cascading into API test failures (400 vs 200 status codes).Fix approach: Validate all
*.h5files before tests by attempting to open withh5py. Invalid files are removed and logged with diagnostic output.How to test