Skip to main content

PyTorch vision and language architectures.

Project description

torch-archs

PyTorch vision and language architectures.

Overview

torch-archs is a collection of modern neural network architectures implemented in PyTorch, focusing on both computer vision and natural language processing models. This library provides clean, efficient implementations of state-of-the-art architectures that can be easily integrated into your projects.

Features

  • Vision Architectures: Vision Transformer (ViT) components and related architectures
  • Language Architectures: Mixture of Experts (MoE) and other language model components
  • Clean Implementation: Well-documented, modular code following PyTorch best practices
  • Easy Integration: Simple APIs for incorporating architectures into your projects

Installation

From source

git clone https://github.com/your-username/torch-archs.git
cd torch-archs
pip install -e .

Using uv (recommended)

uv add torch-archs

Requirements

  • Python >= 3.11
  • PyTorch >= 2.4

Usage

Vision Architectures

from torch_archs.vision.vit import Patchify2D
import torch

# Create a patch extraction layer
patchify = Patchify2D(patch_size=16, flatten_sequence=True)

# Input image tensor (batch_size=1, channels=3, height=224, width=224)
x = torch.randn(1, 3, 224, 224)
patches = patchify(x)
print(patches.shape)  # Output shape will depend on implementation

Language Architectures

from torch_archs.language import moe
# Implementation coming soon

Architecture Components

Vision (torch_archs.vision)

  • Patchify2D: Extracts non-overlapping patches from 2D images for Vision Transformer models
    • Configurable patch size
    • Optional sequence flattening
    • Efficient tensor operations

Language (torch_archs.language)

  • Mixture of Experts (MoE): Coming soon
  • Additional language model components in development

Project Structure

torch-archs/
├── torch_archs/
│   ├── vision/
│   │   └── vit.py          # Vision Transformer components
│   └── language/
│       └── moe.py          # Mixture of Experts components
├── main.py                 # Example usage and demos
├── pyproject.toml          # Project configuration
└── README.md              # This file

Development

Setting up development environment

# Clone the repository
git clone https://github.com/your-username/torch-archs.git
cd torch-archs

# Install in development mode
pip install -e .

# Or using uv
uv sync

Running examples

python main.py

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Development Guidelines

  • Follow PyTorch coding conventions
  • Add comprehensive docstrings to all public methods
  • Include type hints
  • Write tests for new architectures
  • Update documentation as needed

License

This project is licensed under the MIT License - see the LICENSE file for details.

Roadmap

  • Complete Vision Transformer implementation
  • Implement Mixture of Experts architectures
  • Add more vision architectures (ResNet, EfficientNet, etc.)
  • Add more language architectures (Transformer, BERT variants, etc.)
  • Comprehensive test suite
  • Performance benchmarks
  • Pre-trained model weights

Citation

If you use this library in your research, please cite:

@software{torch_archs,
  title = {torch-archs: PyTorch Vision and Language Architectures},
  author = {Javier Cervera Cordero},
  year = {2025},
  url = {https://github.com/javi22020/torch-archs}
}

Acknowledgments

  • PyTorch team for the excellent deep learning framework
  • The research community for developing these architectures
  • Contributors to this project

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

torch_archs-0.1.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

torch_archs-0.1.1-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file torch_archs-0.1.1.tar.gz.

File metadata

  • Download URL: torch_archs-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.12

File hashes

Hashes for torch_archs-0.1.1.tar.gz
Algorithm Hash digest
SHA256 2ac4e23bf328698c8081329eb6c64698fc80b6239dcfbe95546d67ca45447934
MD5 20b054c106c118599e195939b532b226
BLAKE2b-256 8ae75f22997e896d14374246b4ef4a8f8cb9845f5c36fb04fab4d468aed834e9

See more details on using hashes here.

File details

Details for the file torch_archs-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for torch_archs-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5ef6178b2b07a3b930dc665afff56c8e77bf5410ae5faee8bd6149c84765e221
MD5 cef5c5422b0ff8e0c4615b46199b58ae
BLAKE2b-256 83c3159bbb1ca3fb48ad695393f88f3cd7eb3dbf82b16eae171037b73740e3b1

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