-
Notifications
You must be signed in to change notification settings - Fork 122
refactor: adopt generator pattern in fine-tuning part #1292
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
Conversation
TitleAdopt Generator Pattern for Fine-Tuning and Enhance Testing Description
Changes walkthrough 📝
|
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
43aeb62
to
49cdb69
Compare
b101acc
to
73f5e00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the fine-tuning component to adopt a generator pattern for building Kubernetes manifests, improving code organization and maintainability. The changes fix a bug where secret volumes were incorrectly attached without proper specification in the spec.
Key changes:
- Migrated from direct manifest creation to a composable generator pattern using modular functions
- Separated concerns into discrete volume mount and container setup functions
- Fixed secret volume attachment to only occur when explicitly specified
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
pkg/workspace/tuning/preset-tuning.go |
Core refactoring to use generator pattern for pod spec creation |
pkg/workspace/tuning/preset-tuning_test.go |
Updated tests for new modular functions and removed obsolete test cases |
pkg/workspace/manifests/manifests.go |
Refactored job manifest generation to use generator pattern |
pkg/workspace/controllers/workspace_controller.go |
Updated function calls to match new signature |
pkg/utils/generator/generator.go |
Added support for batch Job type in generator |
pkg/model/interface.go |
Added tuning command generation method |
pkg/utils/common-preset.go |
Added utility function to find results volume mount |
pkg/workspace/inference/preset-inferences.go |
Added validation for model access secret |
pkg/workspace/inference/preset-inferences_test.go |
Added comprehensive tests for new inference functions |
test/e2e/preset_test.go |
Added image pull secrets to test configuration |
Comments suppressed due to low confidence (2)
pkg/workspace/tuning/preset-tuning_test.go:254
- [nitpick] This line modifies the expectedInitContainer after its creation, which could make the test harder to understand. Consider building the expectedInitContainer with the correct VolumeMounts from the start for better test clarity.
expectedInitContainer.VolumeMounts = expectedVolumeMounts
pkg/workspace/tuning/preset-tuning.go:237
- The variable name 'tuningParam' is misleading as it calls GetInferenceParameters() but is used for tuning commands. Consider renaming to 'inferenceParam' or 'modelParam' to better reflect its source.
tuningParam := ctx.Model.GetInferenceParameters().DeepCopy()
@@ -340,7 +340,8 @@ func updatePhi3TuningWorkspaceWithPresetPublicMode(workspaceObj *kaitov1beta1.Wo | |||
} | |||
} else { | |||
workspaceObj.Tuning.Input = &kaitov1beta1.DataSource{ | |||
Image: datasetImageName, | |||
Image: datasetImageName, | |||
ImagePullSecrets: []string{e2eACRSecret}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fei-Guo
need attention here. We indeed need to pass the secret to let puller pull image from a private registry. The new code strengthens that.
3662931
to
bcaf124
Compare
Reason for Change:
fix a bug: only attach secret volume when specifying in spec.
Requirements
Issue Fixed:
Notes for Reviewers: