# zwu88/tante architecture

> Architecture diagram of the GitHub repository zwu88/tante, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/zwu88/tante
- Repository: https://github.com/zwu88/tante

## Overview

TANTE is a scientific-ML framework for learning continuous-time forecasts of time-dependent PDEs, with neural Taylor expansion and adaptive step sizes as its principal method. Its user workflow is to configure a dataset and model, train or resume from a checkpoint, then evaluate checkpoint-based rollouts. The repository also includes several operator-learning and transformer model implementations, plus separate regular and adaptive-training/evaluation modules. Edges are limited to relationships visible in the excerpts or README; unsampled wiring is omitted.

Main entry points: [`trainer/trainer.py`](https://github.com/zwu88/tante/blob/main/trainer/trainer.py) (Trainer), [`data/datamodule.py`](https://github.com/zwu88/tante/blob/main/data/datamodule.py) (Data module), [`models/tante.py`](https://github.com/zwu88/tante/blob/main/models/tante.py) (TANTE model), [`data/dataset.py`](https://github.com/zwu88/tante/blob/main/data/dataset.py) (HDF5 dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["User Workflow"]
  node_train_entry["Train entry<br/>[train.py]"]
  node_eval_entry["Evaluation entry<br/>[eval.py]"]
  node_configs["Model configs"]
end

subgraph group_data["Data Preparation"]
  node_dataset_files["Benchmark datasets"]
  node_dataset["HDF5 dataset<br/>[dataset.py]"]
  node_datamodule["Data module<br/>[datamodule.py]"]
  node_formatter["Data formatters<br/>[datamodule.py]"]
end

subgraph group_models["Forecast Models"]
  node_model_registry["Model exports<br/>[__init__.py]"]
  node_tante["TANTE model<br/>[tante.py]"]
  node_tante_blocks["TANTE encoder and attention<br/>[enc_dec_cnn.py]"]
  node_attention_backbone["Attention backbone<br/>[attn_backbone.py]"]
  node_other_models["Operator model variants"]
end

subgraph group_runtime["Training and Evaluation"]
  node_trainer["Trainer<br/>[trainer.py]"]
  node_adaptive_trainer["Adaptive trainer<br/>[r_trainer.py]"]
  node_evaler["Rollout evaluator<br/>[evaler.py]"]
  node_adaptive_evaler["Adaptive evaluator<br/>[r_evaler.py]"]
end

subgraph group_state["State and Metrics"]
  node_metrics["Forecast metrics<br/>[metrics.py]"]
  node_scheduler["Learning-rate schedulers<br/>[schedulers.py]"]
  node_checkpoint["Experiment checkpoints"]
end

node_user(("Researcher"))
node_wandb(("Weights &amp; Biases"))

node_user -->|"starts training"| node_train_entry
node_user -->|"starts evaluation"| node_eval_entry
node_train_entry -.->|"selects config"| node_configs
node_eval_entry -.->|"selects config"| node_configs
node_configs -.->|"sets dataset options"| node_dataset
node_dataset_files -->|"provides files"| node_dataset
node_datamodule -->|"creates splits"| node_dataset
node_datamodule -->|"provides formatters"| node_formatter
node_model_registry -->|"exports"| node_tante
node_model_registry -->|"exports variants"| node_other_models
node_tante -->|"uses encoders"| node_tante_blocks
node_tante -->|"uses backbone"| node_attention_backbone
node_train_entry -->|"starts trainer"| node_trainer
node_eval_entry -->|"imports trainer"| node_trainer
node_trainer -->|"uses data module"| node_datamodule
node_trainer -->|"formats batches"| node_formatter
node_trainer -->|"saves and loads"| node_checkpoint
node_trainer -.->|"logs metrics"| node_wandb
node_evaler -->|"uses data module"| node_datamodule
node_adaptive_trainer -->|"uses data module"| node_datamodule
node_adaptive_evaler -->|"uses data module"| node_datamodule
node_tante -->|"reads metadata"| node_dataset
node_user -.->|"resumes experiment"| node_checkpoint

click node_train_entry "https://github.com/zwu88/tante/blob/main/train.py"
click node_eval_entry "https://github.com/zwu88/tante/blob/main/eval.py"
click node_configs "https://github.com/zwu88/tante/tree/main/configs"
click node_dataset_files "https://github.com/zwu88/tante/tree/main/datasets"
click node_dataset "https://github.com/zwu88/tante/blob/main/data/dataset.py"
click node_datamodule "https://github.com/zwu88/tante/blob/main/data/datamodule.py"
click node_formatter "https://github.com/zwu88/tante/blob/main/data/datamodule.py"
click node_model_registry "https://github.com/zwu88/tante/blob/main/models/__init__.py"
click node_tante "https://github.com/zwu88/tante/blob/main/models/tante.py"
click node_tante_blocks "https://github.com/zwu88/tante/blob/main/models/enc_dec_cnn.py"
click node_attention_backbone "https://github.com/zwu88/tante/blob/main/models/attn_backbone.py"
click node_other_models "https://github.com/zwu88/tante/tree/main/models"
click node_trainer "https://github.com/zwu88/tante/blob/main/trainer/trainer.py"
click node_adaptive_trainer "https://github.com/zwu88/tante/blob/main/trainer/r_trainer.py"
click node_evaler "https://github.com/zwu88/tante/blob/main/trainer/evaler.py"
click node_adaptive_evaler "https://github.com/zwu88/tante/blob/main/trainer/r_evaler.py"
click node_metrics "https://github.com/zwu88/tante/blob/main/trainer/metrics.py"
click node_scheduler "https://github.com/zwu88/tante/blob/main/optim/schedulers.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_train_entry,node_eval_entry,node_configs toneBlue
class node_dataset_files,node_dataset,node_datamodule,node_formatter toneAmber
class node_model_registry,node_tante,node_tante_blocks,node_attention_backbone,node_other_models toneMint
class node_trainer,node_adaptive_trainer,node_evaler,node_adaptive_evaler toneRose
class node_metrics,node_scheduler,node_checkpoint,node_user,node_wandb toneIndigo
```

## Components

### User Workflow

- [Train entry](https://github.com/zwu88/tante/blob/main/train.py): `train.py`
- [Evaluation entry](https://github.com/zwu88/tante/blob/main/eval.py): `eval.py`
- [Model configs](https://github.com/zwu88/tante/tree/main/configs): `configs`

### Data Preparation

- [Benchmark datasets](https://github.com/zwu88/tante/tree/main/datasets): `datasets`
- [HDF5 dataset](https://github.com/zwu88/tante/blob/main/data/dataset.py): `data/dataset.py`
- [Data module](https://github.com/zwu88/tante/blob/main/data/datamodule.py): `data/datamodule.py`
- [Data formatters](https://github.com/zwu88/tante/blob/main/data/datamodule.py): `data/datamodule.py`

### Forecast Models

- [Model exports](https://github.com/zwu88/tante/blob/main/models/__init__.py): `models/__init__.py`
- [TANTE model](https://github.com/zwu88/tante/blob/main/models/tante.py): `models/tante.py`
- [TANTE encoder and attention](https://github.com/zwu88/tante/blob/main/models/enc_dec_cnn.py): `models/enc_dec_cnn.py`
- [Attention backbone](https://github.com/zwu88/tante/blob/main/models/attn_backbone.py): `models/attn_backbone.py`
- [Operator model variants](https://github.com/zwu88/tante/tree/main/models): `models`

### Training and Evaluation

- [Trainer](https://github.com/zwu88/tante/blob/main/trainer/trainer.py): `trainer/trainer.py`
- [Adaptive trainer](https://github.com/zwu88/tante/blob/main/trainer/r_trainer.py): `trainer/r_trainer.py`
- [Rollout evaluator](https://github.com/zwu88/tante/blob/main/trainer/evaler.py): `trainer/evaler.py`
- [Adaptive evaluator](https://github.com/zwu88/tante/blob/main/trainer/r_evaler.py): `trainer/r_evaler.py`

### State and Metrics

- [Forecast metrics](https://github.com/zwu88/tante/blob/main/trainer/metrics.py): `trainer/metrics.py`
- [Learning-rate schedulers](https://github.com/zwu88/tante/blob/main/optim/schedulers.py): `optim/schedulers.py`
- **Experiment checkpoints**

### Other components

- **Researcher**
- **Weights & Biases**

## Connections

- Researcher → Train entry: starts training (evidence: `README.md`)
- Researcher → Evaluation entry: starts evaluation (evidence: `README.md`)
- Train entry → Model configs: selects config
- Evaluation entry → Model configs: selects config
- Model configs → HDF5 dataset: sets dataset options
- Benchmark datasets → HDF5 dataset: provides files (evidence: `README.md`)
- Data module → HDF5 dataset: creates splits (evidence: `data/datamodule.py`)
- Data module → Data formatters: provides formatters (evidence: `data/datamodule.py`)
- Model exports → TANTE model: exports (evidence: `models/__init__.py`)
- Model exports → Operator model variants: exports variants (evidence: `models/__init__.py`)
- TANTE model → TANTE encoder and attention: uses encoders (evidence: `models/tante.py`)
- TANTE model → Attention backbone: uses backbone (evidence: `models/tante.py`)
- Train entry → Trainer: starts trainer (evidence: `train.py`)
- Evaluation entry → Trainer: imports trainer (evidence: `eval.py`)
- Trainer → Data module: uses data module (evidence: `trainer/trainer.py`)
- Trainer → Data formatters: formats batches (evidence: `trainer/trainer.py`)
- Trainer → Experiment checkpoints: saves and loads (evidence: `trainer/trainer.py`)
- Trainer → Weights & Biases: logs metrics
- Rollout evaluator → Data module: uses data module (evidence: `trainer/evaler.py`)
- Adaptive trainer → Data module: uses data module (evidence: `trainer/r_trainer.py`)
- Adaptive evaluator → Data module: uses data module (evidence: `trainer/r_evaler.py`)
- TANTE model → HDF5 dataset: reads metadata (evidence: `models/tante.py`)
- Researcher → Experiment checkpoints: resumes experiment
