MultiModalCrossAttn - Pytorch
Project description
MultiModalCrossAttn
The open source implementation of the cross attention mechanism from the paper: "JOINTLY TRAINING LARGE AUTOREGRESSIVE MULTIMODAL MODELS"
Appreciation
- Lucidrains
- Agorians
Install
pip install cross-attn
Usage
import torch
from cross_attn.main import MultiModalCrossAttention
# Test the MultiModalCrossAttention module
dim = 512 # For example
num_heads = 8
cross_attn = MultiModalCrossAttention(dim, num_heads)
Hllm_sample = torch.randn(32, dim, dim) # Batch size = 32, Sequence length = 10
Himg_sample = torch.randn(32, dim, dim)
output = cross_attn(Hllm_sample, Himg_sample)
print(output)
print(output.shape) # Expected: [32, 10, 512]
License
MIT
Citations
@misc{2309.15564,
Author = {Emanuele Aiello and Lili Yu and Yixin Nie and Armen Aghajanyan and Barlas Oguz},
Title = {Jointly Training Large Autoregressive Multimodal Models},
Year = {2023},
Eprint = {arXiv:2309.15564},
}
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
cross_attn-0.0.3.tar.gz
(8.8 kB
view hashes)
Built Distribution
cross_attn-0.0.3-py3-none-any.whl
(12.0 kB
view hashes)
Close
Hashes for cross_attn-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b1349ea7dc1063ce69148b7ee6c68654099083c7e12d11df2caae790b922361 |
|
MD5 | ccd15e3b0bf854352e0f5a2c2f6499aa |
|
BLAKE2b-256 | f3ede49d84bbfe30ba74371095e9ba817bdbfe42231645027f114f53af9d3049 |