LiMoE - Pytorch
Project description
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}
}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
limoe-0.0.5.tar.gz
(5.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
limoe-0.0.5-py3-none-any.whl
(5.4 kB
view details)
File details
Details for the file limoe-0.0.5.tar.gz.
File metadata
- Download URL: limoe-0.0.5.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.0 Darwin/23.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50b55f08c5e5ac0c8acc25cc8fffec1cedc482ba655a5248c92aa4bb88835628
|
|
| MD5 |
4fcd4cbe764b3c81b1e1b5a3b7efdc77
|
|
| BLAKE2b-256 |
bcb547680b9cbcd915aa5ad3ce8c13f583f39233fb9a1d60f622a72b6cbc73f6
|
File details
Details for the file limoe-0.0.5-py3-none-any.whl.
File metadata
- Download URL: limoe-0.0.5-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.0 Darwin/23.3.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01398132bdd480ba3488c6f949f514f0758f6ac78045a631fae073ca8f7a2266
|
|
| MD5 |
ac72a7cbfc934fb7d49818ef90380c2d
|
|
| BLAKE2b-256 |
e33782484dd4c4ef032ddc980b1ac46aad0e41db6df76a97021748029019d372
|