Registry / ai-ml / fla-core

fla-core

JSON →
library0.4.2pypypi✓ verified 33d ago

fla-core is a Python library providing efficient, Triton-based implementations of core operations and kernels for state-of-the-art linear attention and state-space models. It serves as a minimal-dependency subset of the larger 'flash-linear-attention' project, focusing on the fundamental computational building blocks. It is currently at version 0.4.2 and follows a regular release cadence, often in conjunction with its parent project, flash-linear-attention.

ai-mlllm-agents
Install & Compatibility
Where this runs
tested against v0.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✓ 71.23s
py 3.11
✕ build_error
✓ 69.13s
py 3.12
✕ build_error
✓ 65.83s
py 3.13
✕ build_error
✓ 64.18s
py 3.9
✕ build_error
✕ build_error
4787MB installed
● package 4787MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

from fla import extend_path
from fla import importlib

This quickstart demonstrates the use of a fused normalization module from `fla-core`. It initializes `FusedRMSNormGated` and applies it to a dummy tensor on a CUDA-enabled GPU. This illustrates how to integrate low-level, optimized operations provided by `fla-core`.

import torch from fla.modules import FusedRMSNormGated import os # fla-core operations require a CUDA-enabled GPU if not torch.cuda.is_available(): raise RuntimeError("CUDA not available. fla-core requires a CUDA-enabled GPU.") device = torch.device("cuda") # Define model parameters hidden_size = 768 batch_size = 4 sequence_length = 512 # Initialize FusedRMSNormGated module from fla-core norm_layer = FusedRMSNormGated(hidden_size).to(device) # Create a dummy input tensor input_tensor = torch.randn(batch_size, sequence_length, hidden_size, device=device, dtype=torch.float16) # Perform a forward pass output_tensor = norm_layer(input_tensor) print(f"Input tensor shape: {input_tensor.shape}") print(f"Output tensor shape: {output_tensor.shape}") print("FusedRMSNormGated operation successful, demonstrating fla-core usage.")
Debug
Known footguns
gotchaThe `fla-core` package is a minimal subset of `flash-linear-attention`. It contains core kernels and modules (e.g., in `fla.ops` and `fla.modules`) but lacks higher-level layers and models (e.g., `fla.layers`, `fla.models`). Attempting to import these high-level components with only `fla-core` installed will result in an `ImportError`.
breakingThe input tensor format for some kernels switched from 'head-first' to 'sequence-first'. This change affects how dimensions are ordered for input tensors (e.g., `(batch, heads, sequence, dim)` might become `(batch, sequence, heads, dim)`).
gotchafla-core heavily relies on NVIDIA Triton for its optimized kernels. Specific Triton versions (>=3.0 or nightly) and correct backend installations are required, especially for AMD ROCm or Intel XPU GPUs.
gotchaRequires Python 3.10 or higher. Running with older Python versions will lead to installation or runtime errors.
gotchaUsers on H100 GPUs may encounter 'MMA Assertion Error' or 'LinearLayout Assertion Error' due to known Triton issues.
gotchaPyTorch version requirement: fla-core expects PyTorch >= 2.5. Older versions may cause compatibility issues or runtime errors.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
32 hits · last 30 days
chatgpt-user
7
googlebot
5
ahrefsbot
4
bytedance
4
oai-searchbot
4
dotbot
2
script
1
Resources