xformers
XFormers: A collection of composable Transformer building blocks.
Decision gist · record as of 2026-08-14
Yes, if you are building or experimenting with Transformer architectures in PyTorch. XFormers is actively maintained, has no known vulnerabilities, uses a permissive BSD license, and ranks in the top 5000 PyPI packages by download volume. The medium install friction (platform-specific wheels) is a minor trade-off for the modularity and performance benefits it provides. Not necessary if you only use pre-built, monolithic Transformer models.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later; torch and numpy must be installed.
- Platform-specific wheels available for Linux (manylinux_2_28_x86_64) and Windows (win_amd64).
- Medium install friction due to compiled wheel dependencies (xformers ships platform-specific wheels for Python 3.9+ on Linux and Windows).
License · maintenance · safety
permissive license (permissive) — BSD License (permissive) means you can use, modify, and distribute xformers with minimal restrictions, provided you include the license notice.
last release 2026-02-20 (175 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 2,196,828 downloads/mo, #3,220 on PyPI
Alternatives
Verify before relying
pip install xformers torch numpy
import xformers
from xformers.ops import memory_efficient_attention
# Use composable transformer blocks in your model- Whether xformers provides performance improvements over standard PyTorch transformer implementations in typical use cases.
- Compatibility with other transformer frameworks or whether it is PyTorch-specific.
- Availability of pre-built wheels for ARM64 or other architectures beyond x86_64.
What it is and what it does
XFormers is a library of modular, reusable components for building Transformer neural networks. Rather than implementing entire architectures as monolithic models, it provides composable building blocks—attention mechanisms, layer variants, and other Transformer primitives—that can be combined to reproduce state-of-the-art model designs. The library targets researchers and practitioners who want flexibility in assembling custom Transformer architectures without reinventing core components.
It depends on torch for computation and numpy for numerical operations. Installation requires Python 3.9 or later and involves platform-specific compiled wheels, which adds moderate setup friction but ensures optimized performance on supported systems (Linux x86_64 and Windows x86_64).
Use it for
- Build custom Transformer architectures by combining xformers blocks instead of implementing layers from scratch.
- Experiment with different attention mechanisms and layer configurations for research or model optimization.
- Integrate efficient attention implementations into existing PyTorch models to reduce memory usage or improve speed.
- Reproduce published Transformer variants by assembling their documented building-block combinations.
- Prototype novel Transformer designs by swapping and reconfiguring composable components.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are building or experimenting with Transformer architectures in PyTorch.
XFormers is actively maintained, has no known vulnerabilities, uses a permissive BSD license, and ranks in the top 5000 PyPI packages by download volume. The medium install friction (platform-specific wheels) is a minor trade-off for the modularity and performance benefits it provides. Not necessary if you only use pre-built, monolithic Transformer models.
Install
xformers on PyPI
Before you install
Medium install friction due to compiled wheel dependencies (xformers ships platform-specific wheels for Python 3.9+ on Linux and Windows). Active maintenance with a recent release as of 2026-02-20. Requires torch and numpy as runtime dependencies.
Requires Python 3.9 or later; torch and numpy must be installed. Platform-specific wheels available for Linux (manylinux_2_28_x86_64) and Windows (win_amd64).
License in practice
BSD License (permissive) means you can use, modify, and distribute xformers with minimal restrictions, provided you include the license notice.
Quickstart
pip install xformers torch numpy
import xformers
from xformers.ops import memory_efficient_attention
# Use composable transformer blocks in your model
Verify before relying
- Whether xformers provides performance improvements over standard PyTorch transformer implementations in typical use cases.
- Compatibility with other transformer frameworks or whether it is PyTorch-specific.
- Availability of pre-built wheels for ARM64 or other architectures beyond x86_64.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 2 packagestorchnumpy |
| Maintenance | Actively maintained 175 days since the last release |
| First released | |
| Downloads | 2,196,828 / month, #3,220 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: Artificial Intelligence |
Evidence: xformers-0.0.35-py39-none-manylinux_2_28_x86_64.whl; xformers-0.0.35-py39-none-win_amd64.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 › “transformer building blocks”
- xformersXFormers provides reusable, composable building blocks for…
- x-transformersx-transformers provides modular transformer building blocks—encoder,…
- conformerProvides PyTorch implementations of the Conformer architecture—a…
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 curated-transformers · x-transformers · spacy-transformers · fla-core · adapters · megatron-core · vit-pytorch · XBlock · conformer · spandrel-extra-arches