Skip to main content

Multi-Modality

LiMoE

Implementation of the "the first large-scale multimodal mixture of experts models." from the paper: "Multimodal Contrastive Learning with LIMoE: the Language-Image Mixture of Experts". CLICK HERE FOR THE PAPER LINK:

install

pip install limoe

usage

import torch

from limoe.main import LiMoE

# Text tokens (batch, sequence length)
text = torch.randint(0, 100, (1, 64))

# image (batch, channels, height, width)
image = torch.randn(1, 3, 224, 224)

# Create an instance of LiMoE with the specified parameters
model = LiMoE(
    dim=64,  # Dimension of the input and output tensors
    depth=3,  # Number of layers in the encoder
    heads=8,  # Number of attention heads
    num_tokens=100,  # Number of tokens in the vocabulary
    seq_length=64,  # Length of the input sequence
    num_experts=4,  # Number of experts in the mixture-of-experts layer
    dim_head=64,  # Dimension of each attention head
    dropout=0.1,  # Dropout rate
    ff_mult=4,  # Multiplier for the dimension of the feed-forward layer
    patch_size=16,  # Patch size
    image_size=224,  # Image size
    channels=3,  # Number of image channels
    dense_encoder_depth=5,
)

# Pass the input tensor through the model and print the output
out = model(text, image)

# Print
print(out)

License

MIT

Citation

@misc{mustafa2022multimodal,
    title={Multimodal Contrastive Learning with LIMoE: the Language-Image Mixture of Experts}, 
    author={Basil Mustafa and Carlos Riquelme and Joan Puigcerver and Rodolphe Jenatton and Neil Houlsby},
    year={2022},
    eprint={2206.02770},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

Metadata

Release files for limoe 0.0.5

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

Source distribution (sdist)

Source distribution for limoe 0.0.5
File Size Uploaded
limoe-0.0.5.tar.gz 5.6 kB Details

Built distribution (wheel)

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

Total release size: 11.0 kB

Release files / limoe-0.0.5.tar.gz

Download URL limoe-0.0.5.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
50b55f08c5e5ac0c8acc25cc8fffec1cedc482ba655a5248c92aa4bb88835628
BLAKE2b-256 checksum
How to use checksums
bcb547680b9cbcd915aa5ad3ce8c13f583f39233fb9a1d60f622a72b6cbc73f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.0 Darwin/23.3.0

Release files / limoe-0.0.5-py3-none-any.whl

Download URL limoe-0.0.5-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01398132bdd480ba3488c6f949f514f0758f6ac78045a631fae073ca8f7a2266
BLAKE2b-256 checksum
How to use checksums
e33782484dd4c4ef032ddc980b1ac46aad0e41db6df76a97021748029019d372
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.0 Darwin/23.3.0

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.2

2 release files

0.0.1

2 release files

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