diff --git a/Cargo.toml b/Cargo.toml index b0f0e26..b44c0fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "web-rwkv" -version = "0.6.12" +version = "0.6.13" edition = "2021" authors = ["Zhenyuan Zhang "] license = "MIT OR Apache-2.0" @@ -17,9 +17,9 @@ exclude = ["assets/", "crates/", "screenshots/"] wgpu = "0.18" bytemuck = { version = "1.13", features = ["extern_crate_alloc"] } half = { version = "2.2", features = ["bytemuck"] } -safetensors = "0.4.1" +safetensors = "0.4" flume = "0.11.0" -regex = "1.8.4" +regex = "1.10" gpp = "0.6.2" uid = "0.1" ahash = "0.8" diff --git a/src/model/mod.rs b/src/model/mod.rs index e2c4115..93fe988 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -134,7 +134,11 @@ pub trait FromBuilder: Sized { fn from_builder(builder: Self::Builder<'_>) -> Result; } -pub trait BackedState: for<'a> FromBuilder = StateBuilder, Error = Infallible> { +pub trait BackedState: + Serialize + + for<'a> Deserialize<'a> + + for<'a> FromBuilder = StateBuilder, Error = Infallible> +{ fn num_batch(&self) -> usize; fn num_layer(&self) -> usize; diff --git a/src/model/v4.rs b/src/model/v4.rs index 266e891..61587e3 100644 --- a/src/model/v4.rs +++ b/src/model/v4.rs @@ -341,7 +341,7 @@ impl super::ModelState for ModelState { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct BackedState { pub shape: Shape, pub data: Vec, diff --git a/src/model/v5.rs b/src/model/v5.rs index 8e9887b..c81495f 100644 --- a/src/model/v5.rs +++ b/src/model/v5.rs @@ -400,7 +400,7 @@ impl super::ModelState for ModelState { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct BackedState { pub num_batch: usize, pub chunk_size: usize, diff --git a/src/model/v6.rs b/src/model/v6.rs index 18751ff..6bd7961 100644 --- a/src/model/v6.rs +++ b/src/model/v6.rs @@ -441,7 +441,7 @@ impl super::ModelState for ModelState { } } -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Serialize, Deserialize)] pub struct BackedState { pub num_batch: usize, pub chunk_size: usize,