Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Data and configs
*.toml
!examples/**/*.toml

# Logging files
*.db
Expand All @@ -15,13 +16,18 @@ data/*

# bash
*.sh
!examples/**/*.sh

# Slurm job logs land in the submitting directory
slurm-*.out
slurm-*.err


# Files
*.png
!docs/images/*.png
*.txt
!docs/requirements.txt
!examples/**/*.txt
*.csv
!tests/references/*.csv
*.pdf
Expand Down Expand Up @@ -163,7 +169,6 @@ celerybeat.pid
.env
.envrc
.venv
.venv-docs/
env/
venv/
ENV/
Expand Down Expand Up @@ -231,3 +236,4 @@ cython_debug/
marimo/_static/
marimo/_lsp/
__marimo__/
output/
Binary file added docs/images/matey-adaptation-sequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/matey-detector-response.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/matey-forgetting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/matey-xgc-detectors.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/matey-xgc-device-maps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 7 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ poetry run python -m src.main --config <path_to_toml>
| [`mnist/`](mnist/README.md) | `mnist` | 3-layer CNN (`Cnn`, ~1M params) | Simulated: cumulative random affine per stream window | Auto-downloaded to `./data` | Yes — CPU is fine |
| [`cifar/`](cifar/README.md) | `cifar10` | ViT-B/16 or VGG-11 (`VisionModelCifar`) | Simulated: random affine per stream window | Auto-downloaded to `./data` | GPU strongly recommended |
| [`imagenet/`](imagenet/README.md) | `imagenet` | ViT-B/16 (`VisionModelImageNet`) | Simulated: cumulative random affine per stream window | **You provide** ILSVRC-2012 in `ImageFolder` layout | No — multi-GPU scale |
| [`matey/`](matey/README.md) | `matey`, `matey_stream` | MATEY ViT surrogate (`MATEYHarness`) | **Real**: SOLPS simulations arriving from new scenarios and machines | **You provide** a SOLPS root and a MATEY checkpoint | No — multi-GPU scale, and needs the MATEY package |

**Start with `mnist/`.** It is the only example that ships a pretrained
checkpoint, downloads its own data, and finishes in minutes on CPU.
Expand All @@ -41,8 +42,12 @@ See [`docs/model_harness.md`](../docs/model_harness.md) for the full contract.

## How Drift Is Simulated

None of these datasets drift on their own, so each harness manufactures drift the
same way: `update_data_stream()` draws a seeded random affine transform
`matey/` is the exception to everything in this section: its stream is a real
sequence of simulations, so it needs no synthetic drift at all. See
[`matey/README.md`](matey/README.md).

None of the other datasets drift on their own, so each of those harnesses
manufactures drift the same way: `update_data_stream()` draws a seeded random affine transform
(rotation / scale / shear / translation) and rebuilds the train, validation, and
stream loaders through it. Every time the stream is exhausted, another transform
is drawn, so the input distribution keeps moving away from what the model was
Expand Down
75 changes: 75 additions & 0 deletions examples/matey/Demo_SOLPS_vit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
basic_config: &basic_config
# Run settings
log_to_wandb: !!bool False #True # Use wandb integration
log_to_screen: !!bool True # Log progress to screen.
save_checkpoint: !!bool True # Save checkpoints
checkpoint_save_interval: 10 # Save every # epochs - also saves "best" according to val loss
debug_grad: !!bool True # Compute gradient/step_sizes/ect for debugging
true_time: !!bool False # Debugging setting - sets num workers to zero and activates syncs
num_data_workers: 2 #6 # Generally pulling 8 cpu per process, so using 6 for DL - not sure if best ratio
enable_amp: !!bool False # Use automatic mixed precision - blows up with low variance fields right now
compile: !!bool False # Compile model - Does not currently work
gradient_checkpointing: !!bool False # Whether to use gradient checkpointing - Slow, but lower memory
exp_dir: './Dev_SOLPS' # Output path
log_interval: 1 # How often to log - Don't think this is actually implemented
pretrained: !!bool False # Whether to load a pretrained model
# Training settings
drop_path: 0.1
batch_size: 64
max_epochs: 10
scheduler_epochs: -1
epoch_size: 20
rescale_gradients: !!bool False # Activate hook that scales block gradients to norm 1
optimizer: 'AdamW' # DAdaptAdam 'AdamW' 'SGD'
scheduler: 'none' # Only cosine implemented
warmup_steps: 0 # Warmup when not using DAdapt
learning_rate: 1e-3 #
weight_decay: 1e-3
n_states: 29 # Must be >= max field label + 1 in the dataset
state_names: ['Pressure', 'Vx', 'Vy', 'Density', 'Vx', 'Vy', 'Density', 'Pressure'] # These are not used now!
dt: 1 # Striding of data - Not currently implemented > 1
leadtime_max: 10 #prediction lead time range [1, leadtime_max]
autoregressive: !!bool True # autoregressive training or one-step prediction
supportdata: # Whether to use support data (e.g. input control actuator) as input
- input_control_act: !!bool True
n_steps: 3 #16 # Length of history to include in input
enforce_max_steps: !!bool False # If false and n_steps > dataset steps, use dataset steps. Otherwise, raise Exception.
accum_grad: 1
# Model settings
model_type: 'vit_all2all' # no need for time_type and space_type inputs
#model_type: 'svit' #currently only support time_type=="all2all_time" and space_type=="all2all"
#time_type: 'all2all_time' #
#space_type: 'all2all' #
#model_type: 'avit' #currently only support space_type=="axial_attention" and time_type=="attention"
#time_type: 'attention' #
#space_type: 'axial_attention' #
tie_fields: !!bool False # Whether to use 1 embedding per field per data
embed_dim: 192 # Dimension of internal representation - 192/384/768/1024 for Ti/S/B/L
num_heads: 3 # Number of heads for attention - 3/6/12/16 for Ti/S/B/L
processor_blocks: 12 # Number of transformer blocks in the backbone - 12/12/12/24 for Ti/S/B/L
##patch_size: [[1, 2, 2]] #[[1, 40, 40]] #, [32, 32], [64, 64]] #
tokenizer_heads:
- head_name: "tk-2D"
patch_size: [[1, 2, 2]]
sts_model: !!bool False
sts_train: !!bool False #when True, we use loss function with two parts: l_coarse/base + l_total, so that the coarse ViT approximates true solutions directly
#gammaref: 0.2 #pick all tokens that with variances larger than gammaref*max_variance to refine
#refine_ratio: 0.2 #ratio of coarse tokens picked to be refined
bias_type: 'PositionAreaBias' # Options rel, continuous, none, PositionAreaBias
bias_MLP: !!bool True
# Data settings
#train_val_test: [.6, .2, .2]
augmentation: !!bool False # Augmentation not implemented
use_all_fields: !!bool True # Prepopulate the field metadata dictionary from dictionary in datasets
tie_batches: !!bool False # Force everything in batch to come from one dset
extended_names: !!bool False # Whether to use extended names - not currently implemented
embedding_offset: 0 # Use when adding extra finetuning fields
train_data_paths: [
['examples/matey/data/fusionMT-data/solps/train', 'SOLPS2D', '','tk-2D'],
]
valid_data_paths: [
['examples/matey/data/fusionMT-data/solps/valid', 'SOLPS2D', '','tk-2D'],
]
append_datasets: [] # List of datasets to append to the input/output projections for finetuning


Loading
Loading