WasmEdge / wasmedge-rust-sdk

Embed WasmEdge functions in a Rust host app
Apache License 2.0
29 stars 15 forks source link

Leaky abstraction about preload function #79

Closed CaptainVincent closed 11 months ago

CaptainVincent commented 11 months ago

In the current implementation, the order of nn_preload models should occur after loading wasi_nn plugin and before triggering the registration of wasi_nn plugin (At the very least, under the auto-detect plugin mechanism, these are two distinct time points).

This call sequence is not make sense to the end user of the API, but they must be aware of this order; otherwise, it will fail. Perhaps we can consider a similar approach to WASMEDGE_PLUGIN_PATH ex. WASMEDGE_WASINN_PRELOAD, allowing the SDK to manage the timing of calling preload.

Additionally, at the SDK layer crate, I think we need a helper function to parse a string pattern into enums (backend, target). This function would be useful for setting up models without user set model by code, as users often need to provide configuration through string as inputs.

apepkuss commented 11 months ago