Skip to content

Commit

Permalink
backend: update wasm & use wasi_logger
Browse files Browse the repository at this point in the history
  • Loading branch information
L-jasmine committed Dec 14, 2024
1 parent 69a90d9 commit c9c42f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions moly-backend/src/backend_impls/api_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ pub fn run_wasm_by_downloaded_file(
let mut wasi_nn = wasmedge_sdk::plugin::PluginManager::load_plugin_wasi_nn().unwrap();
instances.insert(wasi_nn.name().unwrap(), &mut wasi_nn);

let mut wasi_logger = wasmedge_sdk::plugin::PluginManager::create_plugin_instance(
"wasi_logging",
"wasi:logging/logging",
)
.unwrap();
instances.insert(wasi_logger.name().unwrap(), &mut wasi_logger);

let store = Store::new(None, instances).unwrap();
let mut vm = Vm::new(store);
vm.register_module(None, wasm_module.clone()).unwrap();
Expand Down Expand Up @@ -261,7 +268,7 @@ impl BackendModel for LLamaEdgeApiServer {
});

let mut test_server = false;
for _i in 0..5 {
for _i in 0..20 {
let r = reqwest::blocking::ClientBuilder::new()
.timeout(Duration::from_secs(3))
.no_proxy()
Expand All @@ -275,7 +282,7 @@ impl BackendModel for LLamaEdgeApiServer {
break;
}
}
let _ = std::thread::sleep(std::time::Duration::from_secs(1));
let _ = std::thread::sleep(std::time::Duration::from_secs(3));
}
if test_server {
let _ = tx.send(Ok(moly_protocol::protocol::LoadModelResponse::Completed(
Expand Down
Binary file modified moly-backend/wasm/llama-api-server.wasm
Binary file not shown.

0 comments on commit c9c42f5

Please sign in to comment.