Skip to main content

Multi-Modality

TinyGPTV

Simple Implementation of TinyGPTV in super simple Zeta lego blocks. Here all the modules from figure 2 are implemented in Zeta and Pytorch.

The flow is the following: x -> skip connection -> layer norm -> lora -> mha + lora -> residual_rms_norm -> original_skip_connection -> mlp + rms norm

Install

pip3 install tiny-gptv

Usage

TinyGPTVBlock, Figure3 (c):

  • Layernorm
  • MHA
  • Lora
  • QK Norm
  • RMS Norm
  • MLP
import torch
from tiny_gptv.blocks import TinyGPTVBlock

# Random tensor, replace with your input data
x = torch.rand(2, 8, 512)

# TinyGPTVBlock
block = TinyGPTVBlock(512, 8, depth=10)

# Print the block
print(block)

# Forward pass
out = block(x)

# Print the output shape
print(out.shape)

Figure3 (b) Lora Module for LLMS Block

  • MHA,
  • Lora,
  • Normalization,
  • MLP
  • Skip connection
  • Split then add
import torch
from tiny_gptv import LoraMHA

x = torch.rand(2, 8, 512)
block = LoraMHA(512, 8)
out = block(x)
print(out.shape)

Citation

@misc{yuan2023tinygptv,
    title={TinyGPT-V: Efficient Multimodal Large Language Model via Small Backbones}, 
    author={Zhengqing Yuan and Zhaoxu Li and Lichao Sun},
    year={2023},
    eprint={2312.16862},
    archivePrefix={arXiv},
    primaryClass={cs.CV}
}

License

MIT

Metadata

Release files for tiny-gptv 0.0.5

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

Source distribution (sdist)

Source distribution for tiny-gptv 0.0.5
File Size Uploaded
tiny_gptv-0.0.5.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tiny-gptv 0.0.5
File Interpreter ABI Platform
tiny_gptv-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / tiny_gptv-0.0.5.tar.gz

Download URL tiny_gptv-0.0.5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
659f25aec9d149292e99d5ea812fbbf1c2f7ca6e8b94691f5287b6cf00fd7cd8
BLAKE2b-256 checksum
How to use checksums
39d4b88b55f804377ec5a1045df401f9aea5cae5412fd383e21593e7f27cf32e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.0 Darwin/22.4.0

Release files / tiny_gptv-0.0.5-py3-none-any.whl

Download URL tiny_gptv-0.0.5-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83b08d1f178211348d6e6c2b2e24ba38d3cad4062eddd35da2d75581faea1403
BLAKE2b-256 checksum
How to use checksums
5f4f6012d8709c2795670cde0d90d4b8d20aba7363e4be7979843804a02f7c5d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.11.0 Darwin/22.4.0

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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