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.2.tar.gz (5.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.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for torch_archs-0.1.2.tar.gz
Algorithm Hash digest
SHA256 22518f321f9c19a2eca6dad6429b16713df9268e4a4b7408f59d80193a113676
MD5 7236afebd1c920b51f8a4902464980a4
BLAKE2b-256 386f358b1122d26774d853665d983debeccc1383345c9cce4dcf0f197e265243

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for torch_archs-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8939d9ab3eb418025ab72cff69a4a4a8a1d0493ff059c4753ac55f9ce2f9a08a
MD5 65b71d3ddf0bc2d55a55b3821b372a4b
BLAKE2b-256 ac43ba61e3cd943e0669ebc43a6ecb7c2d7d9cfcb2fdec0670f4f5b2ea906539

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