Skip to main content

Vision LLMs with LoRA fine-tuning.

Project description

plimai: Vision LLMs with LoRA Fine-Tuning

A modular framework for building and fine-tuning Vision Large Language Models (LLMs) with efficient Low-Rank Adaptation (LoRA) support.

Features

  • Modular Vision Transformer backbone
  • LoRA for efficient fine-tuning on limited compute
  • Easily extensible for new components and tasks
  • Example and tests included

Installation

pip install torch torchvision

Usage Example

import torch
from plimai.models.vision_transformer import VisionTransformer
from plimai.utils.config import default_config

x = torch.randn(2, 3, 224, 224)
model = VisionTransformer(
    img_size=default_config['img_size'],
    patch_size=default_config['patch_size'],
    in_chans=default_config['in_chans'],
    num_classes=default_config['num_classes'],
    embed_dim=default_config['embed_dim'],
    depth=default_config['depth'],
    num_heads=default_config['num_heads'],
    mlp_ratio=default_config['mlp_ratio'],
    lora_config=default_config['lora'],
)
out = model(x)
print('Output shape:', out.shape)

Running Tests

pytest tests/

Directory Structure

plimai/
  models/
    vision_transformer.py
    lora.py
  components/
    patch_embedding.py
    attention.py
    mlp.py
  utils/
    data.py
    config.py
  example.py

License

MIT

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

plimai-0.1.2.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

plimai-0.1.2-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file plimai-0.1.2.tar.gz.

File metadata

  • Download URL: plimai-0.1.2.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for plimai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 354590ff60934a09bad9a984f647bfdc9fc7b629335074439b43988deb70ddd6
MD5 f7bcbed28f06e3656aa51e285336b912
BLAKE2b-256 60dd3a426a2abf882b7d72dfda1f191013e6bf0fe2befe82be4a48d740eed2f0

See more details on using hashes here.

File details

Details for the file plimai-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: plimai-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for plimai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b91a2132d4f094d057d18baf968141cb09b4d63652eb9d97bbd7178c3e71d2ee
MD5 6fb3a28eacb55c885c0b12981e789db9
BLAKE2b-256 a399134cb5f780342bae46d0ec0869e445055744e6e29a0a1b26b3d05aa7cbb2

See more details on using hashes here.

Supported by

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