This is an implementation of the language model of RWKV in pure WebGPU.
cargo run --release --example gen
to generate 100 tokens and measure the time cost.cargo run --release --example chat
to chat with the model.cargo run --release --example chat -- --model /path/to/model
.Or you can download the pre-compiled binaries from the release page and run
bash
$ chat --model /path/to/model
To use in your own rust project, simply add web-rwkv = "0.2"
as a dependency in your Cargo.toml
.
Check examples on how to create the environment, the tokenizer and how to run the model.
You can now download the coverted models here.
You may download the official RWKV World series models from HuggingFace, and convert them via the provided convert_safetensors.py
.
An already-converted 0.4B model can be found under assets/models
.