-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: Add HyperBand Signed-off-by: Ce Gao <gaoce@caicloud.io> * chore: Add test in CI Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Fix Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Fix name Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Fix name Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Fix script Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Fix r_l Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Add parallel trial count Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Add output Signed-off-by: Ce Gao <gaoce@caicloud.io> * feat: Append algorithm settings Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Add output Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Fix useless variable Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Use resource_name instead of ResourceName Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Update Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Avoid nil pointer exception Signed-off-by: Ce Gao <gaoce@caicloud.io> * feat: Move algorithm to status Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Add max Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Use algorithm settings Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Remove updateSpec Signed-off-by: Ce Gao <gaoce@caicloud.io> * fix: Fix test Signed-off-by: Ce Gao <gaoce@caicloud.io>
- Loading branch information
1 parent
e9e0768
commit cc76656
Showing
24 changed files
with
613 additions
and
226 deletions.
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 { | ||
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.