Skip to main content

qformer - Pytorch

Project description

Multi-Modality

Qformer

Implementation of Qformer from BLIP2 in Zeta Lego blocks. The implementation is here straight from Figure 2. In particular the image block and text block.

Install

pip3 install qformer

Usage

import torch
from qformer import QFormer

x = torch.randn(
    1, 32, 512
)  # Create a random tensor of shape (1, 32, 512)

img = torch.randn(
    1, 32, 512
)  # Create another random tensor of shape (1, 32, 512)

qformer = QFormer(
    512, 8, 8, 0.1, 2, 2
)  # Create an instance of the QFormer model

y = qformer(
    x, img
)  # Apply the QFormer model to the input tensors x and img

print(y.shape)  # Print the shape of the output tensor y

License

MIT

Citation

@misc{li2023blip2,
    title={BLIP-2: Bootstrapping Language-Image Pre-training with Frozen Image Encoders and Large Language Models}, 
    author={Junnan Li and Dongxu Li and Silvio Savarese and Steven Hoi},
    year={2023},
    eprint={2301.12597},
    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

qformer-0.0.5.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

qformer-0.0.5-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file qformer-0.0.5.tar.gz.

File metadata

  • Download URL: qformer-0.0.5.tar.gz
  • Upload date:
  • Size: 5.2 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 qformer-0.0.5.tar.gz
Algorithm Hash digest
SHA256 9b2ff92ca5a318aac912c71767558a561e7df97d37426e0a66fb6c712515d9e9
MD5 aeb9245e344cde743b3cd8ae4a88b217
BLAKE2b-256 9fe56a63ab668a01846d5af7197c3b144c33fcafa748ca62c1710e81e5875658

See more details on using hashes here.

File details

Details for the file qformer-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: qformer-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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 qformer-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 eb0f49ad349b6a97e3b9c39f077fb2a0328ec0c33979c2a6c5fcef96aa1b5aef
MD5 ab0a2fd28126f8ad35f75bbf0f9f1f0d
BLAKE2b-256 c2a0bd247c1200e1bf5bcb4e0c7878577f103eccffe2cdffcc5178f28c45f2d8

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