mirror of https://github.com/tracel-ai/burn.git
Fix wasm examples (#1824)
This commit is contained in:
parent
e61b026918
commit
912ffb4a81
|
@ -64,7 +64,6 @@ rusqlite = { version = "0.31.0" }
|
|||
rust-format = { version = "0.3.4" }
|
||||
sanitize-filename = "0.5.0"
|
||||
serde_rusqlite = "0.35.0"
|
||||
serde-wasm-bindgen = "0.6.5"
|
||||
spin = { version = "0.9.8", features = ["mutex", "spin_mutex"] }
|
||||
strum = "0.26.2"
|
||||
strum_macros = "0.26.2"
|
||||
|
@ -75,10 +74,6 @@ tokio = { version = "1.37.0", features = ["rt", "macros"] }
|
|||
tracing-appender = "0.2.3"
|
||||
tracing-core = "0.1.32"
|
||||
tracing-subscriber = "0.3.18"
|
||||
wasm-bindgen = "0.2.92"
|
||||
wasm-bindgen-futures = "0.4.42"
|
||||
wasm-logger = "0.2.0"
|
||||
wasm-timer = "0.2.5"
|
||||
md5 = "0.7.0"
|
||||
serial_test = "3.1.1"
|
||||
web-time = "1.1.0"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
authors = ["Dilshod Tadjibaev (@antimora)"]
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
license = "MIT OR Apache-2.0"
|
||||
name = "image-classification-web"
|
||||
publish = false
|
||||
version.workspace = true
|
||||
|
@ -20,17 +20,19 @@ burn = { path = "../../crates/burn", version = "0.15.0", default-features = fals
|
|||
burn-wgpu = { path = "../../crates/burn-wgpu", version = "0.15.0", default-features = false }
|
||||
burn-candle = { path = "../../crates/burn-candle", version = "0.15.0", default-features = false }
|
||||
|
||||
js-sys = { workspace = true }
|
||||
log = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
serde_json = { workspace = true }
|
||||
serde-wasm-bindgen = { workspace = true }
|
||||
wasm-bindgen = { workspace = true }
|
||||
wasm-bindgen-futures = { workspace = true }
|
||||
wasm-logger = { workspace = true }
|
||||
wasm-timer = { workspace = true }
|
||||
console_error_panic_hook = { workspace = true }
|
||||
|
||||
# Wasm dependencies
|
||||
wasm-bindgen = "0.2"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
serde-wasm-bindgen = "0.6"
|
||||
wasm-logger = "0.2"
|
||||
wasm-timer = "0.2"
|
||||
js-sys = "0.3"
|
||||
|
||||
[build-dependencies]
|
||||
# Used to generate code from ONNX model
|
||||
burn-import = { path = "../../crates/burn-import" }
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
authors = ["Dilshod Tadjibaev (@antimora)"]
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
license = "MIT OR Apache-2.0"
|
||||
name = "mnist-inference-web"
|
||||
publish = false
|
||||
version.workspace = true
|
||||
|
@ -18,10 +18,12 @@ wgpu = ["burn/wgpu"]
|
|||
[dependencies]
|
||||
burn = { path = "../../crates/burn", default-features = false }
|
||||
serde = { workspace = true }
|
||||
wasm-bindgen = { workspace = true }
|
||||
wasm-bindgen-futures = { workspace = true }
|
||||
js-sys = { workspace = true }
|
||||
console_error_panic_hook = { workspace = true }
|
||||
|
||||
# Wasm dependencies
|
||||
wasm-bindgen = "0.2"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
js-sys = "0.3"
|
||||
|
||||
[dev-dependencies]
|
||||
pollster = { workspace = true }
|
||||
|
|
Binary file not shown.
|
@ -5,7 +5,7 @@ use burn::{
|
|||
};
|
||||
|
||||
#[cfg(feature = "wgpu")]
|
||||
use burn::backend::wgpu::{compute::init_async, AutoGraphicsApi, Wgpu, WgpuDevice};
|
||||
use burn::backend::wgpu::{init_async, AutoGraphicsApi, Wgpu, WgpuDevice};
|
||||
|
||||
#[cfg(feature = "wgpu")]
|
||||
pub type Backend = Wgpu<AutoGraphicsApi, f32, i32>;
|
||||
|
@ -18,7 +18,7 @@ static STATE_ENCODED: &[u8] = include_bytes!("../model.bin");
|
|||
/// Builds and loads trained parameters into the model.
|
||||
pub async fn build_and_load_model() -> Model<Backend> {
|
||||
#[cfg(feature = "wgpu")]
|
||||
init_async::<AutoGraphicsApi>(&WgpuDevice::default()).await;
|
||||
init_async::<AutoGraphicsApi>(&WgpuDevice::default(), Default::default()).await;
|
||||
|
||||
let model: Model<Backend> = Model::new(&Default::default());
|
||||
let record = BinBytesRecorder::<FullPrecisionSettings>::default()
|
||||
|
|
Loading…
Reference in New Issue