Composable PyTorch transformers for research.
Build vision, spatial, and sequence models with interchangeable attention, positional encodings, normalization, and feedforward components. Start with a preset, then replace individual components as your experiments evolve.
- Experiment with architecture: explicit, serializable configurations and structural protocols let you supply your own components.
- Work with variable-length data: run the same encoder weights on padded or packed token batches, with explicit token coordinates.
- Connect research and deployment: examples cover image patches, point clouds, causal modeling, custom components, and cached ONNX Runtime decoding.
Install from PyPI with pip:
pip install --upgrade stackformersOr add it to your uv project:
uv add stackformersUse --pre to include newer prereleases when upgrading:
pip install --upgrade --pre stackformersWith uv:
uv add --upgrade --prerelease allow stackformersFor an existing virtual environment, uv pip install --upgrade --pre stackformers
is also supported. These commands select the newest compatible published version,
including prereleases. Pin the version you validate for an experiment; see the
research guide.