Skip to content

Commit

Permalink
Move converter into a package. (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryscan committed May 20, 2024
1 parent b33ba2d commit 4bc4cc9
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 40 deletions.
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 7 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
[package]
[workspace]
default-members = ["crates/ai00-server"]
members = ["crates/ai00-core", "crates/ai00-server", "crates/converter"]
resolver = "2"

[workspace.package]
authors = ["Gu ZhenNiu <[email protected]>", "Zhang Zhenyuan <[email protected]>"]
categories = ["science"]
description = "An implementation of the RWKV language model in pure WebGPU."
Expand All @@ -7,21 +12,9 @@ exclude = ["assets"]
homepage = "https://github.com/cgisky1980/ai00_rwkv_server"
keywords = ["LLM", "deep-learning", "model", "rwkv"]
license = "MIT OR Apache-2.0"
name = "ai00_server"
repository = "https://github.com/cgisky1980/ai00_rwkv_server"
rust-version = "1.76"
version = "0.4.9"

[workspace]
default-members = ["crates/ai00-server"]
members = ["crates/ai00-core", "crates/ai00-server"]
resolver = "2"

[workspace.package]
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.76"
version = "0.4.9"
version = "0.5.0"

[workspace.dependencies]
anyhow = "1"
Expand All @@ -37,16 +30,5 @@ default-features = false
features = ["native"]
version = "0.8.9"

[dependencies]
anyhow = "1"
clap = { version = "4.3", features = ["derive"] }
memmap2 = "0.9"
web-rwkv-converter = "0.1.2"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[[bin]]
name = "converter"

[profile.release]
lto = false
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ It only supports Safetensors models with the `.st` extension now. Models saved w
2. In the [Release](https://github.com/cgisky1980/ai00_rwkv_server/releases) you could find an executable called `converter`. Run

```bash
$ ./converter --input /path/to/model.pth
$ ./converter --input /path/to/model.pth --output /path/to/model.st
```

3. If you are building from source, run

```bash
$ cargo run --release --bin converter -- --input /path/to/model.pth
$ cargo run --release --package converter -- --input /path/to/model.pth --output /path/to/model.st
```

4. Just like the steps mentioned above, place the model in the `.st` model in the `assets/models/` path and modify the model path in [`assets/Config.toml`](./assets/Config.toml)
Expand Down
2 changes: 1 addition & 1 deletion README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
4. 如果你不想安装 Python 或 Torch,可以前往[`web-rwkv`](https://github.com/cryscan/web-rwkv/releases)并下载不依赖于 Python 或 Torch 的转换器`web-rwkv-converter`

```bash
$ ./web-rwkv-converter --input /path/to/model.pth
$ ./web-rwkv-converter --input /path/to/model.pth --output /path/to/model.st
```

5. 根据上文步骤,将转换所得的`.st`模型文件放在`assets/models/`路径下,并修改 [`assets/Config.toml`](./assets/Config.toml) 中的模型路径
Expand Down
1 change: 1 addition & 0 deletions crates/ai00-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ async fn main() {
simple_logger::SimpleLogger::new()
.with_level(log::LevelFilter::Warn)
.with_module_level("ai00_server", log::LevelFilter::Info)
.with_module_level("ai00_core", log::LevelFilter::Info)
.with_module_level("web_rwkv", log::LevelFilter::Info)
.init()
.expect("start logger");
Expand Down
20 changes: 20 additions & 0 deletions crates/converter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
authors = ["Gu ZhenNiu <[email protected]>", "Zhang Zhenyuan <[email protected]>"]
categories = ["science"]
description = "An implementation of the RWKV language model in pure WebGPU."
edition.workspace = true
homepage = "https://github.com/cgisky1980/ai00_rwkv_server"
keywords = ["LLM", "deep-learning", "model", "rwkv"]
license.workspace = true
name = "converter"
repository = "https://github.com/cgisky1980/ai00_rwkv_server"
rust-version.workspace = true
version.workspace = true

[dependencies]
clap = { version = "4.3", features = ["derive"] }
memmap2 = "0.9"
web-rwkv-converter = "0.1.2"

[dependencies.anyhow]
workspace = true
File renamed without changes.

0 comments on commit 4bc4cc9

Please sign in to comment.