Skip to content

Commit

Permalink
Fix initial state loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
cryscan committed Jun 21, 2024
1 parent 34da710 commit 743ce02
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
26 changes: 16 additions & 10 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ path = "crates/ai00-core"
# path = "../web-rwkv"
default-features = false
features = ["native"]
version = "0.8.15"
version = "0.8.16"

[profile.release]
lto = false
10 changes: 3 additions & 7 deletions crates/ai00-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use web_rwkv::{
},
tensor::{serialization::Seed, TensorCpu},
tokenizer::Tokenizer,
wgpu::{Backends, Maintain, PowerPreference},
wgpu::{Backends, PowerPreference},
};

use crate::{
Expand Down Expand Up @@ -541,12 +541,10 @@ pub async fn model_route(receiver: Receiver<ThreadRequest>) -> Result<()> {
// drop(mem::take(&mut *env));
'unload: {
let env = std::mem::take(&mut *env);
let context = match env {
let _context = match env {
Environment::Loaded(runtime) => runtime.context().clone(),
Environment::None => break 'unload,
};
context.queue.submit(None);
context.device.poll(Maintain::Wait);
}

let runtime = load_runtime(&context, &request, info, load).await?;
Expand Down Expand Up @@ -580,12 +578,10 @@ pub async fn model_route(receiver: Receiver<ThreadRequest>) -> Result<()> {
let env = std::mem::take(&mut *env);
log::info!("runtime unloaded");

let context = match env {
let _context = match env {
Environment::Loaded(runtime) => runtime.context().clone(),
Environment::None => return,
};
context.queue.submit(None);
context.device.poll(Maintain::Wait);
});
}
ThreadRequest::StateLoad { request, sender } => {
Expand Down

0 comments on commit 743ce02

Please sign in to comment.