Skip to main content

A hackable blueprint for training neural networks using PyTorch and Lightning.

Project description

Venturi Logo

Venturi

A hackable blueprint for training neural networks

Quick StartInstallationWhy Venturi?Examples


Venturi is a minimalist alternative to Hydra and LightningCLI for separating experiment parameters from code, while prioritizing framework transparency and flexibility.

Quick Start

Scaffold a Project

Generate a default configuration file:

venturi create path/to/project

This creates a base_config.yaml file containing the default parameters for an experiment.

Add custom configuration and run an experiment

from venturi import Config, Experiment

# Load Venturi defaults
vcfg = Config("base_config.yaml")

# Add custom configuration for dataset, model and loss function
vcfg.update_from_yaml("experiments/my_custom_config.yaml")

# Initialize, train and test. All training artifacts, including
# performance metrics and model checkpoints are logged.
experiment = Experiment(vcfg)
experiment.fit()
results = experiment.test()

Optimize experiment hyperparameters

vcfg = ... # Load configuration
experiment = Experiment(vcfg)

# Load hyperparameter search space
vcfg_space = Config("config/search_space.yaml")
# Run hyperparameter search
study = experiment.optimize(vcfg_space)

print("Best parameters:", study.best_params)

Change a core Venturi component

The default experiment lifecycle is flexible to support changing the main training artifacts (dataset, model, metrics and composite loss functions). But if custom training logic is required, you can just change one of the base classes:

from venturi import TrainingModule, Experiment

class CustomTrainingModule(TrainingModule):
  def training_step(self, batch):
    # Get all experiment settings
    vcfg = self.vcfg
    # Create custom logic for training step
    ...

class CustomExperiment(Experiment):
  def get_loggers(self):
    vcfg = self.vcfg
    # Add your own logic for storing performance metrics
    ...

...
experiment = CustomExperiment(vcfg)
experiment.fit()

Installation

Install the core package:

pip install venturi

To enable Weights & Biases logging and to run the provided examples, install all dependencies:

pip install "venturi[all]"

There is no conda package yet. To install on conda you can do

conda env create -n env_name -f environment.yaml 
conda activate env_name
# --no-build-isolation --no-deps is useful for avoiding pip conflicts
pip install --no-build-isolation --no-deps venturi 

Why Venturi?

Most configuration frameworks force you to learn their specific DSL or hide logic behind complex abstractions. Venturi takes a different approach:

  • Auditable Core: The entire package logic resides in just two files: config.py and core.py. You can read, understand, and modify the inner workings.
  • Zero-Overhead Configuration: No enforced argparse or pydantic validation by default. You instantiate Python objects directly from YAML. Validation is opt-in, not mandatory.
  • Global Context: The full YAML configuration is passed to the main classes used for training. This allows you to define complex relationships (e.g., dynamically setting model depth based on dataset size) without changing experiment setup code.
  • Inheritance-First Design: The experiment lifecycle is defined by classes designed to be subclassed when custom training logic is necessary.

Examples

Some examples are provided in the examples directory:

Example Description
Configuration The core concept: instantiating arbitrary Python objects directly from YAML and mixing multiple config files
Image segmentation A complete image segmentation experiment setup
Hyperparameter search Hyperparameter optimization using Optuna
Base Config The reference file describing all standard Venturi parameters

Design Philosophy

Venturi is built on the principle that research code should be hackable.

  1. Transparency: You should not have to dig through a call stack of 50 internal functions to understand how your configurations are parsed.
  2. Flexibility: If you want to add Pydantic validation, you can add it before passing the config to the Experiment class. It is not baked into the core.
  3. Portability: By avoiding complex CLI dependency injection, your experiments remain standard Python scripts that are easy to debug and deploy.

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

venturi-0.9.3.tar.gz (93.3 kB view details)

Uploaded Source

Built Distribution

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

venturi-0.9.3-py3-none-any.whl (29.9 kB view details)

Uploaded Python 3

File details

Details for the file venturi-0.9.3.tar.gz.

File metadata

  • Download URL: venturi-0.9.3.tar.gz
  • Upload date:
  • Size: 93.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for venturi-0.9.3.tar.gz
Algorithm Hash digest
SHA256 24915b38c16fec259899470fb45c20299b8ac844ecb5955bc8d77934e72a3a6b
MD5 e9107bf985bb6fe6f6c7612a3043c8de
BLAKE2b-256 4de55bac1f3410511fb529068c0935530b13bffbf8c605fe9d52451cb5e4b827

See more details on using hashes here.

File details

Details for the file venturi-0.9.3-py3-none-any.whl.

File metadata

  • Download URL: venturi-0.9.3-py3-none-any.whl
  • Upload date:
  • Size: 29.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for venturi-0.9.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aaf541a65ec1454d67401da5143da24df0d6462f2d5ec21731d297784722a7a1
MD5 f0aad8ba64d9d08bd64022360baa472f
BLAKE2b-256 ae8461c1a855f3bec9750d24af17c6b933bf97ad19d55b03993f5792d2b9639d

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