Skip to main content

fuyu - Pytorch

Project description

Multi-Modality

Fuyu

FUYU

A implementation of Fuyu, the multimodal AI model from Adept in pytorch and zeta. The architecture is basically instead of using an encoder like VIT or CLIP they just patch the image then project it then feed it into the transformer decoder. The architecture is image patch embeddings -> linear projection -> decoder llm.

UPDATE

  • Fuyu-Heavy: proposes that scaling up the model architecture works but with some caveats. They need more stabilization during training. I have refactored the base Fuyu model implementation to include RMSNorm, LayerNorm, Swish, and a vast array of other techniques to radically increase multi-modal training such as normalizing the image during the shape rearrange and after.

  • DPO Confirmed HERE

Blog paper code

Appreciation

  • Lucidrains
  • Agorians
  • Adept

Install

pip install fuyu

Usage

import torch
from fuyu import Fuyu

# Initialize model
model = Fuyu(
    num_tokens=20342,
    max_seq_len=4092,
    dim=640,
    depth=8,
    dim_head=128,
    heads=6,
    use_abs_pos_emb=False,
    alibi_pos_bias=True,
    alibi_num_heads=3,
    rotary_xpos=True,
    attn_flash=True,
    attn_kv_heads=2,
    qk_norm=False,
    attn_qk_norm=False,
    attn_qk_norm_dim_scale=False,
    patches=16,
)

# Text shape: [batch, seq_len, dim]
text = torch.randint(0, 20342, (1, 4092))

# Img shape: [batch, channels, height, width]
img = torch.randn(1, 3, 256, 256)

# Apply model to text and img
y = model(text, img)

# Output shape: [batch, seq_len, dim]
print(y)

License

MIT

Citations

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

fuyu-0.0.7.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

fuyu-0.0.7-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file fuyu-0.0.7.tar.gz.

File metadata

  • Download URL: fuyu-0.0.7.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.0 Darwin/22.4.0

File hashes

Hashes for fuyu-0.0.7.tar.gz
Algorithm Hash digest
SHA256 8f0d88f177c3a5dd82ccd3d168c5b55281f43271a8cf28ad2421ca14d821a6c3
MD5 860aab976d31c3a697d3a6e73b866e04
BLAKE2b-256 38e471cee6a877f111d10debf974eaf7c685bbb42ac6a2fbeab7854c03a59d26

See more details on using hashes here.

File details

Details for the file fuyu-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: fuyu-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.11.0 Darwin/22.4.0

File hashes

Hashes for fuyu-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e75c4cfde28c95ed09a1692d6d4755457630db252508a49162eae92e5811d289
MD5 af4c772da4a4398d23a5d51552a5d426
BLAKE2b-256 9c97dcab3b6be748133e5d502029cea70ea3b88992b7bac7025b8d3e9087a007

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page