[BugFix][DataProcessor] Add validate_model_path to fail fast on bad model path or unreachable network#6713
Open
gongweibao wants to merge 3 commits intoPaddlePaddle:developfrom
Open
[BugFix][DataProcessor] Add validate_model_path to fail fast on bad model path or unreachable network#6713gongweibao wants to merge 3 commits intoPaddlePaddle:developfrom
gongweibao wants to merge 3 commits intoPaddlePaddle:developfrom
Conversation
|
Thanks for your contribution! |
|
gongweibao seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #6713 +/- ##
==========================================
Coverage ? 72.07%
==========================================
Files ? 392
Lines ? 53764
Branches ? 8448
==========================================
Hits ? 38749
Misses ? 12224
Partials ? 2791
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 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.
Motivation
When
model_name_or_pathis incorrect or the network is unreachable,DataProcessor.__init__hangs for 50s+ with zero output becausefrom_pretrainedsilently retries HuggingFace Hub connections (10s timeout × 5 retries + exponential backoff). Users have no idea what is happening and assume the program is dead.Modifications
validate_model_path()intofastdeploy/input/utils.py: a lightweight pre-check that runs before anyfrom_pretrainedcall. It checks whether the path is a local dir/file; if not, it warns the user and does a quicksocket.create_connectionprobe (3s timeout) to detect network issues immediately.validate_model_path()in bothtext_processor.pyandv1/text_processor.py: one-line change in eachDataProcessor.__init__, replacing the previous duplicated inline logic that had a bug (misidentified HF repo ids containing/as local paths).tests/input/test_validate_model_path.py: 7 test cases covering normal paths (local dir, local file), non-local path with reachable/unreachable network, boundary values (HForg/modelname with/, empty string), and socket timeout.Usage or Command
# Run unit tests python -m pytest tests/input/test_validate_model_path.py -vAccuracy Tests
Not applicable — this change only adds a pre-check warning before
from_pretrainedcalls. It does not modify model forward code, kernels, or any inference logic.Checklist
[BugFix],[DataProcessor])pre-commitbefore commit.tests/input/test_validate_model_path.py)