neuraltrain.models.luna.NtLuna

pydantic model neuraltrain.models.luna.NtLuna[source][source]

Config for the braindecode LUNA model.

Extends BaseBrainDecodeModel with LUNA-specific logic:

  1. Keyword mapping — wraps the model so its forward accepts channel_positions and maps it to LUNA’s channel_locations.

  2. Time padding — zero-pads the time dimension to a multiple of patch_size.

  3. Encoder-only output — when n_outputs is not passed (i.e. when a DownstreamWrapperModel handles the classification head), the classification head is replaced with nn.Identity() so the model returns the encoder latent.

Parameters:

pretrained_filename (str or None) – When from_pretrained_name points to a Hub repository containing multiple weight files (e.g. PulpBio/LUNA), this selects which file to download. Requires braindecode >= 1.5 which natively supports the filename kwarg in from_pretrained.

Fields:
field pretrained_filename: str | None = None[source]
build(n_spatial_locations: int, n_temporal_samples: int, n_outputs: int | None = None, chs_info: list[dict[str, Any]] | None = None, frequency: float | None = None) Module[source][source]

Build the braindecode model from context-named shape parameters.

Parameters are named/typed like BrainModelBuildContext fields/properties, so the base build_from_context injects them (chs_info / frequency from the matching context properties/fields). Covers every auto-registered braindecode model (EEGNet, Deep4Net, ShallowFBCSPNet, BIOT, …); custom configs (LaBraM, REVE, LUNA, BENDR) override this and reuse _bd_shape_kwargs() for the name mapping.