Skip to content
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

Add the documentation for simple-pbt #1978

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions examples/v1beta1/trial-images/simple-pbt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Toy PBT problem for benchmarking adaptive learning rate

The goal is to optimize this trainable's accuracy. The accuracy increases
fastest at the optimal lr, which is a function of the current accuracy.
The optimal lr schedule for this problem is the triangle wave as follows.
Note that many lr schedules for real models also follow this shape:

```
best lr
^
| /\
| / \
| / \
| / \
------------> accuracy
```

In this problem, using PBT with a population of 2-4 is sufficient to
roughly approximate this lr schedule. Higher population sizes will yield
faster convergence. Training will not converge without PBT.

If you want read more about this example, vist the
[ray](https://github.com/ray-project/ray/blob/7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065/python/ray/tune/examples/README.rst)
documentation.

Katib uses this training container in some Experiments, for instance in the
[PBT example](../../hp-tuning/simple-pbt.yaml#L44-L52).
9 changes: 4 additions & 5 deletions examples/v1beta1/trial-images/simple-pbt/pbt_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/usr/bin/env python
# Implementation based on:
# https://github.com/ray-project/ray/blob/7f1bacc7dc9caf6d0ec042e39499bbf1d9a7d065/python/ray/tune/examples/pbt_example.py

# Copyright 2022 The Kubeflow Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -12,11 +16,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/usr/bin/env python

# Implementation based on:
# https://github.com/ray-project/ray/blob/master/python/ray/tune/examples/pbt_example.py

import argparse
import numpy as np
import os
Expand Down