Skip to main content

Hydra Orion Sweeper plugin

Project description

Current PyPi Version Supported Python Versions codecov docs tests style

Provides a mechanism for Hydra applications to use Orion algorithms for the optimization of the parameters of any experiment.

See website for more information

Install

pip install hydra-orion-sweeper

Search Space

Orion defines 5 different dimensions that can be used to define your search space.

  • uniform(low, high, [discrete=False, precision=4, shape=None, default_value=None])

  • loguniform(low, high, [discrete=False, precision=4, shape=None, default_value=None])

  • normal(loc, scale, [discrete=False, precision=4, shape=None, default_value=None])

  • choices(*options)

  • fidelity(low, high, base=2)

Fidelity is a special dimension that is used to represent the training time, you can think of it as the epoch dimension.

Documentation

For in-depth documentation about the plugin and its configuration options you should refer to Orion as the plugin configurations are simply passed through.

Example

Configuration

defaults:
- override hydra/sweeper: orion

hydra:
    sweeper:
       params:
          a: "uniform(0, 1)"
          b: "uniform(0, 1)"

       orion:
          name: 'experiment'
          version: '1'

       algorithm:
          type: random
          config:
             seed: 1

       worker:
          n_workers: -1
          max_broken: 3
          max_trials: 100

       storage:
          type: legacy
          database:
             type: pickleddb
             host: 'database.pkl'

# Default values
a: 0
b: 0

Code

import hydra
from omegaconf import DictConfig

@hydra.main(config_path=".", config_name="config")
def main(cfg: DictConfig) -> float:
   """Simple main function"""
   a = cfg.a
   b = cfg.b

   return float(a + b)

if __name__ == "__main__":
   main()

Running

To run the hyper parameter optimization process you need to specify the --multirun argument.

python my_app.py --multirun

The search space can also be tweaked from the command line

python my_app.py --multirun batch_size=4,8,12,16 optimizer.name=Adam,SGD 'optimizer.lr="loguniform(0.001, 1.0)"'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hydra-orion-sweeper-1.4.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hydra_orion_sweeper-1.4.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file hydra-orion-sweeper-1.4.0.tar.gz.

File metadata

  • Download URL: hydra-orion-sweeper-1.4.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for hydra-orion-sweeper-1.4.0.tar.gz
Algorithm Hash digest
SHA256 c066ac8cdbd7bad1194c19e5e1ab8d2afa7a215c829e06c31d2b4725d6e2d072
MD5 dd1c433e7de8bc262c2df21f3c87184a
BLAKE2b-256 584a8afdda82e11b8a4bb169633de3349867175e4031225198bf7a8be95e33a3

See more details on using hashes here.

File details

Details for the file hydra_orion_sweeper-1.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hydra_orion_sweeper-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aa012283c0726487881d84b0161eca994671cac661a62a8ddfcf11f8cdd82391
MD5 f58c54cfba38cf67647e058f636a40bd
BLAKE2b-256 83f8f4f3467db071621cded0641a22cf5b22b2d0a03d2e8261564d5d29d2af32

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page