-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add benchmark inference_tract * Fix build for mobile_net_v2_onnx Wasm and update tensorflow Wasm file * Embedded the tensorflow model into the Wasm binary * Update readme to reflect new inferencing benchmarks * Update for pr comments
- Loading branch information
Showing
36 changed files
with
5,142 additions
and
28 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
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
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
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,3 +1,3 @@ | ||
# Benchmarks | ||
|
||
The set of benchmarks here have been copied from [Sightglass](https://github.com/bytecodealliance/sightglass/benchmarks). In general, the benchmarks here and will mostly be consistent with the set of benchmarks in that repository. | ||
The set of benchmarks here have been copied from [Sightglass](https://github.com/bytecodealliance/sightglass/benchmarks). The benchmarks here and will mostly be consistent with the set of benchmarks in that repository. |
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
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
Binary file modified
BIN
-101 KB
(96%)
benchmarks/image-classification/image-classification-benchmark.wasm
Binary file not shown.
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,23 @@ | ||
FROM rust:1.78 AS builder | ||
RUN rustup target add wasm32-wasi | ||
RUN mkdir /benchmark | ||
WORKDIR /usr/src | ||
|
||
# Compile mobile_net_v2_onnx | ||
ADD mobile_net_v2_onnx rust-benchmark | ||
WORKDIR /usr/src/rust-benchmark | ||
ENV CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse | ||
RUN (cd mobile_net_v2_onnx; cargo build --release --target wasm32-wasi) | ||
RUN cp target/wasm32-wasi/release/*benchmark.wasm /benchmark/mobile_net_v2_onnx_benchmark.wasm | ||
WORKDIR /usr/src | ||
RUN rm -rf rust-benchmark | ||
|
||
|
||
# Compile mobile_net_v2_tensorflow | ||
ADD mobile_net_v2_tensorflow rust-benchmark | ||
WORKDIR /usr/src/rust-benchmark | ||
RUN (cd mobile_net_v2_tensorflow; cargo build --release --target wasm32-wasi) | ||
RUN cp target/wasm32-wasi/release/*benchmark.wasm /benchmark/mobile_net_v2_tensorflow_benchmark.wasm | ||
RUN cp assets/mobilenet_v2_1.4_224_frozen.pb /benchmark/mobilenet_v2_1.4_224_frozen.pb | ||
WORKDIR /usr/src | ||
RUN rm -rf rust-benchmark |
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,7 @@ | ||
# Image Classification Wasmtime Benchmark | ||
|
||
A benchmark that runs an image classifier in pure Wasm. This can be used to | ||
benchmark the performance of float heavy computations. | ||
|
||
Note that the classifier model is not included in the repo because it is large | ||
and is instead downloaded if needed when running the `setup.sh` script. |
13 changes: 13 additions & 0 deletions
13
benchmarks/inference_tract/build_mobile_net_v2_onnx_native.sh
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Build inference_tract benchmark as a native shared library (Linux-only). | ||
# | ||
# Usage: ./build_mobile_net_v2_onnx_native.sh | ||
|
||
(set -x;) | ||
(rm -rf mobile_net_v2_onnx_native); | ||
(cp -r mobile_net_v2_onnx mobile_net_v2_onnx_native); | ||
(cp mobile_net_v2_onnx_native.patch mobile_net_v2_onnx_native); | ||
(cd mobile_net_v2_onnx_native; patch -Np1 -i ./mobile_net_v2_onnx_native.patch; mv src/main.rs src/lib.rs; cd -); | ||
(cd mobile_net_v2_onnx_native; cargo build --release; cp target/release/libbenchmark.so ../mobile_net_v2_onnx_benchmark.so; cd -); | ||
(set +x;) |
13 changes: 13 additions & 0 deletions
13
benchmarks/inference_tract/build_mobile_net_v2_tensorflow_native.sh
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 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Build inference_tract benchmark as native shared library (Linux-only). | ||
# | ||
# Usage: ./build_mobile_net_v2_tensorflow_native.sh | ||
|
||
(set -x;) | ||
(rm -rf mobile_net_v2_tensorflow_native); | ||
(cp -r mobile_net_v2_tensorflow mobile_net_v2_tensorflow_native); | ||
(cp mobile_net_v2_tensorflow_native.patch mobile_net_v2_tensorflow_native); | ||
(cd mobile_net_v2_tensorflow_native; patch -Np1 -i ./mobile_net_v2_tensorflow_native.patch; mv src/main.rs src/lib.rs; cd -); | ||
(cd mobile_net_v2_tensorflow_native; cargo build --release; cp target/release/libbenchmark.so ../mobile_net_v2_tensorflow_benchmark.so; cd -); | ||
(set +x;) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.