-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
99 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "web-rwkv" | ||
version = "0.4.4" | ||
version = "0.4.5" | ||
edition = "2021" | ||
authors = ["Zhenyuan Zhang <[email protected]>"] | ||
license = "MIT OR Apache-2.0" | ||
|
@@ -13,9 +13,6 @@ exclude = ["assets/", "crates/", "screenshots/"] | |
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[workspace] | ||
members = ["crates/*"] | ||
|
||
[dependencies] | ||
wgpu = "0.18" | ||
bytemuck = { version = "1.13", features = ["extern_crate_alloc"] } | ||
|
@@ -36,6 +33,19 @@ itertools = "0.11" | |
log = "0.4" | ||
web-rwkv-derive = { version = "0.2.0", path = "crates/web-rwkv-derive" } | ||
|
||
[dependencies.repugnant-pickle] | ||
git = "https://github.com/KerfuffleV2/repugnant-pickle" | ||
tag = "v0.0.1" | ||
features = ["torch"] | ||
optional = true | ||
|
||
[features] | ||
converter = ["dep:repugnant-pickle"] | ||
|
||
[[example]] | ||
name = "converter" | ||
required-features = ["converter"] | ||
|
||
[dev-dependencies] | ||
pollster = "0.3.0" | ||
memmap2 = "0.7" | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use std::{fs::File, path::PathBuf}; | ||
|
||
use anyhow::Result; | ||
use clap::Parser; | ||
use memmap2::Mmap; | ||
use web_rwkv::converter::{convert_safetensors, RENAME, TRANSPOSE}; | ||
|
||
#[derive(Parser, Debug)] | ||
#[command(author, version, about, long_about = None)] | ||
struct Cli { | ||
#[arg(short, long, value_name = "FILE")] | ||
input: PathBuf, | ||
#[arg(short, long, value_name = "FILE")] | ||
output: Option<PathBuf>, | ||
} | ||
|
||
fn main() -> Result<()> { | ||
let cli = Cli::parse(); | ||
|
||
let file = File::open(&cli.input)?; | ||
let map = unsafe { Mmap::map(&file)? }; | ||
|
||
let output = cli.output.unwrap_or_else(|| { | ||
let path = cli | ||
.input | ||
.parent() | ||
.map(|p| p.to_path_buf()) | ||
.unwrap_or_default(); | ||
let stem = cli.input.file_stem().expect("please name the file"); | ||
let name: PathBuf = [&stem.to_string_lossy(), "st"].join(".").into(); | ||
path.join(name) | ||
}); | ||
convert_safetensors(cli.input, &map, output, RENAME, TRANSPOSE)?; | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
pub mod context; | ||
#[cfg(feature = "converter")] | ||
pub mod converter; | ||
pub mod model; | ||
pub mod num; | ||
pub mod tensor; | ||
|