Cherry-pick #4168 to main: Fix hello-numpy-cross-val example#4194
Open
nvkevlu wants to merge 3 commits intoNVIDIA:mainfrom
Open
Cherry-pick #4168 to main: Fix hello-numpy-cross-val example#4194nvkevlu wants to merge 3 commits intoNVIDIA:mainfrom
nvkevlu wants to merge 3 commits intoNVIDIA:mainfrom
Conversation
(NVIDIA#4011 and NVIDIA#4173 already on main; only 4168 changes applied.)
Collaborator
Author
|
/build |
Contributor
Greptile OverviewGreptile SummaryCherry-picked PR #4168 to fix the hello-numpy-cross-val example by refactoring the client to properly support cross-site evaluation (CSE) workflow with distinct task handling. Key Changes:
Confidence Score: 5/5
Important Files Changed
Flowchartflowchart TD
Start([Client receives task]) --> CheckType{Task Type?}
CheckType -->|is_train| ValidateParams{Params valid?}
ValidateParams -->|No params or missing NUMPY_KEY| RaiseError1[Raise RuntimeError: Train task needs params]
ValidateParams -->|Valid| Train[Train model: params + 1]
Train --> SaveParams[Store in last_params]
SaveParams --> Evaluate1[Evaluate model]
Evaluate1 --> CheckUpdateType{update_type?}
CheckUpdateType -->|diff| SendDiff[Send params diff]
CheckUpdateType -->|full| SendFull[Send full params]
SendDiff --> End([Continue loop])
SendFull --> End
CheckType -->|is_evaluate| ValidateEvalParams{Params valid?}
ValidateEvalParams -->|No| SendEmpty1[Send empty metrics]
ValidateEvalParams -->|Yes| Evaluate2[Evaluate model]
Evaluate2 --> SendMetrics[Send metrics only]
SendMetrics --> End
SendEmpty1 --> End
CheckType -->|is_submit_model| CheckLastParams{last_params set?}
CheckLastParams -->|No| RaiseError2[Raise RuntimeError: No local model]
CheckLastParams -->|Yes| SubmitModel[Submit last_params as FULL]
SubmitModel --> End
CheckType -->|Other| SendEmpty2[Send empty metrics]
SendEmpty2 --> End
RaiseError1 --> Stop([Fail fast])
RaiseError2 --> Stop
Last reviewed commit: 72120c5 |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR cherry-picks PR #4168 to the main branch, fixing the hello-numpy-cross-val example to properly support cross-site evaluation (CSE) by implementing branching logic for different task types.
Changes:
- Refactored hello-numpy-cross-val client to use branching pattern with
is_train(),is_evaluate(), andis_submit_model()instead of assuming all tasks are training tasks - Added fail-fast validation that raises RuntimeError when train tasks receive no model params or when submit_model is called without trained params
- Added comprehensive unit tests for the client's helper functions and fail-fast behavior
- Fixed integration test that incorrectly used "class_path" instead of "path" for model configuration dict
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tests/unit_test/recipe/hello_numpy_cross_val_client_test.py |
New unit test file that validates client helper functions (train/evaluate) and tests fail-fast behavior when params are missing |
tests/integration_test/recipe_system_test.py |
Fixed model config dict to use "path" instead of "class_path" (correct for job/config layer) |
examples/hello-world/hello-numpy-cross-val/client.py |
Refactored to use branching pattern for train/evaluate/submit_model tasks with proper error handling and last_params tracking for CSE |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Collaborator
Author
|
/build |
Collaborator
Author
|
/build |
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.
Cherry-pick #4168 to main: Fix hello-numpy-cross-val example.
Description
Cherry-pick #4168 to main: Fix hello-numpy-cross-val example.
(#4011 and #4173 already on main; only 4168 changes applied.)
Types of changes
./runtest.sh.