braindecode.models.SignalJEPA_PreLocal#
- class braindecode.models.SignalJEPA_PreLocal(n_outputs=None, n_chans=None, chs_info=None, n_times=None, input_window_seconds=None, sfreq=None, *, n_spat_filters=4, feature_encoder__conv_layers_spec=((8, 32, 8), (16, 2, 2), (32, 2, 2), (64, 2, 2), (64, 2, 2)), drop_prob=0.0, feature_encoder__mode='default', feature_encoder__conv_bias=False, activation=<class 'torch.nn.modules.activation.GELU'>, pos_encoder__spat_dim=30, pos_encoder__time_dim=34, pos_encoder__sfreq_features=1.0, pos_encoder__spat_kwargs=None, transformer__d_model=64, transformer__num_encoder_layers=8, transformer__num_decoder_layers=4, transformer__nhead=8, _init_feature_encoder=True)[source]#
Pre-local downstream architecture introduced in signal-JEPA Guetschel, P et al (2024) [1].
Convolution Channel Foundation Model
This architecture is one of the variants of
SignalJEPAthat can be used for classification purposes.
Added in version 0.9.
Important
Pre-trained Weights Available
This model has pre-trained weights available on the Hugging Face Hub. You can load them using:
from braindecode.models import SignalJEPA_PreLocal # Load pre-trained model from Hugging Face Hub model = SignalJEPA_PreLocal.from_pretrained( "braindecode/SignalJEPA-PreLocal-pretrained" )
To push your own trained model to the Hub:
# After training your model model.push_to_hub( repo_id="username/my-sjepa-model", commit_message="Upload trained SignalJEPA model", )
Requires installing
braindecode[hug]for Hub integration.- Parameters:
n_spat_filters (int) – Number of spatial filters.
References
[1]Guetschel, P., Moreau, T., & Tangermann, M. (2024). S-JEPA: towards seamless cross-dataset transfer through dynamic spatial attention. In 9th Graz Brain-Computer Interface Conference, https://www.doi.org/10.3217/978-3-99161-014-4-003
Methods
- forward(X)[source]#
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- classmethod from_pretrained(model=None, n_outputs=None, n_spat_filters=4, **kwargs)[source]#
Instantiate a new model from a pre-trained
SignalJEPAmodel or from Hub.- Parameters:
model (SignalJEPA, str, Path, or None) – Either a pre-trained
SignalJEPAmodel, a string/Path to a local directory (for Hub-style loading), or None (for Hub loading via kwargs).n_outputs (int or None) – Number of classes for the new model. Required when loading from a SignalJEPA model, optional when loading from Hub (will be read from config).
n_spat_filters (int) – Number of spatial filters.
**kwargs – Additional keyword arguments passed to the parent class for Hub loading.