Skip to main content

A collection of usefull hydra callbacks for hydra configuration

Project description

Hydra Callbacks

style framework codecov CD CI Release

A collection of usefulls and simple to use callbacks for the https://hydra.cc/ configuration framework.

Installation

pip install hydra-callbacks

Development version

pip install git+https://github.com/paquiteau/hydra-callbacks

Usage

In your hydra root config file add the following, or analoguous:

hydra:
  callbacks:
    git_infos:
      _target_: hydra_callbacks.GitInfo
      clean: true
    latest_run:
      _target_: hydra_callbacks.LatestRunLink
    resource_monitor:
      _target_: hydra_callbacks.ResourceMonitor
      sample_interval: 0.5
    runtime_perf:
      _target_: hydra_callbacks.RuntimePerformance      

This will enrich your script output with:

paquiteau@laptop$ python my_app.py
[hydra] Git sha: 844b9ca1a74d8307ef5331351897cebb18f71b88, dirty: False

## All your app log and outputs ##

[hydra][INFO] - Total runtime: 0.51 seconds
[hydra][INFO] - Writing monitoring data to [...]/outputs/2023-04-06/16-02-46/resource_monitoring.csv
[hydra][INFO] - Latest run is at: [...]/outputs/latest

Detailled configuration for each callback is available in the tests/test_app/ folder.

Available Callbacks

Name Action
GitInfo Check status of Repository
LatestRunLink Get a link to the latest run
MultiRunGatherer Gather results json file in a single table
RuntimePerformance Get Execution time for each run
ResourceMonitor Monitor resources of running jobs (CPU and Memory)

And more to come !

Also Available

  • PerfLogger : A simple to use performance logger
  
from hydra_callbacks import PerfLogger 
import logging

log = logging.getLogger(__name__)
def main_app(cfg):
    with PerfLogger(log, "step1"):
        sleep(1)

    with PerfLogger(log, "step2"):
        sleep(2)
    log.info(PerfLogger.recap())

You too, have cool Callbacks, or idea for one ?

Open a PR or an issue !

Possible Ideas

  • A callback that summarize log from multiple runs
  • Monitoring of GPU using nvitop

:star2: If you like this work, don't forget to star it and share it 🌟

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-callbacks-0.4.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

hydra_callbacks-0.4.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file hydra-callbacks-0.4.0.tar.gz.

File metadata

  • Download URL: hydra-callbacks-0.4.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for hydra-callbacks-0.4.0.tar.gz
Algorithm Hash digest
SHA256 c532b4b9a9ff7dbfe343a0d242de89f09539d4c0061595f5ce4b79278e3df369
MD5 24d2a92716b6f9320251758405d2aaf9
BLAKE2b-256 c5d7b201caa089ade99b585881e0182903987d513c7a7fcd3061306eb25d9676

See more details on using hashes here.

File details

Details for the file hydra_callbacks-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for hydra_callbacks-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0d229976a111fa327b13d5865bf9308dec4f19175763a17b798c87ad1b608f94
MD5 1478d790f298f548f8c87e7353fa3aae
BLAKE2b-256 86efae85b8851e1b033ae20e1d1a81ae4658fcc155f821b754a0f0576f1ae26d

See more details on using hashes here.

Supported by

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