-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate the wasi_nn_burn plugin into this repository
Signed-off-by: vincent <vincent@secondstate.io>
- Loading branch information
1 parent
33e50e1
commit 67dc9ea
Showing
10 changed files
with
608 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[workspace] | ||
members = [ | ||
"crates/wasi_nn_burnrs", | ||
] | ||
resolver = "2" | ||
|
||
[workspace.package] | ||
edition = "2021" | ||
version = "0.4.0" | ||
license = "Apache-2.0" | ||
readme = "README.md" | ||
repository = "https://github.com/WasmEdge/rust-plugins" | ||
homepage = "https://github.com/WasmEdge/rust-plugins" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# rust-plugins | ||
WasmEdge Rust Plugins | ||
|
||
- crates/wasi_nn_burnrs | ||
A plugin compatible with the wasi_nn proposal, using burn.rs framework as the backend. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
[package] | ||
name = "wasi_nn_burnrs" | ||
version = "0.0.1" | ||
edition = "2021" | ||
|
||
[lib] | ||
name = "wasmedgePluginWasiNN" | ||
path = "src/lib.rs" | ||
crate-type = ["cdylib"] | ||
|
||
[features] | ||
default = [] | ||
squeezenet = ["squeezenet-burn"] | ||
whisper = ["whisper-burn", "strum", "strum_macros"] | ||
|
||
[dependencies.squeezenet-burn] | ||
package = "squeezenet-burn" | ||
branch = "prebuilt-feature" | ||
git = "https://github.com/second-state/burn-rs-models.git" | ||
features = ["weights_file"] | ||
default-features = false | ||
optional = true | ||
|
||
[dependencies.whisper-burn] | ||
package = "whisper" | ||
branch = "dev" | ||
git = "https://github.com/second-state/burn-rs-whisper.git" | ||
optional = true | ||
|
||
[dependencies] | ||
burn = { version = "0.13.2", features = ["ndarray", "wgpu"] } | ||
wasmedge_plugin_sdk = { git = "https://github.com/second-state/wasmedge_plugin_rust_sdk.git", features = ["standalone"] } | ||
wasmedge-wasi-nn = "0.8.0" | ||
lazy_static = "1.4.0" | ||
bytemuck = "1.16.0" | ||
cfg-if = "1.0.0" | ||
strum = { version = "0.25.0", optional = true } | ||
strum_macros = { version = "0.25.0", optional = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# WASI NN Burn | ||
|
||
A plugin compatible with the wasi_nn proposal, using burn.rs framework as the backend. | ||
|
||
Currently, two models have been integrated: SqueezeNet and Whisper. | ||
|
||
The command to compile the plugin is as follows. | ||
|
||
```bash | ||
cargo build --features=squeezenet -p wasi_nn_burnrs | ||
|
||
or | ||
|
||
cargo build --features=whisper -p wasi_nn_burnrs | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#[macro_export] | ||
macro_rules! get_slice { | ||
($memory:expr, $ptr:expr, $length:expr, $ty:ty) => {{ | ||
let raw_bytes = $memory | ||
.data_pointer($ptr as usize, $length as usize) | ||
.expect("Failed to get data pointer"); | ||
bytemuck::cast_slice::<u8, $ty>(raw_bytes) | ||
}}; | ||
} | ||
|
||
pub use get_slice; |
Oops, something went wrong.