The lrnnx library provides state-of-the-art Linear RNN architectures for sequence modeling. You can install it from PyPI or build from source.
Since lrnnx builds custom CUDA kernels, the installation process can take approximately 30 minutes, depending on your CPU count. The full installation with the conv1d extra may take even longer.
Install from PyPI
The simplest way to get started is to install lrnnx from PyPI using pip or uv.
Install PyTorch first (recommended)
We recommend installing PyTorch first to match your specific CUDA version: Visit PyTorch’s installation page to find the right version for your system.
Install lrnnx with --no-build-isolation
After installing PyTorch, install lrnnx using the --no-build-isolation flag: pip install lrnnx --no-build-isolation
This ensures the build process uses your installed PyTorch version rather than downloading a temporary one.
Standard installation
If you prefer a simple installation without pre-installing PyTorch:
With optional causal-conv1d
The conv1d extra includes the causal-conv1d package, which provides optimized convolution kernels used by some models like Mamba:
pip install "lrnnx[conv1d]"
Use quotes around "lrnnx[conv1d]" to prevent your shell from interpreting the brackets as special characters.
For development
If you’re planning to contribute to lrnnx or need development tools:
This includes pytest, black, isort, and mypy for testing and code quality.
Install from source
For the latest features or to contribute to lrnnx, you can install from source.
Using uv (recommended)
uv is a fast Python package installer that we recommend for source installations.
Clone the repository
git clone https://github.com/SforAiDl/lrnnx.git
cd lrnnx
Sync dependencies
Choose one of the following based on your needs: Standard installation
With causal-conv1d
For development
Using pip
You can also use standard pip for editable installations:
Clone the repository
git clone https://github.com/SforAiDl/lrnnx.git
cd lrnnx
Install in editable mode
Choose one of the following based on your needs: Standard installation
With causal-conv1d
For development
pip install -e . --no-build-isolation
The -e flag installs the package in editable mode, so changes to the source code are immediately reflected without reinstallation.
Verify your installation
After installation, verify that lrnnx is working correctly:
import torch
from lrnnx.models.lti import LRU
# Create a simple model
model = LRU( d_model = 64 , d_state = 64 )
print ( "lrnnx installed successfully!" )
If this runs without errors, you’re ready to start using lrnnx in your projects.
Next steps
Now that you have lrnnx installed, check out the Quickstart guide to learn how to use the library.