From 9124f4b9559040f844d8d8f5b5e2930d1292243a Mon Sep 17 00:00:00 2001 From: Masatoshi Hidaka Date: Sun, 1 Dec 2024 12:36:36 +0900 Subject: [PATCH 1/2] add requriments for development --- README.ja.md | 1 + README.md | 1 + requirements.test.txt | 4 ++++ 3 files changed, 6 insertions(+) create mode 100644 requirements.test.txt diff --git a/README.ja.md b/README.ja.md index 5e92fe0b..be81b36f 100644 --- a/README.ja.md +++ b/README.ja.md @@ -57,6 +57,7 @@ console.log(outputTensor.data); // Float32Array テスト対象のONNXモデルおよび、入出力テンソルの生成 ``` +pip install -r requirements.test.txt python test/model_test/make_models.py ``` diff --git a/README.md b/README.md index ce040ebe..ce4a1ca3 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,7 @@ See `example/minimum` for the complete minimal code that works. Generate ONNX models and input/output tensors to be tested ``` +pip install -r requirements.test.txt python test/model_test/make_models.py ``` diff --git a/requirements.test.txt b/requirements.test.txt new file mode 100644 index 00000000..538051c0 --- /dev/null +++ b/requirements.test.txt @@ -0,0 +1,4 @@ +onnx +onnxruntime +torch +torchvision From 67aaac3115167fa775eff271683568029a128c28 Mon Sep 17 00:00:00 2001 From: Masatoshi Hidaka Date: Sun, 1 Dec 2024 12:37:27 +0900 Subject: [PATCH 2/2] fix string literal escape which is needed for processing output of latest emscripten --- src/shader/wasm/compile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shader/wasm/compile.py b/src/shader/wasm/compile.py index 1ddface1..b4c3a8bf 100644 --- a/src/shader/wasm/compile.py +++ b/src/shader/wasm/compile.py @@ -37,7 +37,7 @@ worker_js = f.read() worker_js_with_wasm = worker_js.replace("WASM_WORKER_WASM_BINARY_BASE64", base64.b64encode(worker_wasm).decode("ascii")) -worker_js_with_wasm_escaped = worker_js_with_wasm.replace("\\", "\\\\").replace("`", "\\`") +worker_js_with_wasm_escaped = worker_js_with_wasm.replace("\\", "\\\\").replace("`", "\\`").replace("$", "\\$") worker_data_url_src = f"""/* eslint-disable */ export const wasmWorkerSrcUrl = URL.createObjectURL(new File([`{worker_js_with_wasm_escaped}`], "worker.js", {{type: "text/javascript"}}));