Tune Examples

In our repository, we provide a variety of examples for the various use cases and features of Tune.

If any example is broken, or if you’d like to add an example to this page, feel free to raise an issue on our Github repository.

General Examples

  • async_hyperband_example:
    Example of using a Trainable class with AsyncHyperBandScheduler.
  • hyperband_example:
    Example of using a Trainable class with HyperBandScheduler. Also uses the Experiment class API for specifying the experiment configuration.
  • hyperopt_example:
    Optimizes a basic function using the function-based API and the HyperOptSearch (SearchAlgorithm wrapper for HyperOpt TPE). Also uses the AsyncHyperBandScheduler.
  • pbt_example:
    Example of using a Trainable class with PopulationBasedTraining scheduler.
  • pbt_ppo_example:
    Example of optimizing a distributed RLlib algorithm (PPO) with the PopulationBasedTraining scheduler.
  • logging_example:
    Example of custom loggers and custom trial directory naming.

Keras Examples

  • tune_mnist_keras:
    Converts the Keras MNIST example to use Tune with the function-based API and a Keras callback. Also shows how to easily convert something relying on argparse to use Tune.

PyTorch Examples

  • mnist_pytorch:
    Converts the PyTorch MNIST example to use Tune with the function-based API. Also shows how to easily convert something relying on argparse to use Tune.
  • mnist_pytorch_trainable:
    Converts the PyTorch MNIST example to use Tune with Trainable API. Also uses the HyperBandScheduler and checkpoints the model at the end.

TensorFlow Examples

  • tune_mnist_ray:
    A basic example of tuning a TensorFlow model on MNIST using the Trainable class.
  • tune_mnist_ray_hyperband:
    A basic example of tuning a TensorFlow model on MNIST using the Trainable class and the HyperBand scheduler.
  • tune_mnist_async_hyperband:
    Example of tuning a TensorFlow model on MNIST using AsyncHyperBand.

Contributed Examples

  • pbt_tune_cifar10_with_keras:
    A contributed example of tuning a Keras model on CIFAR10 with the PopulationBasedTraining scheduler.
  • genetic_example:
    Optimizing the michalewicz function using the contributed GeneticSearch search algorithm with AsyncHyperBandScheduler.