Metadata-Version: 2.3
Name: silver-doodle
Version: 0.1.1
Summary: Lightning training runs, locally or on Kubeflow Trainer
Author: OERI
Author-email: OERI <25751602+oddeirikigland@users.noreply.github.com>
Requires-Dist: jsonargparse[signatures]>=4.27.7
Requires-Dist: lightning>=2.6.5
Requires-Dist: mlflow>=3.15.2
Requires-Dist: python-dotenv>=1.2.3
Requires-Dist: torch==2.2.2 ; platform_machine == 'x86_64' and sys_platform == 'darwin'
Requires-Dist: numpy<2 ; platform_machine == 'x86_64' and sys_platform == 'darwin'
Requires-Dist: torch>=2.9 ; platform_machine != 'x86_64' or sys_platform != 'darwin'
Requires-Dist: numpy>=2 ; platform_machine != 'x86_64' or sys_platform != 'darwin'
Requires-Dist: kubeflow>=0.5.0 ; extra == 'kubeflow'
Requires-Python: >=3.12
Provides-Extra: kubeflow
Description-Content-Type: text/markdown

# silver-doodle

Lightning training runs with [LightningCLI](https://lightning.ai/docs/pytorch/stable/cli/lightning_cli.html),
run locally or on Kubeflow Trainer, with the config and metrics logged to MLflow.

## Setup

```bash
uv sync --extra kubeflow
cp .env.example .env   # set MLFLOW_TRACKING_URI and credentials
```

## Run locally

```bash
uv run silver-doodle fit --config configs/example.yaml
uv run silver-doodle fit --config configs/example.yaml --trainer.max_epochs 2   # override anything
uv run silver-doodle fit --config configs/example.yaml --print_config           # show the full config
```

## Run on Kubeflow

`silver-doodle-submit` takes the same arguments as `silver-doodle`:

```bash
uv run silver-doodle-submit --dry-run fit --config configs/example.yaml   # prepare only
uv run silver-doodle-submit fit --config configs/example.yaml --trainer.enable_progress_bar false
uv run silver-doodle-submit fit --config configs/example.yaml \
    --trainer.accelerator gpu --trainer.devices 2 --trainer.num_nodes 2
```

1. The full config is resolved locally with `--print_config`, so mistakes fail before submitting.
2. The local code, uncommitted changes included, is built into a wheel with `uv build`.
3. The pod installs the dependencies and the wheel, then runs
   `silver-doodle <subcommand> --config <resolved config>`.

Pod resources come from the config: `trainer.num_nodes` nodes, each with `trainer.devices` GPUs
when `trainer.accelerator` is `gpu`/`cuda`. The MLflow env vars are forwarded to the pod.
Logs, the resolved config and the wheel are saved in `logs/<timestamp>/`.

`MLFLOW_TRACKING_URI` must point to a tracking server, not `sqlite:///...`: the URI ends up in the
resolved config (it is `MLFlowLogger`'s default), and a local database in the pod is lost with it.

## Development

```bash
uv run pytest
uv run ruff check .
uv run ruff format --check .
uv run ty check .
```
