# vu-aiml/sat-jepa-diff architecture

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

- Interactive diagram: https://gitdiagram.com/vu-aiml/sat-jepa-diff
- Repository: https://github.com/vu-aiml/sat-jepa-diff

## Overview

Sat-JEPA-Diff forecasts future Sentinel-2 imagery in two stages: IJEPA predicts semantic embeddings, then a conditioning adapter and Stable Diffusion generate the future RGB image. Training uses paired image/embedding data and joint losses; inference supports single-step and autoregressive forecasts, with evaluation and embedding validation as separate capabilities. Relationships among runtime components follow the README and the shown source/index references; unsampled implementation details are not inferred.

Main entry points: [`train.py`](https://github.com/vu-aiml/sat-jepa-diff/blob/main/train.py) (Training Loop), [`inference.py`](https://github.com/vu-aiml/sat-jepa-diff/blob/main/inference.py) (Single Image Inference), [`sd_models.py`](https://github.com/vu-aiml/sat-jepa-diff/blob/main/sd_models.py) (SD 3.5 Model), [`main.py`](https://github.com/vu-aiml/sat-jepa-diff/blob/main/main.py) (Training Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_forecast["Forecasting Models"]
  node_vit["IJEPA ViT"]
  node_adapter["Conditioning Adapter<br/>[sd_models.py]"]
  node_diffusion["SD 3.5 Model<br/>[sd_models.py]"]
end

subgraph group_learning["Training"]
  node_dataset[("Sentinel-2 Dataset<br/>[data.py]")]
  node_masking["Mask Sampling<br/>[multiblock.py]"]
  node_jointloss["Joint Diffusion Loss<br/>[sd_joint_loss.py]"]
  node_trainer["Training Loop<br/>[train.py]"]
  node_entry["Training Entry<br/>[main.py]"]
  node_config["Training Config"]
end

subgraph group_runtime["Prediction &amp; Evaluation"]
  node_inference["Single Image Inference<br/>[inference.py]"]
  node_rollout["Autoregressive Rollout"]
  node_evaluation["Forecast Evaluation<br/>[evaluate.py]"]
  node_metrics["Image Metrics<br/>[metrics.py]"]
  node_embeddingcheck["Embedding Validation"]
  node_ablation["Ablation Analysis<br/>[ablation.py]"]
  node_diagnostics["Rollout Diagnostics"]
end

subgraph group_support["Runtime Support"]
  node_distributed["Distributed Runtime<br/>[distributed.py]"]
  node_logging["Training Logging<br/>[logging.py]"]
end

node_user(("Researcher"))
node_hf[("Hugging Face Models")]

node_user -->|"starts training"| node_entry
node_entry -->|"calls"| node_trainer
node_entry -->|"loads"| node_config
node_trainer -->|"loads batches"| node_dataset
node_trainer -->|"uses masks"| node_masking
node_trainer -->|"trains IJEPA"| node_vit
node_trainer -->|"configures"| node_adapter
node_trainer -->|"loads model"| node_diffusion
node_trainer -->|"computes loss"| node_jointloss
node_trainer -->|"validates embeddings"| node_embeddingcheck
node_trainer -->|"initializes"| node_distributed
node_trainer -.->|"records metrics"| node_logging
node_hf -->|"provides weights"| node_diffusion
node_user -->|"requests forecast"| node_inference
node_inference -->|"encodes image"| node_vit
node_inference -->|"conditions"| node_adapter
node_inference -->|"generates image"| node_diffusion
node_user -->|"requests rollout"| node_rollout
node_rollout -->|"forecasts recursively"| node_diffusion
node_user -->|"requests evaluation"| node_evaluation
node_evaluation -->|"evaluates forecasts"| node_dataset
node_evaluation -->|"computes scores"| node_metrics
node_user -->|"checks embeddings"| node_embeddingcheck
node_user -.->|"runs ablations"| node_ablation
node_user -.->|"inspects rollouts"| node_diagnostics

click node_dataset "https://github.com/vu-aiml/sat-jepa-diff/blob/main/data/data.py"
click node_masking "https://github.com/vu-aiml/sat-jepa-diff/blob/main/masks/multiblock.py"
click node_vit "https://github.com/vu-aiml/sat-jepa-diff/blob/main/models/vision_transformer.py"
click node_adapter "https://github.com/vu-aiml/sat-jepa-diff/blob/main/sd_models.py"
click node_diffusion "https://github.com/vu-aiml/sat-jepa-diff/blob/main/sd_models.py"
click node_jointloss "https://github.com/vu-aiml/sat-jepa-diff/blob/main/sd_joint_loss.py"
click node_trainer "https://github.com/vu-aiml/sat-jepa-diff/blob/main/train.py"
click node_entry "https://github.com/vu-aiml/sat-jepa-diff/blob/main/main.py"
click node_config "https://github.com/vu-aiml/sat-jepa-diff/blob/main/config/s2_future_vith16.yaml"
click node_inference "https://github.com/vu-aiml/sat-jepa-diff/blob/main/inference.py"
click node_rollout "https://github.com/vu-aiml/sat-jepa-diff/blob/main/autoregressive_rollout.py"
click node_evaluation "https://github.com/vu-aiml/sat-jepa-diff/blob/main/evaluate.py"
click node_metrics "https://github.com/vu-aiml/sat-jepa-diff/blob/main/metrics.py"
click node_embeddingcheck "https://github.com/vu-aiml/sat-jepa-diff/blob/main/embedding_validation.py"
click node_ablation "https://github.com/vu-aiml/sat-jepa-diff/blob/main/ablation.py"
click node_diagnostics "https://github.com/vu-aiml/sat-jepa-diff/blob/main/diagnostic_rollout.py"
click node_distributed "https://github.com/vu-aiml/sat-jepa-diff/blob/main/utils/distributed.py"
click node_logging "https://github.com/vu-aiml/sat-jepa-diff/blob/main/utils/logging.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_vit,node_adapter,node_diffusion toneBlue
class node_dataset,node_masking,node_jointloss,node_trainer,node_entry,node_config,node_hf toneAmber
class node_inference,node_rollout,node_evaluation,node_metrics,node_embeddingcheck,node_ablation,node_diagnostics toneMint
class node_distributed,node_logging toneRose
class node_user toneIndigo
```

## Components

### Forecasting Models

- [IJEPA ViT](https://github.com/vu-aiml/sat-jepa-diff/blob/main/models/vision_transformer.py): `models/vision_transformer.py`
- [Conditioning Adapter](https://github.com/vu-aiml/sat-jepa-diff/blob/main/sd_models.py): `sd_models.py`
- [SD 3.5 Model](https://github.com/vu-aiml/sat-jepa-diff/blob/main/sd_models.py): `sd_models.py`

### Training

- [Sentinel-2 Dataset](https://github.com/vu-aiml/sat-jepa-diff/blob/main/data/data.py): `data/data.py`
- [Mask Sampling](https://github.com/vu-aiml/sat-jepa-diff/blob/main/masks/multiblock.py): `masks/multiblock.py`
- [Joint Diffusion Loss](https://github.com/vu-aiml/sat-jepa-diff/blob/main/sd_joint_loss.py): `sd_joint_loss.py`
- [Training Loop](https://github.com/vu-aiml/sat-jepa-diff/blob/main/train.py): `train.py`
- [Training Entry](https://github.com/vu-aiml/sat-jepa-diff/blob/main/main.py): `main.py`
- [Training Config](https://github.com/vu-aiml/sat-jepa-diff/blob/main/config/s2_future_vith16.yaml): `config/s2_future_vith16.yaml`

### Prediction & Evaluation

- [Single Image Inference](https://github.com/vu-aiml/sat-jepa-diff/blob/main/inference.py): `inference.py`
- [Autoregressive Rollout](https://github.com/vu-aiml/sat-jepa-diff/blob/main/autoregressive_rollout.py): `autoregressive_rollout.py`
- [Forecast Evaluation](https://github.com/vu-aiml/sat-jepa-diff/blob/main/evaluate.py): `evaluate.py`
- [Image Metrics](https://github.com/vu-aiml/sat-jepa-diff/blob/main/metrics.py): `metrics.py`
- [Embedding Validation](https://github.com/vu-aiml/sat-jepa-diff/blob/main/embedding_validation.py): `embedding_validation.py`
- [Ablation Analysis](https://github.com/vu-aiml/sat-jepa-diff/blob/main/ablation.py): `ablation.py`
- [Rollout Diagnostics](https://github.com/vu-aiml/sat-jepa-diff/blob/main/diagnostic_rollout.py): `diagnostic_rollout.py`

### Runtime Support

- [Distributed Runtime](https://github.com/vu-aiml/sat-jepa-diff/blob/main/utils/distributed.py): `utils/distributed.py`
- [Training Logging](https://github.com/vu-aiml/sat-jepa-diff/blob/main/utils/logging.py): `utils/logging.py`

### Other components

- **Researcher**
- **Hugging Face Models**

## Connections

- Researcher → Training Entry: starts training (evidence: `README.md`)
- Training Entry → Training Loop: calls (evidence: `main.py`)
- Training Entry → Training Config: loads (evidence: `main.py`)
- Training Loop → Sentinel-2 Dataset: loads batches (evidence: `train.py`)
- Training Loop → Mask Sampling: uses masks (evidence: `train.py`)
- Training Loop → IJEPA ViT: trains IJEPA (evidence: `README.md`)
- Training Loop → Conditioning Adapter: configures (evidence: `train.py`)
- Training Loop → SD 3.5 Model: loads model (evidence: `train.py`)
- Training Loop → Joint Diffusion Loss: computes loss (evidence: `train.py`)
- Training Loop → Embedding Validation: validates embeddings (evidence: `train.py`)
- Training Loop → Distributed Runtime: initializes (evidence: `utils/distributed.py`)
- Training Loop → Training Logging: records metrics (evidence: `train.py`)
- Hugging Face Models → SD 3.5 Model: provides weights (evidence: `README.md`)
- Researcher → Single Image Inference: requests forecast (evidence: `README.md`)
- Single Image Inference → IJEPA ViT: encodes image (evidence: `README.md`)
- Single Image Inference → Conditioning Adapter: conditions (evidence: `README.md`)
- Single Image Inference → SD 3.5 Model: generates image (evidence: `README.md`)
- Researcher → Autoregressive Rollout: requests rollout (evidence: `README.md`)
- Autoregressive Rollout → SD 3.5 Model: forecasts recursively (evidence: `autoregressive_rollout.py`)
- Researcher → Forecast Evaluation: requests evaluation (evidence: `README.md`)
- Forecast Evaluation → Sentinel-2 Dataset: evaluates forecasts (evidence: `evaluate.py`)
- Forecast Evaluation → Image Metrics: computes scores (evidence: `README.md`)
- Researcher → Embedding Validation: checks embeddings (evidence: `README.md`)
- Researcher → Ablation Analysis: runs ablations
- Researcher → Rollout Diagnostics: inspects rollouts
