Skip to main content
LinMulT

General-purpose Multimodal Transformer with Linear-Complexity Attention

GitHub Release PyPI CI codecov Docs
Python PyTorch Code style: ruff License


LinMulT is a modular Transformer library designed for multimodal sequence modelling. It handles variable-length inputs across any number of modalities, supports missing-modality scenarios, and offers six attention variants ranging from O(N²) softmax to O(N·s) gated linear attention; all behind a single config file.

Features

Multiple modalities 1–N input sequences with independent lengths and feature dims
Standard attention softmax — quadratic complexity for baselines and ablations
Efficient attention linear, performer, flash, bigbird — sub-quadratic complexity
TCN smoothing optional per-modality temporal convolution before cross-modal attention
Flexible heads sequence, aggregated, upsample, downsample — mix freely
Missing modalities zero-mask a modality; model handles it gracefully
Config-driven dict or YAML; no subclassing required

Installation

pip install linmult

For development:

git clone https://github.com/fodorad/linmult
cd linmult
uv sync --extra dev --extra docs
make check

Quick start

LinT — single-modality transformer

import torch
from linmult import LinT

x = torch.rand(8, 1500, 25)  # (batch, time, features)

model = LinT({
    'input_feature_dim': 25,
    'heads': [{'name': 'out', 'type': 'simple', 'output_dim': 5}],
    'time_dim_reducer': 'attentionpool',  # aggregate over time
})
result = model(x)
assert result['out'].shape == (8, 5)

LinMulT — multimodal transformer

import torch
from linmult import LinMulT

x1 = torch.rand(8, 1500, 25)  # (batch, time, features)
x2 = torch.rand(8,  450, 35)
x3 = torch.rand(8,  450, 256)

model = LinMulT({
    'input_feature_dim': [25, 35, 256],
    'heads': [{'name': 'sentiment', 'type': 'simple', 'output_dim': 3}],
    'time_dim_reducer': 'gap',
})
result = model([x1, x2, x3])
assert result['sentiment'].shape == (8, 3)

Switching attention type

model = LinT({
    'input_feature_dim': 64,
    'heads': [{'name': 'out', 'type': 'simple', 'output_dim': 10}],
    'attention_type': 'flash',        # linear, performer, flash, bigbird, softmax, mha
    'flash_query_key_dim': 32,        # flash (GAU) scoring dimension
})

Documentation

API reference

Config reference

Quick-start notebook

Attention benchmark

UR-Funny training example


Similar projects using LinMulT

BlinkLinMulT (2023)

LinMulT trained for blink presence detection and eye state recognition across 7 public benchmark databases.

PersonalityLinMulT (2022)

LinMulT trained for Big Five personality trait estimation and sentiment analysis (MOSI, MOSEI, First Impressions V2).


Citation

If you found this work helpful, please cite the relevant paper:

Eye blink detection (2023)

@article{blinklinmult-fodor23,
  title   = {BlinkLinMulT: Transformer-based Eye Blink Detection},
  author  = {Fodor, {\'A}d{\'a}m and Fenech, Kristian and L{\H{o}}rincz, Andr{\'a}s},
  journal = {Journal of Imaging},
  pages   = {1--19},
  year    = {2023}
}

Personality and sentiment estimation (2022)

@InProceedings{pmlr-v173-fodor22a,
  title     = {Multimodal Sentiment and Personality Perception Under Speech:
               A Comparison of Transformer-based Architectures},
  author    = {Fodor, {\'A}d{\'a}m and Saboundji, Rachid R. and
               Jacques Junior, Julio C. S. and Escalera, Sergio and
               Gallardo-Pujol, David and L{\H{o}}rincz, Andr{\'a}s},
  booktitle = {Understanding Social Behavior in Dyadic and Small Group Interactions},
  pages     = {218--241},
  year      = {2022},
  volume    = {173},
  series    = {Proceedings of Machine Learning Research},
  publisher = {PMLR},
  url       = {https://proceedings.mlr.press/v173/fodor22a.html}
}

Contact

Ádám Fodor — adamfodor.com · fodorad201@gmail.com

Metadata

Release files for linmult 2.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for linmult 2.1.2
File Size Uploaded Provenance Actions
linmult-2.1.2.tar.gz 181.5 kB With provenance Details for linmult-2.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for linmult 2.1.2
File Interpreter ABI Platform Actions
linmult-2.1.2-py3-none-any.whl Python 3 none any Details for linmult-2.1.2-py3-none-any.whl

Total release size: 225.9 kB

Release files / linmult-2.1.2.tar.gz

Download URL linmult-2.1.2.tar.gz
Size 181.5 kB
Tags Source
SHA-256 checksum
How to use checksums
2de1b9a2c2cc79d5ea5defac3c387a13d271cd89d856373d154461811b610994
BLAKE2b-256 checksum
How to use checksums
44a6a43747b22b94e8297fe6a3f9bd49f95b0ad526a540691e8f3e5d548584dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.

Transparency log

Release files / linmult-2.1.2-py3-none-any.whl

Download URL linmult-2.1.2-py3-none-any.whl
Size 44.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3dd67892ee3958bf79d826a87dd85675a58e9e2013c9e0477cd6282d145810bc
BLAKE2b-256 checksum
How to use checksums
c79b95cbe392e1f71e38e9c6d10c89c8b0aead9ae6b62017d38b36345efdb4a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.

Transparency log

Security for linmult 2.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for linmult-2.1.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page