$npx skillfedfor your agent

rotary-embedding-torch

Rotary Embedding - Pytorch

Worth itPyPI Artificial IntelligenceReleased Jun 2026714.1K downloads / moMITPure Python

Decision gist · record as of 2026-08-14

pure-Python wheel — rotary_embedding_torch-0.9.1-py3-none-any.whl
v0.9.1 · released 2026-06-20 · Python >=3.9 · 2 runtime deps: einops, torch

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

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.
Same gist for agents: .md · .json

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.

Worth 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

LicenseMIT permissive
Python supportSupports the current Python release >=3.9
Install frictionLow. Pure-Python wheel
Runtime dependencies
2 packages
einopstorch
MaintenanceActively maintained 55 days since the last release
First released
Downloads714,094 / month, #5,249 on PyPI 30-day window, as of 2026-08-14
Known vulnerabilitiesNone 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

Capabilities
rotary positional embeddings pytorchrope transformer attentionposition encoding transformersrotary embeddings attention layerssequence position encoding pytorchtransformer positional encodingrelative position embeddings
Topics
transformerspositional-encodingattention-mechanism
PyPI keywords
artificial intelligencedeep learningpositional embedding

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”

Give your agent the search over MCP, or paste the wish link into any chat.

More Artificial Intelligence packages

litellm With conditions
PyPI · Artificial Intelligence · released Aug 2026

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.

MITcompiled wheel
682.8Mdownloads / mo
huggingface-hub Worth it
PyPI · Artificial Intelligence · released Aug 2026

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.

Apache-2.0pure Python · 3.10.0+
442.4Mdownloads / mo
langchain Worth it
PyPI · Python Modules · released Aug 2026

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.

MITpure Python
315.4Mdownloads / mo
hf-xet With conditions
PyPI · Artificial Intelligence · released Aug 2026

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.

Apache-2.0compiled wheel · 3.8+
258.4Mdownloads / mo
tokenizers Worth it
PyPI · Artificial Intelligence · released Apr 2026

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.

Apache-2.0compiled wheel · 3.10+
222.9Mdownloads / mo
transformers Worth it
PyPI · Artificial Intelligence · released Aug 2026

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.

permissive licensepure Python · 3.10.0+
186.6Mdownloads / mo

See also axial-positional-embedding · vit-pytorch · CoLT5-attention · vector-quantize-pytorch · torch-einops-utils · x-transformers · entmax · local-attention · torch · conformer

Further reading