1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//! # tribev2-rs — TRIBE v2 multimodal fMRI brain encoding model inference in Rust
//!
//! Pure-Rust inference for TRIBE v2 (d'Ascoli et al., 2026), a deep multimodal
//! brain encoding model that predicts fMRI brain responses to naturalistic
//! stimuli (video, audio, text).
//!
//! The model combines feature extractors — **LLaMA 3.2** (text),
//! **V-JEPA2** (video), and **Wav2Vec-BERT** (audio) — into a unified
//! x-transformers Encoder that maps multimodal representations onto the
//! fsaverage5 cortical surface (~20 484 vertices).
//!
//! This crate provides:
//! - Full reimplementation of the `FmriEncoderModel` architecture
//! (projectors, combiner, x-transformers encoder with ScaleNorm + RoPE,
//! low-rank head, per-subject prediction layers, adaptive average pooling)
//! - Weight loading from the official PyTorch Lightning checkpoint
//! - Text feature extraction via `llama-cpp-4` (LLaMA 3.2-3B GGUF)
//! with intermediate layer activation extraction
//! - Segment-based batching for long-form inference
//! - Multi-modal inference (text + audio + video)
//! - Brain surface visualization (SVG rendering)
//! - HuggingFace Hub download support
//!
//! ## Quick start
//!
//! ```rust,ignore
//! use tribev2::model::tribe::TribeV2;
//! use tribev2::segments::{SegmentConfig, predict_segmented};
//! use tribev2::plotting::{self, PlotConfig, View, ColorMap};
//!
//! let model = TribeV2::from_pretrained("config.yaml", "model.safetensors", Some("build_args.json"))?;
//! let result = predict_segmented(&model, &features, &SegmentConfig::default());
//! let brain = tribev2::fsaverage::load_fsaverage("fsaverage5", "half", "sulcal", None)?;
//! let svg = plotting::render_brain_svg(&result.predictions[0], &brain, &PlotConfig::default());
//! ```
// Flat re-exports
pub use ;
pub use TribeV2;
pub use ;
pub use Tensor;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;