x-transformers
X-Transformers
Decision gist · record as of 2026-08-14
Yes. x-transformers is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and offers a well-designed API for building transformer variants. It is worth installing if you need modular transformer components with experimental features like Flash Attention or memory tokens. Install friction is low. The main constraint is the torch dependency and GPU requirement for practical training.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires PyTorch and CUDA-capable GPU for practical use; torch dependency must be installed separately.
- Low friction: pure Python wheel with six runtime dependencies (torch, einops, einx, loguru, packaging, torch-einops-utils).
- Active maintenance with a release 5 days ago.
License · maintenance · safety
permissive license (permissive) — MIT License permits unrestricted use, modification, and distribution in both open and proprietary projects, with only the requirement to include the original copyright notice and license text.
last release 2026-08-09 (5 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 1,401,439 downloads/mo, #3,951 on PyPI
Alternatives
Verify before relying
pip install x-transformers
import torch
from x_transformers import TransformerWrapper, Decoder
model = TransformerWrapper(
num_tokens=20000,
max_seq_len=1024,
attn_layers=Decoder(dim=512, depth=12, heads=8)
).cuda()
x = torch.randint(0, 256, (1, 1024)).cuda()
output = model(x)- Whether Flash Attention integration requires PyTorch 2.0+ or works with earlier versions
- Memory and compute requirements for training models at scale
- Performance benchmarks against other transformer libraries
What it is and what it does
x-transformers is a PyTorch library that provides composable transformer components—Encoder, Decoder, and full encoder-decoder (XTransformer)—along with experimental architectural improvements from recent papers. It supports standard use cases like GPT-style language modeling, BERT-style encoding, vision transformers (ViT), and multimodal tasks like image captioning and vision-language models. The library integrates Flash Attention for memory-efficient training, memory tokens for improved attention dynamics, and persistent memory key-values as alternatives to feedforward layers.
The package is designed for researchers and practitioners building custom transformer models. Dependencies include torch for the core computation, einops and einx for tensor operations, loguru for logging, and packaging for version handling. It requires Python 3.9+ and is actively maintained, with recent releases indicating ongoing development.
Use it for
- Build a GPT-like decoder-only language model with configurable depth, heads, and sequence length
- Implement a BERT-style encoder for text classification or token-level tasks
- Create a vision transformer (ViT) for image classification on custom datasets
- Combine a vision encoder with a text decoder for image-to-caption generation
- Experiment with Flash Attention or memory tokens to reduce training memory footprint
- Prototype multimodal models like PaLI that fuse vision and language encoders
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
x-transformers is actively maintained, has no known vulnerabilities, carries a permissive MIT license, and offers a well-designed API for building transformer variants. It is worth installing if you need modular transformer components with experimental features like Flash Attention or memory tokens. Install friction is low. The main constraint is the torch dependency and GPU requirement for practical training.
Install
x-transformers on PyPI
Before you install
Low friction: pure Python wheel with six runtime dependencies (torch, einops, einx, loguru, packaging, torch-einops-utils). Active maintenance with a release 5 days ago.
Requires PyTorch and CUDA-capable GPU for practical use; torch dependency must be installed separately.
License in practice
MIT License permits unrestricted use, modification, and distribution in both open and proprietary projects, with only the requirement to include the original copyright notice and license text.
Quickstart
pip install x-transformers
import torch
from x_transformers import TransformerWrapper, Decoder
model = TransformerWrapper(
num_tokens=20000,
max_seq_len=1024,
attn_layers=Decoder(dim=512, depth=12, heads=8)
).cuda()
x = torch.randint(0, 256, (1, 1024)).cuda()
output = model(x)
Verify before relying
- Whether Flash Attention integration requires PyTorch 2.0+ or works with earlier versions
- Memory and compute requirements for training models at scale
- Performance benchmarks against other transformer libraries
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 6 packageseinopseinxlogurupackagingtorch-einops-utilstorch |
| Maintenance | Actively maintained 5 days since the last release |
| First released | |
| Downloads | 1,401,439 / month, #3,951 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.6Topic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: x_transformers-2.25.5-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “encoder decoder implementation”
- x-transformersx-transformers provides modular transformer building blocks—encoder,…
- pylsqpackpylsqpack provides Python Decoder and Encoder objects for reading and…
- toon-formatEncodes and decodes data structures using TOON (Token-Oriented Object…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also vit-pytorch · xformers · conformer · CoLT5-attention · local-attention · axial-positional-embedding · rotary-embedding-torch · vector-quantize-pytorch · fla-core