rotary-embedding-torch
Rotary Embedding - Pytorch
Decision gist · record as of 2026-08-14
Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, and provides a well-documented implementation of a proven positional encoding technique. It is suitable for production transformer projects that need rotary embeddings or their variants, particularly when extending context length or working with multi-dimensional data.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires PyTorch and einops; Python 3.9 or later.
- Low friction installation with only two runtime dependencies (einops and torch).
- Actively maintained with a recent release within the last two months.
License · maintenance · safety
MIT (permissive) — MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.
last release 2026-06-20 (55 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 714,094 downloads/mo, #5,249 on PyPI
Alternatives
Verify before relying
pip install rotary-embedding-torch
import torch
from rotary_embedding_torch import RotaryEmbedding
rotary_emb = RotaryEmbedding(dim=32)
q = torch.randn(1, 8, 1024, 64)
k = torch.randn(1, 8, 1024, 64)
q = rotary_emb.rotate_queries_or_keys(q)
k = rotary_emb.rotate_queries_or_keys(k)- Whether the fused Flash Attention kernel with rotary embeddings requires Triton to be installed separately or if fallback is automatic.
- Performance characteristics and memory overhead compared to other positional encoding schemes in production transformer models.
- Compatibility with specific transformer architectures beyond the general attention pattern described.
What it is and what it does
Rotary Embedding Torch is a standalone library that adds rotary positional embeddings (RoPE) to transformer attention mechanisms in PyTorch. It provides efficient methods to encode position information by rotating query and key tensors, supporting both fixed and learned positional encodings along any tensor axis. The library implements several variants including standard rotary embeddings, axial embeddings for multi-dimensional data like video, length-extrapolatable embeddings (XPos) for handling sequences longer than training length, and fused Flash Attention kernels that compute attention with rotary embeddings in a single pass.
The package depends on torch and einops for tensor operations and is designed to integrate directly into transformer implementations at the attention layer level. It supports inference optimizations like key-value cache handling and includes options for sequence position interpolation to extend context windows. The library is actively maintained and carries no known security vulnerabilities.
Use it for
- Adding rotary positional encoding to standard transformer attention layers during training and inference.
- Extending transformer context length beyond training sequence length using XPos or interpolation techniques.
- Implementing multi-dimensional positional embeddings for video or image transformers using axial rotary embeddings.
- Optimizing attention computation with fused Flash Attention kernels that incorporate rotary embeddings.
- Fine-tuning pretrained models to handle longer sequences via position interpolation.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
The package is actively maintained, has low install friction, carries no known vulnerabilities, and provides a well-documented implementation of a proven positional encoding technique. It is suitable for production transformer projects that need rotary embeddings or their variants, particularly when extending context length or working with multi-dimensional data.
Install
rotary-embedding-torch on PyPI
Before you install
Low friction installation with only two runtime dependencies (einops and torch). Actively maintained with a recent release within the last two months.
Requires PyTorch and einops; Python 3.9 or later.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects with minimal obligations.
Quickstart
pip install rotary-embedding-torch
import torch
from rotary_embedding_torch import RotaryEmbedding
rotary_emb = RotaryEmbedding(dim=32)
q = torch.randn(1, 8, 1024, 64)
k = torch.randn(1, 8, 1024, 64)
q = rotary_emb.rotate_queries_or_keys(q)
k = rotary_emb.rotate_queries_or_keys(k)
Verify before relying
- Whether the fused Flash Attention kernel with rotary embeddings requires Triton to be installed separately or if fallback is automatic.
- Performance characteristics and memory overhead compared to other positional encoding schemes in production transformer models.
- Compatibility with specific transformer architectures beyond the general attention pattern described.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packageseinopstorch |
| Maintenance | Actively maintained 55 days since the last release |
| First released | |
| Downloads | 714,094 / month, #5,249 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: rotary_embedding_torch-0.9.1-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 › “rotary positional embeddings pytorch”
- rotary-embedding-torchImplements rotary positional embeddings for transformer attention…
- axial-positional-embeddingProvides axial positional embeddings for transformer networks,…
- flash-attnProvides optimized GPU implementations of scaled dot-product…
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 axial-positional-embedding · vit-pytorch · CoLT5-attention · vector-quantize-pytorch · torch-einops-utils · x-transformers · entmax · local-attention · torch · conformer