From 4c5bcbeb7559cc506804196377d83a7026cb5b89 Mon Sep 17 00:00:00 2001 From: cryscan Date: Sat, 17 Aug 2024 19:00:27 +0800 Subject: [PATCH] Update dependencies. --- Cargo.toml | 12 ++++++------ crates/web-rwkv-derive/Cargo.toml | 2 +- crates/web-rwkv-derive/src/serde/bound.rs | 6 +++--- crates/web-rwkv-derive/src/serde/internals/attr.rs | 3 +-- .../web-rwkv-derive/src/serde/internals/receiver.rs | 8 ++++---- examples/batch.rs | 2 +- examples/rt-batch.rs | 2 +- src/context.rs | 6 ++++-- src/model/mod.rs | 1 + 9 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 875fec9..9b7378d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,13 +9,13 @@ keywords = ["deep-learning", "language", "model", "rwkv"] license = "MIT OR Apache-2.0" name = "web-rwkv" repository = "https://github.com/cryscan/web-rwkv" -version = "0.8.17" +version = "0.8.18" [dependencies] ahash = "0.8" anyhow = "1.0" bytemuck = { version = "1.13", features = ["extern_crate_alloc"] } -derive-getters = "0.4" +derive-getters = "0.5" document-features = "0.2.8" flume = "0.11.0" futures = "0.3" @@ -37,11 +37,11 @@ tracing-tracy = { version = "0.11.0", optional = true } trait-variant = "0.1" uid = "0.1" wasm-bindgen = "0.2" -wgpu = "0.20.1" +wgpu = "22.1.0" [dependencies.web-rwkv-derive] path = "crates/web-rwkv-derive" -version = "0.2.4" +version = "0.2.5" [dependencies.tokio] default-features = false @@ -55,10 +55,10 @@ memmap2 = "0.9" tokio = { version = "1.37", features = ["full"] } # wgpu-profiler = "0.14.1" clap = { version = "4.3", features = ["derive"] } -crossterm = "0.27" +crossterm = "0.28" dialoguer = "0.11.0" pollster = "0.3.0" -ratatui = { version = "0.26", features = ["all-widgets"] } +ratatui = { version = "0.28", features = ["all-widgets"] } simple_logger = { version = "5.0.0", features = ["stderr"] } [features] diff --git a/crates/web-rwkv-derive/Cargo.toml b/crates/web-rwkv-derive/Cargo.toml index 5b85268..73d868b 100644 --- a/crates/web-rwkv-derive/Cargo.toml +++ b/crates/web-rwkv-derive/Cargo.toml @@ -8,7 +8,7 @@ keywords = ["deep-learning", "language", "model", "rwkv"] license = "MIT OR Apache-2.0" name = "web-rwkv-derive" repository = "https://github.com/cryscan/web-rwkv" -version = "0.2.4" +version = "0.2.5" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/crates/web-rwkv-derive/src/serde/bound.rs b/crates/web-rwkv-derive/src/serde/bound.rs index ddef6a1..4a6ea6d 100644 --- a/crates/web-rwkv-derive/src/serde/bound.rs +++ b/crates/web-rwkv-derive/src/serde/bound.rs @@ -144,7 +144,7 @@ pub fn with_bound( fn visit_type(&mut self, ty: &'ast syn::Type) { match ty { - #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] + #![cfg_attr(all(test), deny(non_exhaustive_omitted_patterns))] syn::Type::Array(ty) => self.visit_type(&ty.elem), syn::Type::BareFn(ty) => { for arg in &ty.inputs { @@ -196,7 +196,7 @@ pub fn with_bound( syn::PathArguments::AngleBracketed(arguments) => { for arg in &arguments.args { match arg { - #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] + #![cfg_attr(all(test), deny(non_exhaustive_omitted_patterns))] syn::GenericArgument::Type(arg) => self.visit_type(arg), syn::GenericArgument::AssocType(arg) => self.visit_type(&arg.ty), syn::GenericArgument::Lifetime(_) @@ -225,7 +225,7 @@ pub fn with_bound( fn visit_type_param_bound(&mut self, bound: &'ast syn::TypeParamBound) { match bound { - #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] + #![cfg_attr(all(test), deny(non_exhaustive_omitted_patterns))] syn::TypeParamBound::Trait(bound) => self.visit_path(&bound.path), syn::TypeParamBound::Lifetime(_) | syn::TypeParamBound::Verbatim(_) => {} _ => {} diff --git a/crates/web-rwkv-derive/src/serde/internals/attr.rs b/crates/web-rwkv-derive/src/serde/internals/attr.rs index 661def5..a04bad1 100644 --- a/crates/web-rwkv-derive/src/serde/internals/attr.rs +++ b/crates/web-rwkv-derive/src/serde/internals/attr.rs @@ -274,7 +274,6 @@ pub enum Identifier { } impl Identifier { - #[cfg(feature = "deserialize_in_place")] pub fn is_some(self) -> bool { match self { Identifier::No => false, @@ -1813,7 +1812,7 @@ fn borrowable_lifetimes( fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet) { match ty { - #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] + #![cfg_attr(all(test), deny(non_exhaustive_omitted_patterns))] syn::Type::Slice(ty) => { collect_lifetimes(&ty.elem, out); } diff --git a/crates/web-rwkv-derive/src/serde/internals/receiver.rs b/crates/web-rwkv-derive/src/serde/internals/receiver.rs index 4c84630..e5f4dec 100644 --- a/crates/web-rwkv-derive/src/serde/internals/receiver.rs +++ b/crates/web-rwkv-derive/src/serde/internals/receiver.rs @@ -107,7 +107,7 @@ impl ReplaceReceiver<'_> { fn visit_type_mut_impl(&mut self, ty: &mut Type) { match ty { - #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] + #![cfg_attr(all(test), deny(non_exhaustive_omitted_patterns))] Type::Array(ty) => { self.visit_type_mut(&mut ty.elem); self.visit_expr_mut(&mut ty.len); @@ -178,7 +178,7 @@ impl ReplaceReceiver<'_> { PathArguments::AngleBracketed(arguments) => { for arg in &mut arguments.args { match arg { - #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] + #![cfg_attr(all(test), deny(non_exhaustive_omitted_patterns))] GenericArgument::Type(arg) => self.visit_type_mut(arg), GenericArgument::AssocType(arg) => self.visit_type_mut(&mut arg.ty), GenericArgument::Lifetime(_) @@ -207,7 +207,7 @@ impl ReplaceReceiver<'_> { fn visit_type_param_bound_mut(&mut self, bound: &mut TypeParamBound) { match bound { - #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] + #![cfg_attr(all(test), deny(non_exhaustive_omitted_patterns))] TypeParamBound::Trait(bound) => self.visit_path_mut(&mut bound.path), TypeParamBound::Lifetime(_) | TypeParamBound::Verbatim(_) => {} _ => {} @@ -228,7 +228,7 @@ impl ReplaceReceiver<'_> { if let Some(where_clause) = &mut generics.where_clause { for predicate in &mut where_clause.predicates { match predicate { - #![cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))] + #![cfg_attr(all(test), deny(non_exhaustive_omitted_patterns))] WherePredicate::Type(predicate) => { self.visit_type_mut(&mut predicate.bounded_ty); for bound in &mut predicate.bounds { diff --git a/examples/batch.rs b/examples/batch.rs index 5bf7616..fdc12f3 100644 --- a/examples/batch.rs +++ b/examples/batch.rs @@ -269,7 +269,7 @@ where loop { #[cfg(not(debug_assertions))] terminal.draw(|frame| { - let size = frame.size(); + let size = frame.area(); let block = Block::default().black(); frame.render_widget(block, size); diff --git a/examples/rt-batch.rs b/examples/rt-batch.rs index 9325cbd..bf78474 100644 --- a/examples/rt-batch.rs +++ b/examples/rt-batch.rs @@ -247,7 +247,7 @@ async fn main() -> Result<()> { loop { #[cfg(not(debug_assertions))] terminal.draw(|frame| { - let size = frame.size(); + let size = frame.area(); let block = Block::default().black(); frame.render_widget(block, size); diff --git a/src/context.rs b/src/context.rs index 7f86f6b..4d4cdb1 100644 --- a/src/context.rs +++ b/src/context.rs @@ -8,8 +8,8 @@ use wgpu::{ util::{BufferInitDescriptor, DeviceExt}, Adapter, BindGroupLayout, BindGroupLayoutDescriptor, BindGroupLayoutEntry, Buffer, BufferDescriptor, BufferUsages, ComputePipeline, ComputePipelineDescriptor, Device, - DeviceDescriptor, Features, Instance, Limits, PipelineLayoutDescriptor, PowerPreference, Queue, - RequestAdapterOptions, ShaderModuleDescriptor, + DeviceDescriptor, Features, Instance, Limits, MemoryHints, PipelineLayoutDescriptor, + PowerPreference, Queue, RequestAdapterOptions, ShaderModuleDescriptor, }; use crate::tensor::{ @@ -118,6 +118,7 @@ impl<'a> ContextBuilder { label: None, required_features: features, required_limits: limits, + memory_hints: MemoryHints::Performance, }, None, ) @@ -286,6 +287,7 @@ impl ContextInternal { module, entry_point, compilation_options: Default::default(), + cache: None, }); let layout = pipeline.get_bind_group_layout(0); CachedPipeline { pipeline, layout } diff --git a/src/model/mod.rs b/src/model/mod.rs index 09d7d36..4391d75 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -300,6 +300,7 @@ impl ModelBuilder { /// Create a model state. /// - `num_batch`: The maximum number of runtime slots. /// - `chunk_size`: Internally, the state is split into chunks of layers, since there is a size limit on one GPU buffer (128 MB). +/// /// If there is only one batch, it is recommended to set `chunk_size` to `info.num_layers()`. pub struct StateBuilder { context: Context,