Web-RWKV

crates.io docs.rs

This is an implementation of the language model of RWKV in pure WebGPU.

Compile and Run

  1. Install Rust.
  2. Run cargo run --release --example gen to generate 100 tokens and test the time cost.
  3. Run cargo run --release --example chat to chat with the model.
  4. To specify the location of your safetensors model, use cargo run --release --example chat -- --model /path/to/model.

Convert Models

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.

Credits