Skip to main content

mmlearn

code checks integration tests license

mmlearn aims at enabling the evaluation of existing multimodal representation learning methods, as well as facilitating experimentation and research for new techniques.

Quick Start

Installation

Prerequisites

The library requires Python 3.10 or later. We recommend using a virtual environment to manage dependencies. You can create a virtual environment using the following command:

python3 -m venv /path/to/new/virtual/environment
source /path/to/new/virtual/environment/bin/activate

Installing binaries

To install the pre-built binaries, run:

python3 -m pip install mmlearn
Installation Options You can install optional dependencies to enable additional features. Use one or more of the pip extras listed below to install the desired dependencies.
pip extra Dependencies Notes
vision "torchvision", "opencv-python", "timm" Enables image processing and vision tasks.
audio "torchaudio" Enables audio processing and tasks.
peft "peft" Uses the PEFT library to enable parameter-efficient fine-tuning.

For example, to install the library with the vision and audio extras, run:

python3 -m pip install mmlearn[vision,audio]

Building from source

To install the library from source, run:

git clone https://github.com/VectorInstitute/mmlearn.git
cd mmlearn
python3 -m pip install -e .

Running Experiments

We use Hydra and hydra-zen to manage configurations in the library.

For new experiments, it is recommended to create a new directory to store the configuration files. The directory should have an __init__.py file to make it a Python package and an experiment folder to store the experiment configuration files. This format allows the use of .yaml configuration files as well as Python modules (using structured configs or hydra-zen) to define the experiment configurations.

To run an experiment, use the following command:

mmlearn_run 'hydra.searchpath=[pkg://path.to.config.directory]' +experiment=<name_of_experiment_yaml_file> experiment=your_experiment_name

Hydra will compose the experiment configuration from all the configurations in the specified directory as well as all the configurations in the mmlearn package. Note the dot-separated path to the directory containing the experiment configuration files. One can add a path to hydra.searchpath either as a package (pkg://path.to.config.directory) or as a file system (file://path/to/config/directory). However, new configs in mmlearn are added to hydra's external store inside path/to/config/directory/__init__.py which is only interpreted when the config directory is added as a package. Hence, please refrain from using the file:// notation.

Hydra also allows for overriding configuration parameters from the command line. To see the available options and other information, run:

mmlearn_run 'hydra.searchpath=[pkg://path.to.config.directory]' +experiment=<name_of_experiment_yaml_file> --help

By default, the mmlearn_run command will run the experiment locally. To run the experiment on a SLURM cluster, we use the submitit launcher plugin built into Hydra. The following is an example of how to run an experiment on a SLURM cluster:

mmlearn_run --multirun \
    hydra.launcher.mem_per_cpu=5G \
    hydra.launcher.qos=your_qos \
    hydra.launcher.partition=your_partition \
    hydra.launcher.gres=gpu:4 \
    hydra.launcher.cpus_per_task=8 \
    hydra.launcher.tasks_per_node=4 \
    hydra.launcher.nodes=1 \
    hydra.launcher.stderr_to_stdout=true \
    hydra.launcher.timeout_min=720 \
    'hydra.searchpath=[pkg://path.to.my_project.configs]' \
    +experiment=my_experiment \
    experiment_name=my_experiment_name

This will submit a job to the SLURM cluster with the specified resources.

Note: After the job is submitted, it is okay to cancel the program with Ctrl+C. The job will continue running on the cluster. You can also add & at the end of the command to run it in the background.

Summary of Implemented Methods

Pretraining Methods Notes

Contrastive Pretraining

Uses the contrastive loss to align the representations from N modalities. Supports sharing of encoders, projection heads or postprocessing modules (e.g. logit/temperature scaling) across modalities. Also supports multi-task learning with auxiliary unimodal tasks applied to specific modalities.

I-JEPA

The Image-based Joint-Embedding Predictive Architecture (I-JEPA) is a unimodal non-generative self-supervised learning method that predicts the representations of several target blocks of an image given a context block from the same image. This task can be combined with the contrastive pretraining task to learn multimodal representations from paired and unpaired data.
Evaluation Methods Notes

Zero-shot Cross-modal Retrieval

Evaluates the quality of the learned representations in retrieving the k most similar examples from a different modality, using recall@k metric. This is applicable to any number of pairs of modalities at once, depending on memory constraints.

Zero-shot Classification

Evaluates the ability of a pre-trained encoder-based multimodal model to predict classes that were not explicitly seen during training. The new classes are given as text prompts, and the query modality can be any of the supported modalities. Binary and multi-class classification tasks are supported.

Contributing

If you are interested in contributing to the library, please see CONTRIBUTING.MD. This file contains many details around contributing to the code base, including are development practices, code checks, tests, and more.

Metadata

Release files for mmlearn 0.1.0

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

Source distribution (sdist)

Source distribution for mmlearn 0.1.0
File Size Uploaded Provenance Actions
mmlearn-0.1.0.tar.gz 290.2 kB With provenance Details for mmlearn-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 402.2 kB

Release files / mmlearn-0.1.0.tar.gz

Download URL mmlearn-0.1.0.tar.gz
Size 290.2 kB
Tags Source
SHA-256 checksum
How to use checksums
85a75aa6072745e84d26ea2490ab2376bbc992aa260177cf2b752c662b71ee35
BLAKE2b-256 checksum
How to use checksums
eab39b187c1650125b675bf16ed1549e361bca309b2995c1d6211f9102940807
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Release files / mmlearn-0.1.0-py3-none-any.whl

Download URL mmlearn-0.1.0-py3-none-any.whl
Size 111.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4385465ad1f58afd1ec6be877558f13fd5dc20f92e88fead4a18c501b07bbd1
BLAKE2b-256 checksum
How to use checksums
257387605cd3a63ae0df0fd99ee2da381c1d135b30d7da04988af5a634cf8092
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Oct 22, 2026.

Transparency log

Security for mmlearn 0.1.0

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mmlearn-0.1.0.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 Oct 22, 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