Skip to main content

HydraFlow seamlessly integrates Hydra and MLflow to streamline ML experiment management, combining Hydra's configuration management with MLflow's tracking capabilities.

Project description

HydraFlow

PyPI Version Build Status Coverage Status Documentation Status Python Version

Overview

HydraFlow seamlessly integrates Hydra and MLflow to streamline machine learning experiment workflows. By combining Hydra's powerful configuration management with MLflow's robust experiment tracking, HydraFlow provides a comprehensive solution for defining, executing, and analyzing machine learning experiments.

Design Principles

HydraFlow is built on the following design principles:

  1. Type Safety - Utilizing Python dataclasses for configuration type checking and IDE support
  2. Reproducibility - Automatically tracking all experiment configurations for fully reproducible experiments
  3. Analysis Capabilities - Providing powerful APIs for easily analyzing experiment results
  4. Workflow Integration - Creating a cohesive workflow by integrating Hydra's configuration management with MLflow's experiment tracking

Key Features

  • Type-safe Configuration Management - Define experiment parameters using Python dataclasses with full IDE support and validation
  • Seamless Hydra-MLflow Integration - Automatically register configurations with Hydra and track experiments with MLflow
  • Advanced Parameter Sweeps - Define complex parameter spaces using extended sweep syntax for numerical ranges, combinations, and SI prefixes
  • Workflow Automation - Create reusable experiment workflows with YAML-based job definitions
  • Powerful Analysis Tools - Filter, group, and analyze experiment results with type-aware APIs
  • Custom Implementation Support - Extend experiment analysis with domain-specific functionality

Installation

pip install hydraflow

Requirements: Python 3.13+

Quick Example

import hydraflow
from dataclasses import dataclass
from mlflow.entities import Run

@dataclass
class Config:
    width: int = 1024
    height: int = 768

@hydraflow.main(Config, tracking_uri="sqlite:///mlflow.db")
def app(run: Run, cfg: Config) -> None:
    # Your experiment code here
    print(f"Running with width={cfg.width}, height={cfg.height}")

if __name__ == "__main__":
    app()

Execute a parameter sweep with:

python app.py -m width=800,1200 height=600,900

Core Components

HydraFlow consists of the following key components:

Configuration Management

Define type-safe configurations using Python dataclasses:

@dataclass
class Config:
    learning_rate: float = 0.001
    batch_size: int = 32
    epochs: int = 10

Main Decorator

The @hydraflow.main decorator integrates Hydra and MLflow:

@hydraflow.main(Config)
def train(run: Run, cfg: Config) -> None:
    # Your experiment code

Workflow Automation

Define reusable experiment workflows in YAML:

jobs:
  train_models:
    run: python train.py
    sets:
      - each: model=small,medium,large
        all: learning_rate=0.001,0.01,0.1

Analysis Tools

Analyze experiment results with powerful APIs:

import mlflow
from hydraflow import Run, iter_run_dirs

# Load runs
mlflow.set_tracking_uri("sqlite:///mlflow.db")
runs = Run.load(iter_run_dirs())

# Filter and analyze
best_runs = runs.filter(model_type="transformer").to_frame("learning_rate", "accuracy")

Documentation

For detailed documentation, visit our documentation site:

License

This project is licensed under the MIT License.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

hydraflow-0.21.1.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

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

hydraflow-0.21.1-py3-none-any.whl (38.9 kB view details)

Uploaded Python 3

File details

Details for the file hydraflow-0.21.1.tar.gz.

File metadata

  • Download URL: hydraflow-0.21.1.tar.gz
  • Upload date:
  • Size: 31.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hydraflow-0.21.1.tar.gz
Algorithm Hash digest
SHA256 9f9871e2c8bc300df9a31005a1f0ce1e60ef0b9aeb2efb99ad6f33de5d7f855e
MD5 6d767405d1ff90aae1ceb0ec5df7bd4d
BLAKE2b-256 b6ed1377b188f3d9a84c2d01643a4a9900c9c21ae4388337db356d08d0635cf8

See more details on using hashes here.

File details

Details for the file hydraflow-0.21.1-py3-none-any.whl.

File metadata

  • Download URL: hydraflow-0.21.1-py3-none-any.whl
  • Upload date:
  • Size: 38.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.9.13 {"installer":{"name":"uv","version":"0.9.13"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for hydraflow-0.21.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ed42f28bc29101b040dc73bd57670cc8472728b1c848f22c468cbdbc8c25a3d4
MD5 a7bc658602e155beb7542d82f56e2605
BLAKE2b-256 803e1dc3f6749a53a957be153b7660034d0ea885ffc2b4b6572b19eef8b9ac83

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