Skip to main content

Multi-Modality

Palm2 Adapter

Implementation of "PaLM2-VAdapter:" from the multi-modal model paper: "PaLM2-VAdapter: Progressively Aligned Language Model Makes a Strong Vision-language Adapter".

This model uses a perceiver resampler with a depth of 1 + a tiny palm to efficiently learn the features behind the images and then map them to the same space as the big model.

install

$ pip install palm2-vadapter

usage

import torch
from palm_vadapter.main import PaLM2VAdapter

# Random text and image tensors
text = torch.randint(0, 1000, (1, 32), dtype=torch.long)


# Image tensor
img = torch.randn(1, 3, 224, 224)

# Initialize PaLM2VAdapter model
model = PaLM2VAdapter(
    tiny_dim=512,
    dim=512,
    num_tokens=10000,
    seq_length=32,
    depth=6,
    heads=8,
    image_size=224,
    patch_size=16,
)

# Forward pass through the model
out = model(text, img)

# Print the shape of the output
print(out.shape)

License

MIT

Citation

@misc{xiao2024palm2vadapter,
    title={PaLM2-VAdapter: Progressively Aligned Language Model Makes a Strong Vision-language Adapter}, 
    author={Junfei Xiao and Zheng Xu and Alan Yuille and Shen Yan and Boyu Wang},
    year={2024},
    eprint={2402.10896},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

Metadata

Release files for palm-vadapter 0.0.1

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

Source distribution (sdist)

Source distribution for palm-vadapter 0.0.1
File Size Uploaded
palm_vadapter-0.0.1.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for palm-vadapter 0.0.1
File Interpreter ABI Platform
palm_vadapter-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.1 kB

Release files / palm_vadapter-0.0.1.tar.gz

Download URL palm_vadapter-0.0.1.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
97e05c2289196240092faf91b0e02a69f102d212d718a884114dbb642d19ded1
BLAKE2b-256 checksum
How to use checksums
ac7478b791690927a841d420b042f2f25d0eb76d48781155e5405e70e6225ea1
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 / palm_vadapter-0.0.1-py3-none-any.whl

Download URL palm_vadapter-0.0.1-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
89668b235f180dc3269cd5703cc5616854b9dfd7ebe80a9655b3dd37bd2208c3
BLAKE2b-256 checksum
How to use checksums
12050a2ded7ee2e0afda301e009ec36097ade6f137ccb11b423595c94eda44ed
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.1 This release

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