Skip to content

feat: expose training presets to enable high level API#128

Merged
Ndles merged 11 commits into
mainfrom
feat/simplify-training-interface
Mar 31, 2026
Merged

feat: expose training presets to enable high level API#128
Ndles merged 11 commits into
mainfrom
feat/simplify-training-interface

Conversation

@Ndles
Copy link
Copy Markdown
Member

@Ndles Ndles commented Mar 24, 2026

  • Add DomainPreset base class (src/noether/core/presets/) that encapsulates dataset-specific configuration (stats, normalizers, pipeline defaults, forward properties) so training scripts only specify experiment-level knobs (model kind, hidden_dim, epochs)
  • Add AeroCFDPreset intermediate class and 5 concrete domain presets (AhmedML, DrivAerML, DrivAerNet (will add in the next commits), EmmiWing (will add in the next commits), ShapeNetCar) in examples/presets/
  • Add factory-compatible model wrappers for all 4 architectures: ABUPTWrapper, UPTWrapper, TransformerWrapper, TransolverWrapper in src/noether/modeling/models/wrappers/
  • Add model_defaults.py registry that derives sub-configs (transformer_block_config, supernode_pooling_config, decoder_config) from user-facing knobs like hidden_dim and num_heads
  • Add per-dataset training scripts (examples/train_*.py) with one function per model, exposing device, accelerator, dataset_root, output_path as keyword args
  • Add WeightedMSETrainer to noether.training.trainers exports

@Ndles Ndles self-assigned this Mar 24, 2026
Copy link
Copy Markdown
Collaborator

@MauritsBleeker MauritsBleeker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the new setup; it is reducing boilerplate a lot.

The only concern is that we could end up with two sources of truth: one where we provide the defaults via experiment YAMLS/configs, and one where we hardcode it in those presets. Ideally, we have one (or one that relies on the other).

Moreover, for every new model/recipe/etc, what we will add in the future, do we have to provide those presets as well?

Finally, the defaults have quite some overlap with the templates that will be provided with noether-init, how do we solve the problem that we copy around too much stuff?

Comment thread examples/presets/ahmedml.py Outdated
Comment thread examples/presets/drivaerml.py Outdated
Copy link
Copy Markdown
Collaborator

@HennerM HennerM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Providing sensible defaults is super useful. The presets are useful as well but I worry that there is a lot of overlap with the tutorial and potentially recipes. I think if we could get it down to one or two preset that cover all all the aerodynamics datasets this would be a bit more managable.

Comment thread src/noether/training/trainers/weighted_mse.py Outdated
Comment thread src/noether/training/trainers/weighted_mse.py Outdated
Comment thread src/noether/modeling/models/wrappers/__init__.py Outdated
Comment thread src/noether/core/presets/base.py
Comment thread src/noether/core/presets/base.py
Comment thread src/noether/core/presets/base.py Outdated
self,
*,
model_kind: str,
model_params: dict[str, Any] | None = None,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be nice to have the actual type here, to keep the benefit of the Python types

Comment thread src/noether/core/presets/base.py Outdated
Comment thread examples/aero_cfd/presets/__init__.py
Comment thread src/noether/core/presets/base.py
@Ndles Ndles force-pushed the feat/simplify-training-interface branch from d6a6584 to 1dd4e1d Compare March 26, 2026 12:13
@Ndles Ndles marked this pull request as ready for review March 26, 2026 13:19
@Ndles Ndles requested a review from kinggongzilla as a code owner March 26, 2026 13:19
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 26, 2026

Coverage

Tests Skipped Failures Errors Time
1204 21 💤 0 ❌ 0 🔥 26.908s ⏱️

@Ndles Ndles force-pushed the feat/simplify-training-interface branch from 76857df to 9a7b38f Compare March 30, 2026 06:08
Comment on lines +14 to +19
LOSS_REGISTRY: dict[str, Callable[..., torch.Tensor]] = {
"mse": F.mse_loss,
"l1": F.l1_loss,
"smooth_l1": F.smooth_l1_loss,
"huber": F.huber_loss,
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we can avoid needing a registry if we just let the user specify the class path for one of the torch.nn.modules.loss classes, such as torch.nn.modules.loss.L1Loss.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I wasn't a huge fan of that long string as an argument. Forces people to learn exact import names. But we can address it in the followup as well. I am not biased on that.

from noether.core.presets import DomainPreset
from noether.core.schemas.dataset import DatasetBaseConfig, DatasetWrappers

AERO_PIPELINE = "tutorial.pipeline.AeroMultistagePipeline"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we move the aero pipeline also into Noether or do you think it's okay to keep in the tutorial?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's an open discussion point for the followup. I think it makes sense to make it part of the shared recipes, but maybe making it available in the noether itself is not a bad idea.

@Ndles Ndles merged commit f13fd29 into main Mar 31, 2026
9 checks passed
@Ndles Ndles deleted the feat/simplify-training-interface branch March 31, 2026 06:11
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 31, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants