RWKV-v7/rwkv_v7_numpy.py fails on NumPy <2.0 (`.mT` attribute)
Author: chirag127Created Jul 4, 2026Updated Aug 1, 2026
Problem
RWKV-v7/rwkv_v7_numpy.py uses the ndarray.mT attribute, which was introduced in NumPy 2.0. On NumPy 1.x it raises AttributeError.
Steps
pip install numpy==1.26.4 torch rwkvcd RWKV-v7 && python rwkv_v7_numpy.py
Expected
Script runs and prints deviation vs reference rwkv package.
Actual
AttributeError: 'numpy.ndarray' object has no attribute 'mT'Triggered at RWKV-v7/rwkv_v7_numpy.py:39:
S = S * w.mT - S @ kk * (kk*a).mT + v * k.mT(also used on nothing else, only line 39). Per NumPy 2.0 release notes, ndarray.mT is New in version 2.0.
Environment
- NumPy 1.26.4 (still widely paired with PyTorch 2.4/2.5)
- Python 3.10
- Repo has no
requirements.txtat root or underRWKV-v7/pinningnumpy>=2.0.
Fix options: replace .mT with np.swapaxes(x,-1,-2), or add a header comment / RWKV-v7/requirements.txt requiring numpy>=2.0.
Thanks for maintaining BlinkDL/RWKV-LM!
Source: BlinkDL/RWKV-LM