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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tiny_gptv-0.0.5.tar.gz | 4.6 kB | Without provenance | Details for tiny_gptv-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tiny_gptv-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for tiny_gptv-0.0.5-py3-none-any.whl |
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
|
Security for tiny-gptv 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.