kylä lähtee!
This commit is contained in:
@@ -26,9 +26,9 @@ web-sys = { version = "0.3.68", features = [
|
||||
] }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
burn = { version = "0.14.0", features = ["wgpu", "ndarray"] }
|
||||
burn-wgpu = "0.14.0"
|
||||
burn-ndarray = "0.14.0"
|
||||
burn = { version = "0.21.0-pre.2", default-features = false, features = ["wgpu", "ndarray"] }
|
||||
burn-wgpu = "0.21.0-pre.2"
|
||||
burn-ndarray = "0.21.0-pre.2"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
console_error_panic_hook = "0.1.7"
|
||||
reqwest = { version = "0.12", default-features = false, features = ["json"] }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use burn::tensor::{backend::Backend, Tensor, Data};
|
||||
use burn::tensor::{backend::Backend, Tensor, TensorData};
|
||||
use candle_core::safetensors;
|
||||
use candle_core::Device as CandleDevice;
|
||||
use burn::module::Param;
|
||||
|
||||
@@ -120,11 +120,10 @@ pub async fn run_smollm_inference(prompt: String, ws: Rc<RefCell<WebSocket>>) {
|
||||
|
||||
let use_gpu = crate::HAS_WEBGPU.load(std::sync::atomic::Ordering::SeqCst);
|
||||
if use_gpu {
|
||||
console_log!("[SmolLM] Alustetaan Burn WebGPU...");
|
||||
burn_wgpu::init_async::<burn_wgpu::AutoGraphicsApi>(&Default::default(), Default::default()).await;
|
||||
console_log!("[SmolLM] Burn WebGPU inferenssi...");
|
||||
run_burn_inference::<burn::backend::Wgpu>(prompt, model_bytes, tokenizer, ws, perf.clone()).await;
|
||||
} else {
|
||||
console_log!("[SmolLM] Käytetään CPU NdArrayta (vanha tapa)...");
|
||||
console_log!("[SmolLM] Burn NdArray (CPU) inferenssi...");
|
||||
run_burn_inference::<burn::backend::NdArray>(prompt, model_bytes, tokenizer, ws, perf.clone()).await;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user