Transfusion in Pytorch
Project description
Transfusion - Pytorch (wip)
Pytorch implementation of Transfusion, "Predict the Next Token and Diffuse Images with One Multi-Modal Model", from MetaAI.
Once completed, will also extend this to flow matching, as well as audio, video, perhaps even policies.
Install
$ pip install transfusion-pytorch
Usage
One modality, say images
from torch import randint, randn
from transfusion_pytorch import Transfusion
model = Transfusion(
num_text_tokens = 256,
dim_latent = 384,
transformer = dict(
dim = 512,
depth = 8
)
)
text_and_images = [
[randint(0, 256, (16,)), randn(4, 384), randint(0, 256, (8,)), randn(6, 384)],
[randint(0, 256, (16,)), randn(7, 384), randint(0, 256, (5,)), randn(2, 384), randint(0, 256, (9,))]
]
loss = model(text_and_images)
loss.backward()
Citations
@inproceedings{Zhou2024TransfusionPT,
title = {Transfusion: Predict the Next Token and Diffuse Images with One Multi-Modal Model},
author = {Chunting Zhou and Lili Yu and Arun Babu and Kushal Tirumala and Michihiro Yasunaga and Leonid Shamis and Jacob Kahn and Xuezhe Ma and Luke Zettlemoyer and Omer Levy},
year = {2024},
url = {https://api.semanticscholar.org/CorpusID:271909855}
}
@misc{Rubin2024,
author = {Ohad Rubin},
url = {https://medium.com/@ohadrubin/exploring-weight-decay-in-layer-normalization-challenges-and-a-reparameterization-solution-ad4d12c24950}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
transfusion_pytorch-0.0.15.tar.gz
(347.2 kB
view hashes)
Built Distribution
Close
Hashes for transfusion_pytorch-0.0.15.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47beff7758c04a82635d95127d4e78b3ebf3cfc09cf4b0f2bce63eefcc7a05fd |
|
MD5 | f23f11fdcd56445da2502bab5f3c0526 |
|
BLAKE2b-256 | d229c3d94aa163a99387af32e263d9fba8fd65cf5542bb6a0545033f8acbe20a |
Close
Hashes for transfusion_pytorch-0.0.15-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56cc4f0583f88534fee396b1ea7b1d995790973e28d8eaf89c27ad4ea10742af |
|
MD5 | 159d7fc2bc5bb02f43376b1e002abb1d |
|
BLAKE2b-256 | 5b452cc3feca2a45d42a98562bd967d8739d2a5e494baaf78391288e268deec2 |