You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

daydream 0.1.0 (4.26M, fp32)

daydream predicting the cortical drive of a film scene, next to its video and audio

Film: Tears of Steel, (CC) Blender Foundation | mango.blender.org, CC BY 3.0.

daydream is a streaming audiovisual fMRI encoder. From continuous video and audio, it predicts the cortical BOLD response on the fsaverage5 surface (20,484 vertices). It works one 0.5 s tick at a time and uses only past input, so it can run live. On an iPhone 16 Pro it runs in real time: a camera and microphone go in, and the predicted response is drawn on a 3D brain.

This file holds the trained encoder: daydream-0.1.0-4.26M-fp32.safetensors. These are population weights, with a shared readout and one affine per study, and no per-subject weights. The frozen DINOv3 and w2v-BERT 2.0 frontends that produce part of its input are not included (see Inputs).

  • Code: github.com/t3tra-dev/daydream: the daydream Python package (training, export) and the DaydreamRuntime Swift package (Core ML runtime, macOS and iOS demos). The version in the file name is the package version that wrote the file.
  • Parameters: 4,262,206 learned parameters, all fp32. The file also holds 1,767 buffer values (feature statistics).
  • Checksum: daydream-0.1.0-4.26M-fp32.safetensors.sha256.

Model

Part Configuration
Input 589 features per 0.5 s tick (layout v4a_speech16_visual4), standardized with fixed training statistics and gated per block
Fusion linear projection of the tick's features, plus a small sensory-skip projection per block
Temporal core causal Transformer: 4 layers, hidden 256, 4 heads, FFN 1024, pre-LayerNorm, rotary position on relative time, 64 s of history; no long memory
Observation head the 480-wide latent history convolved with a hemodynamic kernel: the SPM canonical HRF, its temporal derivative and its dispersion derivative, over 32 s, mixed with three learned weights
Readout shared low-rank (rank 32) readout to 20,484 fsaverage5 vertices, gated per vertex and latent block, then a per-study affine (cneuromod, hcp7t) or none (population)

The model is causal: the prediction for time t depends only on video and audio up to t.

Outputs

The observation head gives two outputs from the same latent:

  • BOLD: the predicted BOLD signal at any target time. It peaks 4.0 s after the input that drives it, the peak of the learned kernel (2.0 s onset, 2.5–6.0 s at half maximum, measured by swapping 1 s of input).
  • Cortical drive: the readout before the hemodynamic response, in BOLD units. It responds in the tick whose input changed. This is the model's estimate at 0.5 s resolution, not neural firing.

docs/time-axes.md in the code repository describes how inputs, targets and both outputs sit on the stimulus clock during training, inference and display.

Inputs

The 589 features of a tick come from the following inputs.

Block Width Source
acoustic 40 log-Mel bands averaged over the tick
age 2 age of the latest visual and speech features (s)
modulation 24 amplitude modulation of the log-Mel bands
vadtiming 5 speech timing from Silero VAD 6.2.3
motion 54 motion energy of the gray image
speech16 192 w2v-BERT 2.0 (facebook/w2v-bert-2.0, revision da985ba): 3 layers × 4 bins of the last second of an 8 s window × 16 projected channels, at 1 Hz
visual4 272 DINOv3 ViT-L/16 (facebook/dinov3-vitl16-pretrain-lvd1689m, revision ea8dc28): 4 layers × (global token + 4 × 4 grid) × 4 projected channels, at 2 Hz
  • Projections: the projections of the frontend features are fixed random matrices, derived from a seed in the code; they are not learned.
  • Frontend weights: they must be the pinned revisions. daydream data models downloads them; DINOv3 requires accepting the DINOv3 License on the Hugging Face Hub first.

Use

Install the code (Python 3.11, uv):

git clone https://github.com/t3tra-dev/daydream
cd daydream
uv sync --extra export   # add --extra frontend to export the DINOv3 / w2v-BERT frontends

Download the weights, then rebuild the encoder from the file with the Python package:

uv run hf download t3tra-hg/daydream daydream-0.1.0-4.26M-fp32.safetensors --local-dir .
import torch
from daydream.models.build import load_encoder
from daydream.models.checkpoint import load_checkpoint

checkpoint = load_checkpoint("daydream-0.1.0-4.26M-fp32.safetensors")
encoder, _ = load_encoder(checkpoint, with_subjects=False)

