Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wasi-nn example in Async mode #9

Open
alanpoon opened this issue Nov 23, 2023 · 4 comments
Open

Wasi-nn example in Async mode #9

alanpoon opened this issue Nov 23, 2023 · 4 comments

Comments

@alanpoon
Copy link

Is there async mode example for wasi-nn? I am unable to add wasi-nn plugin to wasmedge_sdk async WasiCtx.

@juntao
Copy link
Member

juntao commented Nov 23, 2023

Perhaps you could try our new SDK api here? It fixes a number of potential async issues.

WasmEdge/wasmedge-rust-sdk#83

@alanpoon
Copy link
Author

alanpoon commented Nov 24, 2023

I tried.

let module = Module::from_file(Some(&config), wasm_file)?;
    PluginManager::load(None)?;
    PluginManager::nn_preload(vec![NNPreload::from_str("default:GGML:AUTO:tinyllama-1.1b-chat-v0.3.Q5_K_M.gguf").unwrap()]);
    let nn = PluginManager::load_plugin_wasi_nn()?;
    
    let mut instance_map = HashMap::new();
    instance_map.insert(wasi_module.name().to_string(), wasi_module.as_mut());

nn is the wasmedge_sys::instance, while instance_map's value is of type AsyncImportObject.

I am supposed to add "nn" into the hashMap.
How do I convert the type wasmedge_sys::Instance into AsynImportObject?

@hydai
Copy link
Member

hydai commented Dec 10, 2023

@apepkuss
Is it possible to use any plugin in the async wasi?
It looks like the Instance and AsyncImportObject are totally different objects.
If so, could we have an example to use AysnWASI with a normal plugin?

@apepkuss
Copy link
Member

@hydai As I know, the current implementation of async-wasi does not have a relevant design for supporting plugins.

@L-jasmine Could you please check if the async-wasi could provide support for our plugins, like wasi-nn plugin? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants