Skip to content

Repository files navigation

Machine Learning Template

This project provides a machine learning quickstart template using PyTorch Lightning, Hydra, MLflow, and uv.

Installation

  1. Clone the repository:
    git clone <your-repository-url>
    cd machine-learning
  2. Install uv: Follow the instructions on the uv website if you don't have it installed.
  3. Install dependencies: This command creates a virtual environment and installs all necessary packages defined in pyproject.toml.
    uv sync

Configuration

This project uses Hydra for configuration management.

  • Configuration files are located in the configs/ directory.
  • The main configuration file is configs/lymph_nodes.yaml.
  • You can override configuration parameters directly from the command line. For example, to change the batch size:
    uv run python +m <lymph_nodes> mode=fit data.batch_size=64
  • MLflow is configured as the default logger (see configs/default.yaml). Ensure your MLflow tracking server is running or configure it accordingly.

Usage

  • Train the model:

    uv run python +m <lymph_nodes> mode=fit
  • Validate the model: Requires a checkpoint path to be set in the configuration (e.g., checkpoint=path/to/your/checkpoint.ckpt) or passed via the command line.

    uv run python +m <lymph_nodes> mode=validate checkpoint=path/to/checkpoint.ckpt
  • Test the model: Requires a checkpoint path.

    uv run python +m <lymph_nodes> mode=test checkpoint=path/to/checkpoint.ckpt
  • Run prediction: Requires a checkpoint path.

    uv run python +m <lymph_nodes> mode=predict checkpoint=path/to/checkpoint.ckpt

Linting, Formatting and Type Checking:

uvx ruff check  # Check and fix linting issues
uvx ruff format # Format code
uvx mypy .     # Run mypy

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages