Skip to content

Commit 56c4f0e

Browse files
committed
Refactor Dockerfile and update .dockerignore for wasi-nn tests; adjust map-dir parameters in smoke test script
1 parent 5d8fe5d commit 56c4f0e

File tree

3 files changed

+38
-36
lines changed

3 files changed

+38
-36
lines changed

.dockerignore

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
# for now, it is used to speed up wasi-nn tests only.
22
# you shall adapt below rules to incoming requirements
33

4-
build
5-
*/build
6-
*/*/build
7-
*/*/*/build
8-
*/*/*/*/build
9-
*/*/*/*/*/build
10-
*/*/*/*/*/*/build
4+
**/build
5+
**/tmp.*
116
.*
7+
**/*.gguf
128

13-
core/deps
14-
!core/deps/tensorflow-src
15-
samples
16-
tests
9+
/core/deps/
10+
!/core/deps/tensorflow-src
11+
/samples
12+
/tests

core/iwasm/libraries/wasi-nn/test/Dockerfile.wasi-nn-smoke

+27-21
Original file line numberDiff line numberDiff line change
@@ -30,53 +30,58 @@ RUN apt-get update \
3030
&& apt-get upgrade -y \
3131
&& apt-get install --no-install-recommends -y openvino-2023.2.0
3232

33+
# Activate after upgrading to wasi-nn 0.7.0
34+
# #
35+
# # wasi-nn
36+
# # compilation requirements
37+
# WORKDIR /workspaces/wasi-nn
38+
# RUN git clone https://github.com/bytecodealliance/wasi-nn.git . \
39+
# # update new wasmtime's cli (#100). Apr 27, 2024
40+
# && git checkout 556890b121dd1171665d835aba4d04a7e29e37dc
3341
#
34-
# wasi-nn
35-
# compilation requirements
36-
WORKDIR /workspaces/wasi-nn
37-
RUN git clone --depth 1 https://github.com/bytecodealliance/wasi-nn.git .
38-
39-
WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/
40-
RUN cargo build --target=wasm32-wasip1
41-
42-
WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/build
43-
RUN cp ../target/wasm32-wasip1/debug/wasi-nn-example.wasm . \
44-
&& wget -q --no-clobber https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet/mobilenet.xml \
45-
&& wget -q --no-clobber https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet/mobilenet.bin
46-
# There are model files(mobilenet*) and wasm files(wasi-nn-example.wasm) in the directory,
47-
# /workspaces/wasi-nn/rust/examples/classification-example/build
42+
# WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/
43+
# RUN cargo build --target=wasm32-wasip1
44+
#
45+
# ARG FIXTURE=https://download.01.org/openvinotoolkit/fixtures/mobilenet
46+
# RUN cp target/wasm32-wasip1/debug/wasi-nn-example.wasm . \
47+
# && wget -q --no-clobber $FIXTURE/mobilenet.xml \
48+
# && wget -q --no-clobber $FIXTURE/mobilenet.bin
49+
# # There are model files(mobilenet*) and wasm files(wasi-nn-example.wasm) in the directory,
4850

4951
#
5052
# wasmedge
5153
WORKDIR /tmp
5254
RUN wget -q https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh \
5355
&& chmod a+x ./install.sh
5456
# RUN ./install.sh -p /opt/wasmedge --plugins wasi_nn-tensorflowlite wasi_nn-openvino
55-
RUN ./install.sh -r yes -D -p /opt/wasmedge --plugins wasi_nn-openvino --dist ubuntu20.04 \
57+
RUN ./install.sh -r yes -D -p /opt/wasmedge --plugins wasi_nn-openvino --dist ubuntu20.04 -v 0.14.0 \
5658
&& /opt/wasmedge/bin/wasmedge --version
5759
ENV PATH=/opt/wasmedge/bin:${PATH}
5860
# ENV WASMEDGE_LIB_DIR=/opt/wasmedge/lib
5961

6062
#
6163
# wasmedge-wasinn-examples
64+
# based on wasi-nn 0.6.0
6265
WORKDIR /workspaces/wasmedge-wasinn-examples
6366
RUN git clone --depth 1 https://github.com/second-state/WasmEdge-WASINN-examples.git .
64-
COPY core/iwasm/libraries/wasi-nn/test/bump_wasi_nn_to_0_6_0.patch .
65-
RUN git apply ./bump_wasi_nn_to_0_6_0.patch
6667

67-
# recompile with wasi-nn 0.6.0
68+
# recompile with debug info
69+
ARG FIXTURE=https://download.01.org/openvinotoolkit/fixtures/mobilenet
6870
WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-image/
6971
RUN pushd rust \
7072
&& cargo build --target=wasm32-wasip1 \
7173
&& popd \
72-
&& ./download_mobilenet.sh . \
74+
&& wget -q --no-clobber $FIXTURE/mobilenet.xml \
75+
&& wget -q --no-clobber $FIXTURE/mobilenet.bin \
7376
&& ls -l mobilenet.xml mobilenet.bin
7477

7578
WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-raw/
7679
RUN pushd rust \
7780
&& cargo build --target=wasm32-wasip1 \
7881
&& popd \
79-
&& ./download_mobilenet.sh . \
82+
&& wget -q --no-clobber $FIXTURE/mobilenet.xml \
83+
&& wget -q --no-clobber $FIXTURE/mobilenet.bin \
84+
&& wget -q --no-clobber $FIXTURE/tensor-1x224x224x3-f32.bgr \
8085
&& ls -l mobilenet.xml mobilenet.bin tensor-1x224x224x3-f32.bgr
8186

8287
WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-road-segmentation-adas/
@@ -91,7 +96,7 @@ RUN pushd rust \
9196
WORKDIR /workspaces/wasmedge-wasinn-examples/wasmedge-ggml/qwen
9297
RUN wget --progress=dot:giga https://www.modelscope.cn/models/qwen/Qwen1.5-0.5B-Chat-GGUF/resolve/master/qwen1_5-0_5b-chat-q2_k.gguf
9398
RUN cargo build --target=wasm32-wasip1
94-
99+
#
95100
#
96101
# iwasm. build from source
97102
WORKDIR /workspaces/wamr
@@ -110,6 +115,7 @@ RUN OpenVINO_DIR=/usr/lib/openvino-2023.2.0 \
110115

111116
ENV LD_LIBRARY_PATH=/usr/local/lib
112117

118+
113119
# add smoke test script
114120
COPY core/iwasm/libraries/wasi-nn/test/run_smoke_test.py /
115121

core/iwasm/libraries/wasi-nn/test/run_smoke_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def execute_tflite_birds_v1_image(iwasm_bin: str, wasmedge_bin: str, cwd: Path):
163163
iwasm_output = execute_tflite_birds_v1_image_once(
164164
iwasm_bin,
165165
[
166-
"--map-dir=.:.",
166+
"--map-dir=.::.",
167167
],
168168
cwd,
169169
)
@@ -181,7 +181,7 @@ def execute_openvino_mobilenet_image(iwasm_bin: str, wasmedge_bin: str, cwd: Pat
181181
iwasm_output = execute_openvino_mobilenet_image_once(
182182
iwasm_bin,
183183
[
184-
"--map-dir=.:.",
184+
"--map-dir=.::.",
185185
],
186186
cwd,
187187
)
@@ -199,7 +199,7 @@ def execute_openvino_mobilenet_raw(iwasm_bin: str, wasmedge_bin: str, cwd: Path)
199199
iwasm_output = execute_openvino_mobilenet_raw_once(
200200
iwasm_bin,
201201
[
202-
"--map-dir=.:.",
202+
"--map-dir=.::.",
203203
],
204204
cwd,
205205
)
@@ -236,7 +236,7 @@ def filter_output(output: str) -> str:
236236
iwasm_output = execute_openvino_road_segmentation_adas_once(
237237
iwasm_bin,
238238
[
239-
"--map-dir=.:.",
239+
"--map-dir=.::.",
240240
],
241241
cwd,
242242
)

0 commit comments

Comments
 (0)