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 rwkv
cd 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.txt at root or under RWKV-v7/ pinning numpy>=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!
Problem
RWKV-v7/rwkv_v7_numpy.pyuses thendarray.mTattribute, which was introduced in NumPy 2.0. On NumPy 1.x it raisesAttributeError.Steps
pip install numpy==1.26.4 torch rwkvcd RWKV-v7 && python rwkv_v7_numpy.pyExpected
Script runs and prints deviation vs reference
rwkvpackage.Actual
Triggered at
RWKV-v7/rwkv_v7_numpy.py:39:(also used on nothing else, only line 39). Per NumPy 2.0 release notes,
ndarray.mTisNew in version 2.0.Environment
requirements.txtat root or underRWKV-v7/pinningnumpy>=2.0.Fix options: replace
.mTwithnp.swapaxes(x,-1,-2), or add a header comment /RWKV-v7/requirements.txtrequiringnumpy>=2.0.Thanks for maintaining BlinkDL/RWKV-LM!