-
Notifications
You must be signed in to change notification settings - Fork 448
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
feat: Add HyperBand #787
Merged
Merged
feat: Add HyperBand #787
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1f4d3f0
feat: Add HyperBand
gaocegege 4623840
chore: Add test in CI
gaocegege c84a8fd
fix: Fix
gaocegege dbfa6ea
fix: Fix name
gaocegege c563825
fix: Fix name
gaocegege 79caf8b
fix: Fix script
gaocegege 526ae9d
fix: Fix r_l
gaocegege 8328321
fix: Add parallel trial count
gaocegege 18d57a7
fix: Add output
gaocegege ff85045
feat: Append algorithm settings
gaocegege 102e1cf
fix: Add output
gaocegege 6754714
fix: Fix useless variable
gaocegege 1fb71aa
fix: Use resource_name instead of ResourceName
gaocegege f3b1ea9
fix: Update
gaocegege ccdc296
fix: Avoid nil pointer exception
gaocegege 9421e11
feat: Move algorithm to status
gaocegege 751c739
fix: Add max
gaocegege bbe5087
fix: Use algorithm settings
gaocegege 38ed84e
fix: Remove updateSpec
gaocegege 78252f0
fix: Fix test
gaocegege File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,18 @@ | ||
FROM python:3 | ||
|
||
ADD . /usr/src/app/github.com/kubeflow/katib | ||
WORKDIR /usr/src/app/github.com/kubeflow/katib/cmd/suggestion/hyperband/v1alpha3 | ||
RUN if [ "$(uname -m)" = "ppc64le" ]; then \ | ||
apt-get -y update && \ | ||
apt-get -y install gfortran libopenblas-dev liblapack-dev && \ | ||
pip install cython; \ | ||
fi | ||
RUN GRPC_HEALTH_PROBE_VERSION=v0.3.0 && \ | ||
wget -qO/bin/grpc_health_probe https://github.com/grpc-ecosystem/grpc-health-probe/releases/download/${GRPC_HEALTH_PROBE_VERSION}/grpc_health_probe-linux-amd64 && \ | ||
chmod +x /bin/grpc_health_probe | ||
|
||
ADD . /usr/src/app/github.com/kubeflow/katib | ||
WORKDIR /usr/src/app/github.com/kubeflow/katib/cmd/suggestion/hyperband/v1alpha3 | ||
RUN pip install --no-cache-dir -r requirements.txt | ||
ENV PYTHONPATH /usr/src/app/github.com/kubeflow/katib:/usr/src/app/github.com/kubeflow/katib/pkg/apis/manager/v1alpha3/python | ||
|
||
ENV PYTHONPATH /usr/src/app/github.com/kubeflow/katib:/usr/src/app/github.com/kubeflow/katib/pkg/apis/manager/v1alpha3/python:/usr/src/app/github.com/kubeflow/katib/pkg/apis/manager/health/python | ||
|
||
ENTRYPOINT ["python", "main.py"] |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
grpcio | ||
duecredit | ||
grpcio==1.23.0 | ||
duecredit===0.7.0 | ||
cloudpickle==0.5.6 | ||
numpy>=1.13.3 | ||
scikit-learn>=0.19.0 | ||
scipy>=0.19.1 | ||
forestci | ||
protobuf | ||
googleapis-common-protos | ||
forestci==0.3 | ||
protobuf==3.9.1 | ||
googleapis-common-protos==1.6.0 |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ rules: | |
- serviceaccounts | ||
- services | ||
- secrets | ||
- events | ||
verbs: | ||
- "*" | ||
- apiGroups: | ||
|
This file contains 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
12 changes: 6 additions & 6 deletions
12
pkg/apis/controller/suggestions/v1alpha3/zz_generated.deepcopy.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
53 changes: 53 additions & 0 deletions
53
pkg/controller.v1alpha3/suggestion/suggestionclient/algorithm_settings.go
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package suggestionclient | ||
|
||
import ( | ||
common "github.com/kubeflow/katib/pkg/apis/controller/common/v1alpha3" | ||
experimentsv1alpha3 "github.com/kubeflow/katib/pkg/apis/controller/experiments/v1alpha3" | ||
suggestionsv1alpha3 "github.com/kubeflow/katib/pkg/apis/controller/suggestions/v1alpha3" | ||
suggestionapi "github.com/kubeflow/katib/pkg/apis/manager/v1alpha3" | ||
) | ||
|
||
// appendAlgorithmSettingsFromSuggestion appends the algorithm settings | ||
// in suggestion to Experiment. | ||
// Algorithm settings in suggestion will overwrite the settings in experiment. | ||
func appendAlgorithmSettingsFromSuggestion(experiment *experimentsv1alpha3.Experiment, algoSettingsInSuggestion []common.AlgorithmSetting) { | ||
algoSettingsInExperiment := experiment.Spec.Algorithm | ||
for _, setting := range algoSettingsInSuggestion { | ||
if index, found := contains( | ||
algoSettingsInExperiment.AlgorithmSettings, setting.Name); found { | ||
// If the setting is found in Experiment, update it. | ||
algoSettingsInExperiment.AlgorithmSettings[index].Value = setting.Value | ||
} else { | ||
// If not found, append it. | ||
algoSettingsInExperiment.AlgorithmSettings = append( | ||
algoSettingsInExperiment.AlgorithmSettings, setting) | ||
} | ||
} | ||
} | ||
|
||
func updateAlgorithmSettings(suggestion *suggestionsv1alpha3.Suggestion, algorithm *suggestionapi.AlgorithmSpec) { | ||
for _, setting := range algorithm.AlgorithmSetting { | ||
gaocegege marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if setting != nil { | ||
if index, found := contains(suggestion.Status.AlgorithmSettings, setting.Name); found { | ||
// If the setting is found in Suggestion, update it. | ||
suggestion.Status.AlgorithmSettings[index].Value = setting.Value | ||
} else { | ||
// If not found, append it. | ||
suggestion.Status.AlgorithmSettings = append(suggestion.Status.AlgorithmSettings, common.AlgorithmSetting{ | ||
Name: setting.Name, | ||
Value: setting.Value, | ||
}) | ||
} | ||
} | ||
} | ||
} | ||
|
||
func contains(algorithmSettings []common.AlgorithmSetting, | ||
name string) (int, bool) { | ||
for i, s := range algorithmSettings { | ||
if s.Name == name { | ||
return i, true | ||
} | ||
} | ||
return -1, false | ||
} |
This file contains 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
Oops, something went wrong.
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.
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.
@gaocegege, is the yaml parser case sensitive? Here,
parametertype
doesn't have thet
capitalized like elsewhere.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.
Thanks for the find. I will have a look. Actually, @johnugeorge found that the e2e hyperband test is finished quickly. Not sure if it is caused by this problem.