diff --git a/README.md b/README.md index 0484579..090ed60 100644 --- a/README.md +++ b/README.md @@ -160,20 +160,22 @@ poetry run mypy . ### What `main.py` Does -- Builds the `DummyCNN_MNIST` model defined in `src/model/DummyCNN_MNIST.py`, a cross-entropy loss, and an Adam optimizer. -- Loads the MNIST training split, stacks the tensors, and iterates over 10 tasks (digits 0–9). Each task applies random rotation and translation to encourage continual adaptation. -- Maintains replay buffers (`memory_image`, `memory_label`, etc.) so past samples remain available for rehearsal while training new tasks. -- Calls `CL(...)` to assemble task-specific dataloaders and drive the `One_task_CL` loop. The loop trains for five epochs, records loss/accuracy metrics, and prints periodic progress reports. -- Computes sensitivity scores with `src/validation/validation_utils/return_score` after each task; you can repurpose these values for analysis or adaptive triggers. +- Builds a `Config` from the TOML file, `APP_` environment variables, and `--set` CLI overrides (`src/apeiron/config/configuration.py`). +- Configures the logging backend and console logger (`src/apeiron/logger/`), before constructing the harness so a harness that logs from `__init__` cannot pin the config. +- Selects a concrete `BaseModelHarness` from `cfg.data.name` via `examples/utils.py:get_example`. +- Runs `ContinuousMonitor` (`src/apeiron/driver/continuous_monitor.py`), which evaluates streaming batches and calls the drift detector every `detection_interval` batches. +- On drift, dispatches `ContinuousTrainer` (`src/apeiron/training/continuous_trainer.py`) with the updater named by `[continual_learning] update_mode`. + +See [`docs/architecture.md`](docs/architecture.md) for the full pipeline, including the detection-only (`src/drift_only.py`) and adaptation-only (`src/cl_only.py`) entry points. ## Tuning Tips -- Change the number of epochs by editing `n_epoch` inside `CL`. -- Adjust replay/adversarial update counts through the `params` dictionaries in `One_task_CL` and `util.update_CL_`. -- Experiment with different transforms or task definitions by modifying `data.py`. -- Update batch sizes by changing the `batch_size` parameter used when constructing the dataloaders. +- Change the CL loop's outer/inner iteration counts and learning rate through the `[continual_learning]` and `[train]` config sections. +- Swap the adaptation strategy with `[continual_learning] update_mode` (`base`, `jvp_reg`, `ewc_online`, `kfac_online`, `none`). +- Tune detection sensitivity with `[drift_detection] detector_name` and its per-detector parameters — see [`docs/drift_detectors.md`](docs/drift_detectors.md). +- Update batch size and worker count with `[train] batch_size` and `[train] num_workers`. ## Output -Training logs report the task id, training/test accuracy, and replay-memory accuracy every five epochs. Accuracy is computed via `test(...)` on both the current task and the accumulated memory set. +The console logger reports per-stage metrics (`eval`, `drift`, `cl`). When `[visualization] input` is set, the run also writes a metrics CSV at that path for external plotting. ## Deployment diff --git a/examples/mnist/model.py b/examples/mnist/model.py index c43d525..0acc4b8 100644 --- a/examples/mnist/model.py +++ b/examples/mnist/model.py @@ -1,4 +1,4 @@ -# src/model/mnist_cnn_harness.py +# examples/mnist/model.py import gc import torch import torch.nn.functional as F diff --git a/src/apeiron/deployment/frontier/README.md b/src/apeiron/deployment/frontier/README.md index c95a1ad..bd0b059 100644 --- a/src/apeiron/deployment/frontier/README.md +++ b/src/apeiron/deployment/frontier/README.md @@ -10,7 +10,7 @@ Clone the repo into your scratch directory and run the install script: cd $MEMBERWORK git clone https://github.com/AI-ModCon/BaseSim_Framework.git cd BaseSim_Framework -source ./src/deployment/frontier/install_venv.sh +source ./src/apeiron/deployment/frontier/install_venv.sh ``` `install_venv.sh` creates a virtual environment, installs Poetry, and uses it to resolve and install project dependencies. The environment is saved to `.venv` in the project root. The script runs the following: @@ -51,7 +51,7 @@ The virtual environment can be sourced directly at the top of your SLURM script From the project root: ```bash -sbatch -A xxx src/deployment/frontier/mnist_example.sbatch +sbatch -A xxx src/apeiron/deployment/frontier/mnist_example.sbatch ``` ### Troubleshooting diff --git a/src/apeiron/deployment/perlmutter/README.md b/src/apeiron/deployment/perlmutter/README.md index ab4b891..ef0b5a4 100644 --- a/src/apeiron/deployment/perlmutter/README.md +++ b/src/apeiron/deployment/perlmutter/README.md @@ -10,7 +10,7 @@ Clone the repo into your scratch directory and run the install script: cd $SCRATCH git clone https://github.com/AI-ModCon/BaseSim_Framework.git cd BaseSim_Framework -source ./src/deployment/perlmutter/install_venv.sh +source ./src/apeiron/deployment/perlmutter/install_venv.sh ``` `install_venv.sh` creates a virtual environment, installs Poetry, and uses it to resolve and install project dependencies. The environment is saved to `.venv` in the project root. The script runs the following: @@ -37,7 +37,7 @@ The virtual environment can be sourced directly at the top of your SLURM script From the project root: ```bash -sbatch -A amsc002 src/deployment/perlmutter/mnist_example.sbatch +sbatch -A amsc002 src/apeiron/deployment/perlmutter/mnist_example.sbatch ``` ### Troubleshooting diff --git a/tests/test_config.py b/tests/test_config.py index 2f88468..831d593 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1,4 +1,4 @@ -"""Tests for src/config/configuration.py""" +"""Tests for src/apeiron/config/configuration.py""" from __future__ import annotations diff --git a/tests/test_continuous_monitor.py b/tests/test_continuous_monitor.py index 4ba1c64..455720b 100644 --- a/tests/test_continuous_monitor.py +++ b/tests/test_continuous_monitor.py @@ -1,4 +1,4 @@ -"""Tests for src/driver/continuous_monitor.py""" +"""Tests for src/apeiron/driver/continuous_monitor.py""" from __future__ import annotations diff --git a/tests/test_continuous_trainer.py b/tests/test_continuous_trainer.py index 46db544..e7596a0 100644 --- a/tests/test_continuous_trainer.py +++ b/tests/test_continuous_trainer.py @@ -1,4 +1,4 @@ -"""Tests for src/training/continuous_trainer.py""" +"""Tests for src/apeiron/training/continuous_trainer.py""" from __future__ import annotations diff --git a/tests/test_evaluation.py b/tests/test_evaluation.py index 5545c69..7e2ee00 100644 --- a/tests/test_evaluation.py +++ b/tests/test_evaluation.py @@ -1,4 +1,4 @@ -"""Tests for src/evaluation/metrics.py and src/evaluation/evaluation.py""" +"""Tests for src/apeiron/evaluation/metrics.py and src/apeiron/evaluation/evaluation.py""" from __future__ import annotations diff --git a/tests/test_model_harness.py b/tests/test_model_harness.py index 9f36225..f6f4d74 100644 --- a/tests/test_model_harness.py +++ b/tests/test_model_harness.py @@ -1,4 +1,4 @@ -"""Tests for src/model/torch_model_harness.py (BaseModelHarness via DummyHarness).""" +"""Tests for src/apeiron/model/torch_model_harness.py (BaseModelHarness via DummyHarness).""" from __future__ import annotations diff --git a/tests/test_profiler.py b/tests/test_profiler.py index 52905e6..06a768d 100644 --- a/tests/test_profiler.py +++ b/tests/test_profiler.py @@ -1,4 +1,4 @@ -"""Tests for src/profilers/count_flops.py""" +"""Tests for src/apeiron/profilers/count_flops.py""" from __future__ import annotations