Implementation of the RWKV language model in pure WebGPU/Rust.

Overview

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 measure 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.

Or you can download the pre-compiled binaries from the release page and run

$ chat --model /path/to/model

Use in Your Project

To use in your own rust project, simply add web-rwkv = "0.1" as a dependency in your Cargo.toml. Check examples on how to create the environment, the tokenizer and how to run the 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

  • Tokenizer is implemented by @koute.
You might also like...
puppy is an example implementation of a tiny Web browser for educational purposes.
puppy is an example implementation of a tiny Web browser for educational purposes.

An example implementation of a tiny Web browser for educational purposes.

An implementation of the callbag spec

callbag-rs An implementation of the callbag spec License Licensed under either of Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.o

A minimalistic implementation of Refal.

Refal A minimalistic implementation of Refal. It is based on the following (in Russian) papers by Sergei Romanenko: С.А.Романенко. Машинно-независимый

Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.
Rust Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev.

Rust Embed Rust Custom Derive Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev. Y

Rust I18n is use Rust codegen for load YAML file storage translations on compile time, and give you a t! macro for simply get translation texts.

Rust I18n Rust I18n is use Rust codegen for load YAML file storage translations on compile time, and give you a t! macro for simply get translation te

lispr is a Rust macro that tries to implement a small subset of LISPs syntax in Rust

lispr lispr is a Rust macro that tries to implement a small subset of LISPs syntax in Rust. It is neither especially beautiful or efficient since it i

A Rust web framework

cargonauts - a Rust web framework Documentation cargonauts is a Rust web framework intended for building maintainable, well-factored web apps. This pr

A Rust library to extract useful data from HTML documents, suitable for web scraping.

select.rs A library to extract useful data from HTML documents, suitable for web scraping. NOTE: The following example only works in the upcoming rele

openapi schema serialization for rust

open api Rust crate for serializing and deserializing open api documents Documentation install add the following to your Cargo.toml file [dependencies

Releases(v0.1.8)
Owner
研究社交
A Umich student graduated from SJTU.
研究社交
A WebGPU implementation based on the excellent wgpu crate.

A WebGPU implementation based on the excellent wgpu crate.

Ben Noordhuis 3 Jul 30, 2022
A pure Rust implementation of the Web Local Storage API, for use in non-browser contexts

Rust Web Local Storage API A Rust implementation of the Web LocalStorage API, for use in non-browser contexts About the Web Local Storage API MDN docs

RICHΛRD ΛNΛYΛ 10 Nov 28, 2022
Trulang is an interpreted language that is designed to be a simple, easy to learn, and easy to use programming language.

Trulang is an interpreted language that is designed to be a simple, easy to learn, and easy to use programming language.

Bunch-of-cells 2 Nov 23, 2022
A full-featured and easy-to-use web framework with the Rust programming language.

Poem Framework A program is like a poem, you cannot write a poem without writing it. --- Dijkstra A full-featured and easy-to-use web framework with t

Poem Web 2.2k Jan 6, 2023
A web framework for Rust programing language

kalgan A web framework for Rust programing language. Getting Started Create your project with cargo: cargo new project Add the dependency in Cargo.tom

Eduardo Casas 4 Jun 9, 2022
Rust/Axum server implementation with PCR(Prisma Client Rust)

Realworld Rust Axum Prisma This project utilizes Rust with the Axum v0.7 framework along with the Prisma Client Rust to build a realworld application.

Neo 3 Dec 9, 2023
Rust implementation of the `URLPattern` web API

urlpattern This crate implements the URLPattern web API in Rust. We aim to follow the specification as closely as possible. Contributing We appreciate

Deno Land 40 Dec 14, 2022
Reference implementation of a full-stack Rust application

Full-stack Rust with WebAssembly Look Ma, No JavaScript !!! My very first Rust project (implementation of the "Connect 5" game), I used as a learning

Vassil 64 Dec 27, 2022
Implementation of the RealWorld backend API spec in Actix, Rust's powerful actor system and most fun web framework.

Actix codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API. ❗ (2021/05/13) This cod

Allen 475 Jan 2, 2023
A brief implementation of a simple hello world program in rust since they said it couldn't be done.

rust-hello-world A brief blazingly fast ?? implementation of a simple hello world program in rust since they said it couldn't be done. ?? fast ?? Also

Enoki 2 Apr 16, 2022