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 55
66ml_dtypes == 0.5.1
77flatbuffers == 24.3.25
8+ tosa-adapter-model-explorer == 0.0.1
9+ ai-edge-model-explorer >= 0.1.16
810
911tosa-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
4141toolchain=arm-none-eabi-gcc
4242select_ops_list=" aten::_softmax.out"
4343qdq_fusion_op=false
44+ model_explorer=false
4445
4546function help() {
4647 echo " Usage: $( basename $0 ) [options]"
@@ -71,6 +72,7 @@ function help() {
7172 echo " --et_build_root=<FOLDER> Executorch build output root folder to use, defaults to ${et_build_root} "
7273 echo " --scratch-dir=<FOLDER> Path to your Ethos-U scrach dir if you not using default ${ethos_u_scratch_dir} "
7374 echo " --qdq_fusion_op Enable QDQ fusion op"
75+ echo " --model_explorer Generate and open a visual graph of the compiled model."
7476 exit 0
7577}
7678
@@ -99,6 +101,7 @@ for arg in "$@"; do
99101 --et_build_root=* ) et_build_root=" ${arg#* =} " ;;
100102 --scratch-dir=* ) ethos_u_scratch_dir=" ${arg#* =} " ; scratch_dir_set=true ;;
101103 --qdq_fusion_op) qdq_fusion_op=true;;
104+ --model_explorer) model_explorer=true ;;
102105 * )
103106 ;;
104107 esac
@@ -326,6 +329,11 @@ for i in "${!test_model[@]}"; do
326329 fi
327330 set +x
328331 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
329337done
330338
331339exit 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