-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Fix validation to detect missing model files before loading #14253
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
base: main
Are you sure you want to change the base?
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
## Problem The current validation logic only checks files that are found by glob pattern matching. If a model's snapshot directory exists with an index file but actual weight files are missing (due to incomplete downloads or cache corruption), the validation passes and claims "Found local HF snapshot", then crashes with FileNotFoundError when trying to load the missing files. Example from CI: ``` [TP0] Found local HF snapshot for openai/gpt-oss-120b at /hf_home/hub/models--openai--gpt-oss-120b/snapshots/... FileNotFoundError: No such file or directory: .../model-00000-of-00014.safetensors ``` The issue is that glob only finds files that exist on disk. If files are missing entirely, they're never validated, so the system doesn't know they should exist. ## Solution Added `_check_index_files_exist()` function that: 1. Reads the safetensors index file (model.safetensors.index.json) 2. Extracts the complete list of required files from the weight_map 3. Verifies that ALL files in the weight_map actually exist on disk 4. Returns validation failure with specific missing filenames if any are absent This function is integrated into `_validate_sharded_model()` and runs before other validation checks. When files are missing, validation fails and triggers a re-download instead of crashing during load. ## Testing - Tested with simulated CI scenario (14-shard model with 1 missing file) - Validation correctly detects missing files and returns clear error message - Non-sharded models (no index file) are unaffected - All files present: validation passes as expected
c94974a to
56c6192
Compare
|
/tag-and-rerun-ci |
Local Testing VerificationTested this implementation locally by simulating the exact CI failure scenario. All tests passed. Test SetupCreated a test script (
Test Cases & Results
Example OutputSimulating the CI failure (missing CI Failure ReferenceThe original CI failure from this run: The |
Problem
The current validation logic only checks files that are found by glob pattern matching. If a model's snapshot directory exists with an index file but actual weight files are missing (due to incomplete downloads or cache corruption), the validation passes and claims "Found local HF snapshot", then crashes with FileNotFoundError when trying to load the missing files.
Example from CI:
The issue is that glob only finds files that exist on disk. If files are missing entirely, they're never validated, so the system doesn't know they should exist.
Solution
Added
_check_index_files_exist()function that:model.safetensors.index.json)weight_mapThis function is integrated into
_validate_sharded_model()and runs before other validation checks. When files are missing, validation fails and triggers a re-download instead of crashing during load.Testing
Related
Extends the validation work from #13729 and #13870, which added corruption detection but didn't check for missing files.