-
Notifications
You must be signed in to change notification settings - Fork 443
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
Python SDK for katib #1177
Python SDK for katib #1177
Conversation
Check out this pull request on Review Jupyter notebook visual diffs & provide feedback on notebooks. Powered by ReviewNB |
Hi @prem0912. Thanks for your PR. I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @johnugeorge |
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.
@prem0912 Thank you for doing this!
I left comments.
sdk/python/README.md
Outdated
Install via [Setuptools](http://pypi.python.org/pypi/setuptools). | ||
|
||
```sh | ||
python setup.py install --user |
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.
Do we want to move Katib SDK to pip @johnugeorge ?
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.
It is better to recommend pip way of installation
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.
ok .. working on it
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.
Added pip way installation and updated Readme.md
[KatibClient](docs/KatibClient.md) | [get_optimal_hyperparmeters](docs/KatibClient.md#get_optimal_hyperparmeters) | Get status, currentOptimalTrial with paramaterAssignments of an Experiment| | ||
|
||
|
||
## Documentation For Models |
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.
Maybe add script to update models?
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.
will add it in next PR
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"! python setup.py install" |
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.
I am not sure that we need this setup script in Example, since we already mentioned how to install SDK in README.
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.
removed from examples
" )\n", | ||
"\n", | ||
"# Metric Collector\n", | ||
"collector = V1alpha3CollectorSpec(kind = \"TensorFlowEvent\")\n", |
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.
For BO I think you can delete this Metrics Collector.
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.
deleted metrics Collector
|
||
katibexp = self.get_experiment(name, namespace=namespace) | ||
result = {} | ||
result["status"] = katibexp.get("status", {}).get("conditions", [])[-1].get("type") |
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.
Do we want to return Experiment status here? Since we have get_experiment_status
API ?
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.
I think it is needed because we are able to get optimized hyperparameter even only some of the trials are completed.
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.
In that case, maybe users should handle this situation? For example, if get_optimal_hyperparmeters
return [] run list_trials
to check Trial statuses.
How experiment status can help user with it?
Experiment status can be running, but some Trials can be finished.
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.
ok will remove status from optimized hyperparameter API
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.
removed status from optimized hyperparameter API
@prem0912 Looks like you cannot be added to owners without being added to Kubeflow org. Can we add owners in a separate PR then? |
@@ -0,0 +1,92 @@ | |||
# Kubeflow Katib SDK |
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.
Can we also link this SDK page from the main Katib Readme file?
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.
Updated main Readme file
def create_experiment(self, name, namespace=None): | ||
""" | ||
Create the katib experiment | ||
:param name: experiment object |
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.
I think body (or object) is more appropriate than name.
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.
changes updated
|
||
self.api_instance = client.CustomObjectsApi() | ||
|
||
def _is_ipython(self): |
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.
Unifying indents to 4 ?
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.
updated
The following users are mentioned in OWNERS file(s) but are not members of the kubeflow org. Once all users have been added as members of the org, you can trigger verification by writing
|
@johnugeorge removed OWNERS file |
/ok-to-test |
/cc @johnugeorge @andreyvelich @sperlingxx Can you please give another review? Thanks |
/retest |
@prem0912 can you rebase this PR? |
"from kubernetes.client import V1PodTemplateSpec\n", | ||
"from kubernetes.client import V1ObjectMeta\n", | ||
"from kubernetes.client import V1PodSpec\n", | ||
"from kubernetes.client import V1Container" |
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.
I didn't find where you use V1PodTemplateSpec
, V1PodSpec
, V1Container
in bayesianoptimization-katib-sdk.ipynb
example.
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.
removed unused imports
}, | ||
"outputs": [], | ||
"source": [ | ||
"import kubeflow.katib as kc\n", |
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.
Maybe instead of importing kubeflow.katib as kc
, just import required components.
I believe, for your example you can left:
from kubeflow.katib import KatibClient
from kubeflow.katib import utils
from kubeflow.katib import V1alpha3AlgorithmSetting
from kubeflow.katib import V1alpha3AlgorithmSpec
from kubeflow.katib import V1alpha3Experiment
from kubeflow.katib import V1alpha3ExperimentSpec
from kubeflow.katib import V1alpha3FeasibleSpace
from kubeflow.katib import V1alpha3GoTemplate
from kubeflow.katib import V1alpha3ObjectiveSpec
from kubeflow.katib import V1alpha3ParameterSpec
from kubeflow.katib import V1alpha3TrialTemplate
So it will not confuse user with other imports. What do you think?
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.
Its better to import all the components because people will know what are the other components available to make use.
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.
Ok, thanks.
} | ||
], | ||
"source": [ | ||
"kclient.get_experiment(name=\"bayesianoptimization\", namespace=None)" |
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.
I think we can use namespace=namespace
here, like you did with other API calls to be consistent.
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.
updated
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
" kclient.delete_experiment(name=\"bayesianoptimization\", namespace=namespace)" |
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.
It is better to move delete_experiment
to the latest command in example.
You are run few commands after deleting Experiment.
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.
done
"from kubernetes.client import V1PodTemplateSpec\n", | ||
"from kubernetes.client import V1ObjectMeta\n", | ||
"from kubernetes.client import V1PodSpec\n", | ||
"from kubernetes.client import V1Container" |
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.
The same suggestion as I left for BO example.
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.
removed unused imports
…mal_hyperparamater API
@johnugeorge rebased to upstream |
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.
@prem0912 Thank you for doing this!
/lgtm
/cc @gaocegege @johnugeorge
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: johnugeorge The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@jlewi How can we remove the label - invalid-owners-file? This was added by an earlier commit which is fixed. Can we re trigger? |
/verify-owners |
1 similar comment
/verify-owners |
@andreyvelich @johnugeorge You might want to look at GitHub permissions to see if there are fine grained roles that would allow key owners to add labels using the labels (e.g. the issue triage role, or maybe maintainers). And then create a GitHub team with appropriate owners in that team |
@jlewi I can see that Triage role can apply labels (https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/repository-permission-levels-for-an-organization#repository-access-for-each-permission-level). |
* python SDK for katib with docs and examples * Update README.md * Update README.md * Update bayesianoptimization-katib-sdk.ipynb * Update bayesianoptimization-katib-sdk.ipynb * Update tfjob-katib-sdk.ipynb * Create OWNERS * Update bayesianoptimization-katib-sdk.ipynb * Update tfjob-katib-sdk.ipynb * Update bayesianoptimization-katib-sdk.ipynb * Update tfjob-katib-sdk.ipynb * Update bayesianoptimization-katib-sdk.ipynb * Update OWNERS * Update README.md * updated changes as per review comments * Update README.md * Update README.md * Added pip installation for katib sdk and removed status from get_optimal_hyperparamater API * Update README.md * Updated changes for delete_exp and removed unused imports
1, Added Python SDK for katib
2. Added Documents and Readme