x-transformers  by lucidrains

Transformer library with extensive experimental features

Created 4 years ago
5,575 stars

Top 9.1% on SourcePulse

GitHubView on GitHub
Project Summary

This repository provides a highly modular and configurable implementation of the Transformer architecture, catering to researchers and practitioners seeking to experiment with state-of-the-art variations. It offers a comprehensive suite of attention mechanisms, normalization techniques, and architectural modifications, enabling the construction of diverse Transformer models for NLP and vision tasks.

How It Works

The library implements Transformer models using a flexible wrapper-based design. Users can instantiate core components like Encoder, Decoder, and XTransformer (encoder-decoder), then customize them with numerous parameters that enable features such as Flash Attention, Rotary Positional Embeddings, ALiBi, various normalization schemes (RMSNorm, ScaleNorm, LayerNorm variants), GLU feedforwards, and more. This modularity allows for fine-grained control over architectural choices, facilitating rapid prototyping and empirical study of Transformer variants.

Quick Start & Requirements

  • Install via pip: pip install x-transformers
  • Requires PyTorch.
  • GPU with CUDA is recommended for performance.

Highlighted Details

  • Extensive support for experimental Transformer features from recent research papers.
  • Includes implementations for vision tasks (e.g., SimpleViT, PaLI).
  • Offers specialized wrappers for Transformer-XL recurrence and continuous embeddings.
  • Integrates Flash Attention for significant speed and memory improvements.

Maintenance & Community

The project is actively maintained by lucidrains, with contributions from the broader AI research community. Links to relevant papers and discussions are often included within the code and README.

Licensing & Compatibility

The repository is typically released under a permissive license (e.g., MIT), allowing for broad use in research and commercial applications.

Limitations & Caveats

The sheer number of configurable options can lead to a steep learning curve. Some experimental features may be less stable or require specific hyperparameter tuning. The README is dense with code examples and research paper references, requiring a solid understanding of Transformer architectures to fully leverage.

Health Check
Last Commit

5 days ago

Responsiveness

1 day

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

Explore Similar Projects

Starred by Jiayi Pan Jiayi Pan(Author of SWE-Gym; MTS at xAI), Shizhe Diao Shizhe Diao(Author of LMFlow; Research Scientist at NVIDIA), and
1 more.

METER by zdou0830

0%
373
Multimodal framework for vision-and-language transformer research
Created 3 years ago
Updated 2 years ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Wing Lian Wing Lian(Founder of Axolotl AI), and
10 more.

open_flamingo by mlfoundations

0.1%
4k
Open-source framework for training large multimodal models
Created 2 years ago
Updated 1 year ago
Feedback? Help us improve.