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.0.tar.gz (3.0 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.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for torch_archs-0.1.0.tar.gz
Algorithm Hash digest
SHA256 73ebe84a6128a45d2d6bff380909fa6351f4c4a453917c45dfb22f1b3d50e228
MD5 a807f905b3db15717b18b2bf9715a3b3
BLAKE2b-256 048d000ac3f0638293c460b0b7f3dbeeee759db7018a42e502a913e08e51f8b5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for torch_archs-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 75ab9c846eed0843a9e8938016588a3fd28f02a67c42ce4e94e6ed24f1c05c72
MD5 88c0b0a3403dc11f77fcfd6ee45dcf76
BLAKE2b-256 e0c970cfff259143c13823915520dd6ef4acaf987d818857ed2a193584439179

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