mirror of
https://github.com/bytecodealliance/wasm-micro-runtime.git
synced 2025-05-07 04:06:16 +00:00
Refactor Dockerfile and update .dockerignore for wasi-nn tests; adjust map-dir parameters in smoke test script (#4158)
This commit is contained in:
parent
8245aefc77
commit
2a2632444b
|
@ -1,16 +1,12 @@
|
||||||
# for now, it is used to speed up wasi-nn tests only.
|
# for now, it is used to speed up wasi-nn tests only.
|
||||||
# you shall adapt below rules to incoming requirements
|
# you shall adapt below rules to incoming requirements
|
||||||
|
|
||||||
build
|
**/build
|
||||||
*/build
|
**/tmp.*
|
||||||
*/*/build
|
|
||||||
*/*/*/build
|
|
||||||
*/*/*/*/build
|
|
||||||
*/*/*/*/*/build
|
|
||||||
*/*/*/*/*/*/build
|
|
||||||
.*
|
.*
|
||||||
|
**/*.gguf
|
||||||
|
|
||||||
core/deps
|
/core/deps/
|
||||||
!core/deps/tensorflow-src
|
!/core/deps/tensorflow-src
|
||||||
samples
|
/samples
|
||||||
tests
|
/tests
|
||||||
|
|
|
@ -30,21 +30,23 @@ RUN apt-get update \
|
||||||
&& apt-get upgrade -y \
|
&& apt-get upgrade -y \
|
||||||
&& apt-get install --no-install-recommends -y openvino-2023.2.0
|
&& apt-get install --no-install-recommends -y openvino-2023.2.0
|
||||||
|
|
||||||
|
# Activate after upgrading to wasi-nn 0.7.0
|
||||||
|
# #
|
||||||
|
# # wasi-nn
|
||||||
|
# # compilation requirements
|
||||||
|
# WORKDIR /workspaces/wasi-nn
|
||||||
|
# RUN git clone https://github.com/bytecodealliance/wasi-nn.git . \
|
||||||
|
# # update new wasmtime's cli (#100). Apr 27, 2024
|
||||||
|
# && git checkout 556890b121dd1171665d835aba4d04a7e29e37dc
|
||||||
#
|
#
|
||||||
# wasi-nn
|
# WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/
|
||||||
# compilation requirements
|
# RUN cargo build --target=wasm32-wasip1
|
||||||
WORKDIR /workspaces/wasi-nn
|
#
|
||||||
RUN git clone --depth 1 https://github.com/bytecodealliance/wasi-nn.git .
|
# ARG FIXTURE=https://download.01.org/openvinotoolkit/fixtures/mobilenet
|
||||||
|
# RUN cp target/wasm32-wasip1/debug/wasi-nn-example.wasm . \
|
||||||
WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/
|
# && wget -q --no-clobber $FIXTURE/mobilenet.xml \
|
||||||
RUN cargo build --target=wasm32-wasip1
|
# && wget -q --no-clobber $FIXTURE/mobilenet.bin
|
||||||
|
# # There are model files(mobilenet*) and wasm files(wasi-nn-example.wasm) in the directory,
|
||||||
WORKDIR /workspaces/wasi-nn/rust/examples/classification-example/build
|
|
||||||
RUN cp ../target/wasm32-wasip1/debug/wasi-nn-example.wasm . \
|
|
||||||
&& wget -q --no-clobber https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet/mobilenet.xml \
|
|
||||||
&& wget -q --no-clobber https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet/mobilenet.bin
|
|
||||||
# There are model files(mobilenet*) and wasm files(wasi-nn-example.wasm) in the directory,
|
|
||||||
# /workspaces/wasi-nn/rust/examples/classification-example/build
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# wasmedge
|
# wasmedge
|
||||||
|
@ -52,31 +54,34 @@ WORKDIR /tmp
|
||||||
RUN wget -q https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh \
|
RUN wget -q https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh \
|
||||||
&& chmod a+x ./install.sh
|
&& chmod a+x ./install.sh
|
||||||
# RUN ./install.sh -p /opt/wasmedge --plugins wasi_nn-tensorflowlite wasi_nn-openvino
|
# RUN ./install.sh -p /opt/wasmedge --plugins wasi_nn-tensorflowlite wasi_nn-openvino
|
||||||
RUN ./install.sh -r yes -D -p /opt/wasmedge --plugins wasi_nn-openvino --dist ubuntu20.04 \
|
RUN ./install.sh -r yes -D -p /opt/wasmedge --plugins wasi_nn-openvino --dist ubuntu20.04 -v 0.14.0 \
|
||||||
&& /opt/wasmedge/bin/wasmedge --version
|
&& /opt/wasmedge/bin/wasmedge --version
|
||||||
ENV PATH=/opt/wasmedge/bin:${PATH}
|
ENV PATH=/opt/wasmedge/bin:${PATH}
|
||||||
# ENV WASMEDGE_LIB_DIR=/opt/wasmedge/lib
|
# ENV WASMEDGE_LIB_DIR=/opt/wasmedge/lib
|
||||||
|
|
||||||
#
|
#
|
||||||
# wasmedge-wasinn-examples
|
# wasmedge-wasinn-examples
|
||||||
|
# based on wasi-nn 0.6.0
|
||||||
WORKDIR /workspaces/wasmedge-wasinn-examples
|
WORKDIR /workspaces/wasmedge-wasinn-examples
|
||||||
RUN git clone --depth 1 https://github.com/second-state/WasmEdge-WASINN-examples.git .
|
RUN git clone --depth 1 https://github.com/second-state/WasmEdge-WASINN-examples.git .
|
||||||
COPY core/iwasm/libraries/wasi-nn/test/bump_wasi_nn_to_0_6_0.patch .
|
|
||||||
RUN git apply ./bump_wasi_nn_to_0_6_0.patch
|
|
||||||
|
|
||||||
# recompile with wasi-nn 0.6.0
|
# recompile with debug info
|
||||||
|
ARG FIXTURE=https://download.01.org/openvinotoolkit/fixtures/mobilenet
|
||||||
WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-image/
|
WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-image/
|
||||||
RUN pushd rust \
|
RUN pushd rust \
|
||||||
&& cargo build --target=wasm32-wasip1 \
|
&& cargo build --target=wasm32-wasip1 \
|
||||||
&& popd \
|
&& popd \
|
||||||
&& ./download_mobilenet.sh . \
|
&& wget -q --no-clobber $FIXTURE/mobilenet.xml \
|
||||||
|
&& wget -q --no-clobber $FIXTURE/mobilenet.bin \
|
||||||
&& ls -l mobilenet.xml mobilenet.bin
|
&& ls -l mobilenet.xml mobilenet.bin
|
||||||
|
|
||||||
WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-raw/
|
WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-mobilenet-raw/
|
||||||
RUN pushd rust \
|
RUN pushd rust \
|
||||||
&& cargo build --target=wasm32-wasip1 \
|
&& cargo build --target=wasm32-wasip1 \
|
||||||
&& popd \
|
&& popd \
|
||||||
&& ./download_mobilenet.sh . \
|
&& wget -q --no-clobber $FIXTURE/mobilenet.xml \
|
||||||
|
&& wget -q --no-clobber $FIXTURE/mobilenet.bin \
|
||||||
|
&& wget -q --no-clobber $FIXTURE/tensor-1x224x224x3-f32.bgr \
|
||||||
&& ls -l mobilenet.xml mobilenet.bin tensor-1x224x224x3-f32.bgr
|
&& ls -l mobilenet.xml mobilenet.bin tensor-1x224x224x3-f32.bgr
|
||||||
|
|
||||||
WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-road-segmentation-adas/
|
WORKDIR /workspaces/wasmedge-wasinn-examples/openvino-road-segmentation-adas/
|
||||||
|
@ -91,7 +96,7 @@ RUN pushd rust \
|
||||||
WORKDIR /workspaces/wasmedge-wasinn-examples/wasmedge-ggml/qwen
|
WORKDIR /workspaces/wasmedge-wasinn-examples/wasmedge-ggml/qwen
|
||||||
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
|
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
|
||||||
RUN cargo build --target=wasm32-wasip1
|
RUN cargo build --target=wasm32-wasip1
|
||||||
|
#
|
||||||
#
|
#
|
||||||
# iwasm. build from source
|
# iwasm. build from source
|
||||||
WORKDIR /workspaces/wamr
|
WORKDIR /workspaces/wamr
|
||||||
|
@ -110,6 +115,7 @@ RUN OpenVINO_DIR=/usr/lib/openvino-2023.2.0 \
|
||||||
|
|
||||||
ENV LD_LIBRARY_PATH=/usr/local/lib
|
ENV LD_LIBRARY_PATH=/usr/local/lib
|
||||||
|
|
||||||
|
|
||||||
# add smoke test script
|
# add smoke test script
|
||||||
COPY core/iwasm/libraries/wasi-nn/test/run_smoke_test.py /
|
COPY core/iwasm/libraries/wasi-nn/test/run_smoke_test.py /
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ def execute_tflite_birds_v1_image(iwasm_bin: str, wasmedge_bin: str, cwd: Path):
|
||||||
iwasm_output = execute_tflite_birds_v1_image_once(
|
iwasm_output = execute_tflite_birds_v1_image_once(
|
||||||
iwasm_bin,
|
iwasm_bin,
|
||||||
[
|
[
|
||||||
"--map-dir=.:.",
|
"--map-dir=.::.",
|
||||||
],
|
],
|
||||||
cwd,
|
cwd,
|
||||||
)
|
)
|
||||||
|
@ -181,7 +181,7 @@ def execute_openvino_mobilenet_image(iwasm_bin: str, wasmedge_bin: str, cwd: Pat
|
||||||
iwasm_output = execute_openvino_mobilenet_image_once(
|
iwasm_output = execute_openvino_mobilenet_image_once(
|
||||||
iwasm_bin,
|
iwasm_bin,
|
||||||
[
|
[
|
||||||
"--map-dir=.:.",
|
"--map-dir=.::.",
|
||||||
],
|
],
|
||||||
cwd,
|
cwd,
|
||||||
)
|
)
|
||||||
|
@ -199,7 +199,7 @@ def execute_openvino_mobilenet_raw(iwasm_bin: str, wasmedge_bin: str, cwd: Path)
|
||||||
iwasm_output = execute_openvino_mobilenet_raw_once(
|
iwasm_output = execute_openvino_mobilenet_raw_once(
|
||||||
iwasm_bin,
|
iwasm_bin,
|
||||||
[
|
[
|
||||||
"--map-dir=.:.",
|
"--map-dir=.::.",
|
||||||
],
|
],
|
||||||
cwd,
|
cwd,
|
||||||
)
|
)
|
||||||
|
@ -236,7 +236,7 @@ def execute_openvino_road_segmentation_adas(
|
||||||
iwasm_output = execute_openvino_road_segmentation_adas_once(
|
iwasm_output = execute_openvino_road_segmentation_adas_once(
|
||||||
iwasm_bin,
|
iwasm_bin,
|
||||||
[
|
[
|
||||||
"--map-dir=.:.",
|
"--map-dir=.::.",
|
||||||
],
|
],
|
||||||
cwd,
|
cwd,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user