Skip to content

Commit

Permalink
Finally test runner working
Browse files Browse the repository at this point in the history
  • Loading branch information
sigma-andex committed Jan 7, 2024
1 parent 49b4010 commit 2078bd5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ js-sys = "0.3.64"
wasm-bindgen-futures = "0.4.39"
anyhow = "1.0"
gloo = "0.11.0"
byteorder = { version = "1", default-features = false }

[dependencies.web-sys]
features = [
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
Download chromedriver from https://googlechromelabs.github.io/chrome-for-testing/#stable

```bash
wasm-pack test --chrome --chromedriver "$(which chromedriver)" --headless
RUST_LOG=wasm_bindgen_test_runner wasm-pack test --chrome --chromedriver "$(which chromedriver)" --headless
```
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"scripts": {
"build": "wasm-pack build -s text-yoga --dev",
"build:release": "wasm-pack build -s text-yoga --release",
"test:server": "npx http-server --cors -p 45678 ./tests/data",
"test": "wasm-pack test --chrome --chromedriver \"$(which chromedriver)\" --headless"
"test:server": "npx http-server --cors -p 31300 ./tests/data",
"test:chrome": "wasm-pack test --chrome --chromedriver \"$(which chromedriver)\" --headless",
"test:gecko": "wasm-pack test --firefox --geckodriver \"$(which geckodriver)\" --headless"
},
"keywords": [],
"author": "",
Expand Down
6 changes: 5 additions & 1 deletion src/quantized_mistral.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,12 @@ impl Model {
let mut total_size_in_bytes = 0;
for (_, tensor) in model.tensor_infos.iter() {
let elem_count = tensor.shape.elem_count();
log!("elem_count", elem_count);
log!("type_size", tensor.ggml_dtype.type_size());
log!("blck_size", tensor.ggml_dtype.blck_size());
total_size_in_bytes +=
elem_count * tensor.ggml_dtype.type_size() / tensor.ggml_dtype.blck_size();
// Very important to keep the parenthesis here, otherwise might overflow (in test).
elem_count * (tensor.ggml_dtype.type_size() / tensor.ggml_dtype.blck_size());
}
log!(format!(
"loaded {:?} tensors ({}) in {:.2}s",
Expand Down
4 changes: 2 additions & 2 deletions tests/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ wasm_bindgen_test_configure!(run_in_browser);

#[wasm_bindgen_test]
async fn pass() -> Result<(), JsValue> {
let tokenizer_url = "http://localhost:45678/tokenizer.json";
let model_url = "http://localhost:45678/tinymistral-248m.q4_k_m.gguf";
let tokenizer_url = "http://localhost:31300/tokenizer.json";
let model_url = "http://localhost:31300/tinymistral-248m.q4_k_m.gguf";

let tokenizer_blob: Vec<u8> = utils::load_binary(&tokenizer_url).await?;
let tokenizer_blob_len = format!("{}", &tokenizer_blob.len());
Expand Down

0 comments on commit 2078bd5

Please sign in to comment.