# x: [1, T, 589] tick features, times: [1, T] tick times (0.5 s apart), targets: [1, N] times to predict
state = encoder.advance(x, times, encoder.initial_state(1, torch.device("cpu")))
bold = encoder.predict(state, targets, study_ids=torch.tensor([encoder.study_index("hcp7t")]))  # [1, N, 20484]

To run on Apple devices, export the Core ML packages and use the Swift runtime (macOS/, iOS/DaydreamLab). daydream-run predicts from a video file, daydream-demo runs live on macOS, and the DaydreamLab app runs on iPhone:

daydream export coreml daydream-0.1.0-4.26M-fp32.safetensors --out models/ --frontends --surfaces

Measured speed on Apple devices:

Device Setting Result
Apple silicon Mac offline, 15 min video 6.1× real time
iPhone 16 Pro live camera and microphone 172 ms compute latency per 0.5 s prediction; 1 of 160 predictions over budget

On the iPhone, the visual encoder runs in FP16 on the GPU and the speech encoder in four parts on the Neural Engine.

Training data

Study Data Subjects Runs
hcp7t Human Connectome Project 7T movie-watching fMRI (movies 1–4) 182 717
cneuromod Courtois NeuroMod Friends, openly shared subjects (sub-01, 02, 03, 05, 06) 5 1,330 (266 episode segments)
  • Targets: the BOLD runs are resampled to fsaverage5 and predicted at each volume's acquisition time (slice time reference applied), with no fixed shift.
  • Stimuli: the films and the Friends episodes are not part of this release.

Training procedure

  • Split: population, with every stimulus and subject of both studies in training and no validation or test data.
  • Loss and optimizer: masked BOLD MSE weighted per study (cneuromod 1.0, hcp7t 0.5); AdamW (learning rate 3e-4, weight decay 0.01, betas 0.9 / 0.95).
  • Chunking: whole runs are streamed in 48 s chunks (truncated backpropagation through time) after a 32 s burn-in.
  • Provenance: these weights come from an earlier training script, repackaged into this format without retraining; per-subject residual weights were removed at release. The resolved training config is stored in the file's metadata.

Evaluation

These weights were trained on all available data, so no held-out evaluation of this file exists. The repository checks that its Swift and Core ML runtime reproduces the PyTorch predictions of these weights on HCP movie 4:

  • latents correlate at 0.998;
  • BOLD with the iPhone configuration correlates at 0.997 (median over vertices).

These checks measure fidelity to the model, not accuracy against measured brain data.

Limitations

  • Population average: the model predicts a population-average response. With the hcp7t or cneuromod affine it predicts that study's average; it has no weights for a new individual.
  • Training material: it was trained on films and an English-language TV series watched in a scanner (7T for HCP, 3T for CNeuroMod). Other material, languages, viewing conditions or scanners can be predicted less accurately.
  • Time resolution: predictions are at 0.5 s resolution, smoothed by the hemodynamic response. The cortical drive is a model quantity, not a measurement of neural activity.
  • Not for clinical use: it is not a diagnostic or clinical tool. It predicts responses from stimuli and does not read thoughts or decode brain activity.

License and data terms

  • These weights: Apache License 2.0.
  • Frontends: DINOv3, and any file derived from it such as its Core ML export, is subject to the DINOv3 License. w2v-BERT 2.0 is under the MIT License.
  • HCP data: used under the WU-Minn HCP Consortium Open Access Data Use Terms. Data were provided [in part] by the Human Connectome Project, WU-Minn Consortium (Principal Investigators: David Van Essen and Kamil Ugurbil; 1U54MH091657) funded by the 16 NIH Institutes and Centers that support the NIH Blueprint for Neuroscience Research; and by the McDonnell Center for Systems Neuroscience at Washington University.
  • CNeuroMod data: the openly shared CNeuroMod subjects are distributed under CC0. The Courtois project on neural modelling was made possible by a generous donation from the Courtois foundation, administered by the Fondation Institut Gériatrie Montréal at CIUSSS du Centre-Sud-de-l'île-de-Montréal and University of Montreal. The Courtois NeuroMod team is based at Centre de Recherche de l'Institut Universitaire de Gériatrie de Montréal, with several other institutions involved (https://docs.cneuromod.ca).
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support