attorch  by BobMcDear

PyTorch nn module subset, implemented in Python using Triton

created 2 years ago
564 stars

Top 57.9% on sourcepulse

GitHubView on GitHub
Project Summary

attorch provides a curated subset of PyTorch's neural network modules implemented in Python using OpenAI's Triton. It targets developers seeking a more hackable, efficient, and readable alternative to pure PyTorch for custom deep learning operations, particularly those who find writing raw CUDA kernels challenging. The library supports both forward and backward passes, enabling its use during model training.

How It Works

attorch leverages OpenAI's Triton, a language and compiler for writing high-performance kernels that bridge the gap between Python and CUDA. By implementing core neural network operations (like convolutions, attention, and various activation functions) in Triton, attorch aims to achieve performance improvements over standard PyTorch while maintaining a Pythonic interface. This approach allows for easier customization and potential for operation fusion, which can further boost efficiency.

Quick Start & Requirements

Highlighted Details

  • Implements a broad range of layers including Conv1d/2d, MultiheadAttention, various activations, BatchNorm, LayerNorm, and common loss functions.
  • Supports Automatic Mixed Precision (AMP).
  • Includes a PyTorch fallback mechanism for layers not yet implemented in attorch.
  • Provides a attorch.math module for custom kernel development and operation fusion.

Maintenance & Community

  • The project is maintained by BobMcDear.
  • Further community engagement details (e.g., Discord, Slack) are not specified in the README.

Licensing & Compatibility

  • The README does not explicitly state a license. This requires clarification for commercial use or closed-source linking.

Limitations & Caveats

  • The implementation is a subset of PyTorch's modules; some layers may not be available and will fall back to PyTorch.
  • Performance for inference may not match dedicated inference engines.
  • Some tests against PyTorch counterparts might fail due to numerical precision differences.
Health Check
Last commit

2 days ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
31 stars in the last 90 days

Explore Similar Projects

Starred by Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake).

applied-ai by pytorch-labs

0.3%
289
Applied AI experiments and examples for PyTorch
created 2 years ago
updated 2 months ago
Starred by Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake).

fms-fsdp by foundation-model-stack

0.4%
258
Efficiently train foundation models with PyTorch
created 1 year ago
updated 1 week ago
Starred by Andrej Karpathy Andrej Karpathy(Founder of Eureka Labs; Formerly at Tesla, OpenAI; Author of CS 231n), Lianmin Zheng Lianmin Zheng(Author of SGLang), and
13 more.

gpt-fast by pytorch-labs

0.1%
6k
PyTorch text generation for efficient transformer inference
created 1 year ago
updated 3 months ago
Starred by Tim J. Baek Tim J. Baek(Founder of Open WebUI), Stas Bekman Stas Bekman(Author of Machine Learning Engineering Open Book; Research Engineer at Snowflake), and
7 more.

pytorch-tutorial by yunjey

0.1%
32k
PyTorch tutorial for deep learning researchers
created 8 years ago
updated 1 year ago
Feedback? Help us improve.