File tree Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Expand file tree Collapse file tree 3 files changed +42
-0
lines changed Original file line number Diff line number Diff line change 5
5
6
6
ml_dtypes == 0.5.1
7
7
flatbuffers == 24.3.25
8
+ tosa-adapter-model-explorer == 0.0.1
9
+ ai-edge-model-explorer >= 0.1.16
8
10
9
11
tosa-tools @ git+https://git.gitlab.arm.com/tosa/
[email protected]
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ scratch_dir_set=false
41
41
toolchain=arm-none-eabi-gcc
42
42
select_ops_list=" aten::_softmax.out"
43
43
qdq_fusion_op=false
44
+ model_explorer=false
44
45
45
46
function help() {
46
47
echo " Usage: $( basename $0 ) [options]"
@@ -71,6 +72,7 @@ function help() {
71
72
echo " --et_build_root=<FOLDER> Executorch build output root folder to use, defaults to ${et_build_root} "
72
73
echo " --scratch-dir=<FOLDER> Path to your Ethos-U scrach dir if you not using default ${ethos_u_scratch_dir} "
73
74
echo " --qdq_fusion_op Enable QDQ fusion op"
75
+ echo " --model_explorer Generate and open a visual graph of the compiled model."
74
76
exit 0
75
77
}
76
78
@@ -99,6 +101,7 @@ for arg in "$@"; do
99
101
--et_build_root=* ) et_build_root=" ${arg#* =} " ;;
100
102
--scratch-dir=* ) ethos_u_scratch_dir=" ${arg#* =} " ; scratch_dir_set=true ;;
101
103
--qdq_fusion_op) qdq_fusion_op=true;;
104
+ --model_explorer) model_explorer=true ;;
102
105
* )
103
106
;;
104
107
esac
@@ -326,6 +329,11 @@ for i in "${!test_model[@]}"; do
326
329
fi
327
330
set +x
328
331
fi
332
+
333
+ if [ " $model_explorer " = true ]; then
334
+ tosa_flatbuffer_path=$( find ${output_folder} -name " *TOSA*.tosa" | head -n 1)
335
+ python3 ${script_dir} /visualize.py ${tosa_flatbuffer_path}
336
+ fi
329
337
done
330
338
331
339
exit 0
Original file line number Diff line number Diff line change
1
+ # Copyright 2025 Arm Limited and/or its affiliates.
2
+ #
3
+ # This source code is licensed under the BSD-style license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ import argparse
7
+
8
+ import model_explorer
9
+
10
+ from executorch .devtools .visualization .visualization_utils import (
11
+ visualize_model_explorer ,
12
+ )
13
+
14
+
15
+ def main () -> None :
16
+ parser = argparse .ArgumentParser (
17
+ description = "Visualize a model using model explorer."
18
+ )
19
+ parser .add_argument ("model_path" , type = str , help = "Path to the model file." )
20
+ args = parser .parse_args ()
21
+
22
+ config = model_explorer .config ()
23
+ (config .add_model_from_path (args .model_path ))
24
+
25
+ visualize_model_explorer (
26
+ config = config ,
27
+ extensions = ["tosa_adapter_model_explorer" ],
28
+ )
29
+
30
+
31
+ if __name__ == "__main__" :
32
+ main ()
You can’t perform that action at this time.
0 commit comments