File tree Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Expand file tree Collapse file tree 1 file changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -euxo pipefail
4
+
5
+ CONDA_ENV=executorch-tmp
6
+ PYTHON_VERSION=3.10.0
7
+
8
+ # Create a temp dir that we can create files under.
9
+ WORK_DIR=" $( mktemp -d /tmp/test-wheel-install-XXXXXXXXXX) "
10
+ readonly WORK_DIR
11
+ # trap 'rm -rf "${WORK_DIR}"' EXIT
12
+
13
+ # Creates or resets a conda environment named ${CONDA_ENV}
14
+ clean_conda () {
15
+ eval " $( conda shell.bash hook) "
16
+ conda activate base
17
+ conda remove -y --name " ${CONDA_ENV} " --all || echo " (ignoring error)"
18
+ conda create -yn " ${CONDA_ENV} " python=" ${PYTHON_VERSION} "
19
+ conda activate " ${CONDA_ENV} "
20
+ }
21
+
22
+ test_xnnpack_e2e () {
23
+ # Create a .pte file that delegates to XNNPACK.
24
+ python3 -m examples.xnnpack.aot_compiler --model_name=" mv2" --delegate
25
+ local pte=" mv2_xnnpack_fp32.pte"
26
+ test -f " ${pte} "
27
+
28
+ # Test python script
29
+ local test_py=" ${WORK_DIR} /test_xnnpack_e2e.py"
30
+ cat > " ${test_py} " << HERE
31
+ import torch
32
+ from executorch.extension.pybindings import portable_lib
33
+ m = portable_lib._load_for_executorch("${pte} ")
34
+ t = torch.randn((1, 3, 224, 224))
35
+ output = m.forward([t])
36
+ print(output)
37
+ print("PASS")
38
+ HERE
39
+ python " ${test_py} "
40
+ }
41
+
42
+ main () {
43
+ if [ " $# " -ne 1 ]; then
44
+ echo " Usage: $( basename " $0 " ) <path-to-whl-file>" >&2
45
+ exit 1
46
+ fi
47
+ local wheel=" $1 "
48
+
49
+ # clean_conda
50
+ #
51
+ # # Install the deps but not the pip package.
52
+ # ./install_requirements.sh --deps-only
53
+ #
54
+ # # Install the provided wheel.
55
+ # pip install "${wheel}"
56
+
57
+ test_xnnpack_e2e
58
+ }
59
+
60
+ main " $@ "
You can’t perform that action at this time.
0 commit comments