Registry / ai-ml / rwkv
library0.8.32pypypi✓ verified 79d ago

Python library for the RWKV language model, a RNN with transformer-level performance. Current version 0.8.32. Stable release cadence.

pip install rwkv
INSTALL
IMPORT
SIG · RWKV
R
rwkv
ai-mlpythonv0.8.32
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

RWKV
import rwkv
from rwkv.model import RWKV

Basic text generation with RWKV model. Requires a .pth model file and tokenizer.json.

import os import torch from rwkv.model import RWKV from rwkv.utils import PIPELINE, PIPELINE_ARGS # Use environment variable for model path, with fallback model_path = os.environ.get('RWKV_MODEL_PATH', './RWKV-4-World-0.4B-v1-20230806-ctx4096.pth') tokenizer_path = os.environ.get('RWKV_TOKENIZER_PATH', './20B_tokenizer.json') model = RWKV(model=model_path, strategy='cuda fp16') pipeline = PIPELINE(model, tokenizer_path) # Run inference context = "\nThe universe is" state = None out_tokens = [] for i in range(100): tokens = pipeline.encode(context) if i == 0 else [token] out, state = model.forward(tokens, state) token = pipeline.sample_logits(out, temperature=1.0, top_p=0.85) out_tokens += [token] context = pipeline.decode(out_tokens) print(context)
Debug
Known issues
breakingStrategy argument changed: from 'cuda fp16i8' to 'cuda fp16' or 'cuda fp32'. The 'fp16i8' strategy was removed in v0.7.
fix
Use 'cuda fp16' for Int8 quantization is no longer supported; use 'cuda fp16' or 'cuda fp32'.
affects: >=0.7
breakingModel file format changed: old .pth files from v0.4 are incompatible with v0.8+.
fix
Download updated model files from Hugging Face or the official repository.
affects: >=0.8
gotchaTokenizer file path must be absolute or relative to current working directory. The default tokenizer.json is not bundled; you need to download it separately.
fix
Download '20B_tokenizer.json' from https://github.com/BlinkDL/ChatRWKV and provide path.
affects: all
Upgrade
Version history
0.8.32latest on PyPI · released Feb 11, 2026
Audit
Dependencies
torchrequiredRequired for model inference
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
1
Resources
rwkv — pip install rwkv · libregistry