Views
No views yet

1# Clone the repository
2git clone https://github.com/yourusername/EEGFoundation_github.git
3cd EEGFoundation_github
4
5# Install dependencies (Python 3.10+ required)
6pip install torch>=2.0.0 transformers>=4.30.0 numpy>=1.24.0 scipy>=1.10.0
7pip install mne>=1.4.0 einops>=0.6.0 matplotlib>=3.7.01from src.models.downstream_EEGFoundation import load_downstream_model
2import torch
3import numpy as np
4
5# Load pre-trained model for motor imagery classification
6model = load_downstream_model(
7 model_path="models/BCIC-2a_model.pth",
8 config_path="configs/BCIC_IV_2a_config.json"
9)
10
11# Prepare input data (example)
12batch_size = 2
13num_channels = 20
14seq_length = 2000
15
16eeg_signal = torch.randn(batch_size, num_channels, seq_length).float()
17embedding = torch.randn(batch_size, 512).float()
18
19# Forward pass
20with torch.no_grad():
21 outputs = model(input_ids=eeg_signal, embedding_data=embedding)
22 predictions = torch.softmax(outputs['logits'], dim=-1)
23
24print(f"Predictions shape: {predictions.shape}")1import numpy as np
2
3# Load example data
4demo_data = np.load("demo_data/eeg_data.npy")
5print(f"Demo data shape: {demo_data.shape}")
6
7# The demo_data directory contains:
8# - eeg_data.npy: Sample EEG recordings
9# - downstream_eeg_data.npz: Processed data for downstream tasks