This project provides a machine learning quickstart template using PyTorch Lightning, Hydra, MLflow, and uv.
- Clone the repository:
git clone <your-repository-url> cd machine-learning
- Install uv: Follow the instructions on the uv website if you don't have it installed.
- Install dependencies:
This command creates a virtual environment and installs all necessary packages defined in
pyproject.toml.uv sync
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.
-
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
uvx ruff check # Check and fix linting issues
uvx ruff format # Format code
uvx mypy . # Run mypy