Run this model with HF Jobs
Run Shubhronyu/LFPformer-large-MaskPred-35k on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/Shubhronyu/LFPformer-large-MaskPred-35k. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/Shubhronyu/LFPformer-large-MaskPred-35k on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use Shubhronyu/LFPformer-large-MaskPred-35k with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Shubhronyu/LFPformer-large-MaskPred-35k with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForPreTraining processor = AutoProcessor.from_pretrained("Shubhronyu/LFPformer-large-MaskPred-35k") model = AutoModelForPreTraining.from_pretrained("Shubhronyu/LFPformer-large-MaskPred-35k", device_map="auto") - Notebooks
- Google Colab
- Kaggle
LFPformer Large — MaskPred
Masked latent prediction without a spatial auxiliary objective.
This is the 35,000-step Large checkpoint from the NeurIPS 2026 LFPformer
matched decoder-capacity comparison. It has 24 Transformer layers, hidden width
1,024, 16 attention heads, and about 317.5 million backbone parameters including
the pretraining components. It was initialized from facebook/wav2vec2-large
and trained on IBL full-recording LFP windows. With effective global batch 512,
this checkpoint represents 17,920,000 window presentations, not that many
unique recordings. It is a fixed-budget comparison checkpoint, not the latest
training endpoint or a claim of universal best performance.
Extract LFP embeddings
Supply already preprocessed single-channel LFP windows of 3 seconds at 1,250 Hz
as windows.npz, with a finite signals array of shape (N, 3750). Preserve the
training signal units and dataset-specific preprocessing. The helper resamples
to 16 kHz without per-window normalization, then averages the final hidden
states to give 1,024-dimensional embeddings.
pip install -r requirements.txt
python extract_embeddings.py --model . --input windows.npz --output embeddings.npz --device cpu
Install matching PyTorch and torchaudio builds for your CPU/CUDA environment.
Use --device cuda for GPU extraction. The weights load through standard
Wav2Vec2ForPreTraining.from_pretrained(...); no custom remote code is required.
This is an LFP representation model, not an automatic speech recognizer.
Do not apply the default audio processor's waveform normalization to LFP.
Run inference (run_inference.py)
run_inference.py gives the same embeddings as extract_embeddings.py and also
accepts continuous recordings: a (C, T) array (one row per channel) is cut into
3-s windows. It returns embeddings only; this repository has no trained
localization or region decoder.
python run_inference.py --input lfp.npz --output embeddings.npz # signals (N,3750) or (C,T) at 1250 Hz
python run_inference.py --input lfp.npy --output embeddings.npz --sampling-rate 2500 --device cuda
Output .npz: emb [M, 1024], row_index [M] (input row of each window),
window_start [M] (samples at 1,250 Hz). From Python:
from run_inference import LFPformerEncoder; LFPformerEncoder().embed(signals).
Quantized, multi-core and multi-GPU inference (lfpformer_inference.py)
lfpformer_inference.py gives the same embeddings as run_inference.py, plus lower-precision and
quantized encoders, every CPU core or several GPUs, and a speed benchmark. Run it from this folder and it
uses these weights; --model accepts any LFPformer repository ID.
pip install -r requirements.txt # plus torchao and/or bitsandbytes for int8/int4
python lfpformer_inference.py --input lfp.npz --output embeddings.npz # auto: CUDA > Apple MPS > all CPU cores
python lfpformer_inference.py --input lfp.npz --output embeddings.npz --precision fp16 --gpus all
python lfpformer_inference.py --input lfp.npz --output embeddings.npz --device cpu --threads 16
python lfpformer_inference.py --benchmark 384 --precision fp16 # time this machine
--precision |
Devices | Change in final localization vs fp32* |
|---|---|---|
fp32 (default) |
CPU, CUDA, Apple MPS | reference |
fp16 |
CUDA, Apple MPS | 1.6 µm |
int8 (torchao weights, fp32 compute) |
CUDA | 1.2 µm |
bf16 |
CPU, CUDA | 14 µm |
int8-bnb, int8-ao-dynamic |
CUDA; CPU for int8-ao-dynamic |
12–16 µm |
nf4, fp4 (bitsandbytes) |
CUDA | 26–29 µm |
int4 (torchao, group 128) |
CPU, CUDA | 24–26 µm |
int8-dynamic (PyTorch) |
CPU | 110–130 µm |
*Measured with the ManipDistc encoder and a fitted Transformer localization decoder (not included here)
on one full 10-min, 384-channel IBL test probe, 8 decoder seeds. Use fp16 on NVIDIA or Apple GPUs and
fp32 on CPUs. --threads sets the CPU cores (default: all), --cpu-workers splits them across
processes, --gpus all|N|0,2 runs one encoder copy per GPU. Window inputs keep their other per-row
arrays (for example probe_ids, channel_ids). Details: LFPformer Hugging Face guide.
Files and compatibility
model.safetensors,config.json: full standard wav2vec2 pretraining model.auxiliary.safetensors: the original wrapper's auxiliary head and buffers, retained losslessly. The auxiliary XYZ head hadxyz_lambda=0and is not a trained localization decoder.training_config.yaml: embedded source settings with machine paths removed.lfp_preprocessing.json,provenance.json,SHA256SUMS: preprocessing, checkpoint identity, validation and file integrity.run_inference.py: embeddings from windows or continuous LFP (see above).lfpformer_inference.py: the same, plus fp16/bf16/int8/int4, all CPU cores, multi-GPU, benchmark.restore_lfpformer_checkpoint.py: reconstructs the exact original wrapper tensor dictionary in a local.ptfile if required by research code.
The existing LFPformer benchmark embedding loader hardcodes 256-dimensional codebook projections; these Large checkpoints use 768. Use the supplied native Transformers helper, or the compatible LFPformer pretraining backbone with the supplied configuration and strict loading.
These files contain no fitted downstream localization/classification decoder, decoder whitening, optimizer, scheduler, or training data. Localization requires a compatible trained readout and its training normalization. Paper results depend on the decoder, cohort, aggregation and postprocessing; encoder weights alone do not reproduce a complete-system metric.
Training and evaluation scope
The spatial auxiliary objectives are implemented in the LFPformer research code,
not standard Transformers' pretraining loss. The embedded max_global_step may
retain an earlier gate limit, and its batch size may be per-rank; consult
provenance.json for the checkpoint's actual step and effective batch. This
snapshot is not a complete optimizer-resume package.
Downstream anatomical labels are used when training supervised localization readouts; they are not needed to extract embeddings. IBL refinement uses inverse-variance channel pooling followed by unweighted Kabsch fitting of known electrode geometry to predictions. Allen PCA-line projection is a separate evaluation protocol.
Validation and source
All 417 original state tensors are preserved exactly. Strict loading and a
finite (1, 1024) embedding smoke check passed; native and original embeddings
were exactly equal on the synthetic test input. This checks export mechanics,
not scientific performance. See provenance.json for versions and source SHA-256.
Research code: https://github.com/neuroinfolab/LFPformer (access may be restricted).
Code provenance is pinned to commit 139b8d90054aa99608d77ba89832050b6eb3cf3b.
The upstream initialization retains its applicable terms. A separate license
for these fine-tuned weights has not been specified in this package.
- Downloads last month
- 57
Model tree for Shubhronyu/LFPformer-large-MaskPred-35k
Base model
facebook/wav2vec2-large