Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions backends/arm/requirements-arm-tosa.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@

ml_dtypes == 0.5.1
flatbuffers == 24.3.25
tosa-adapter-model-explorer == 0.0.1
ai-edge-model-explorer >= 0.1.16

tosa-tools @ git+https://git.gitlab.arm.com/tosa/[email protected]
8 changes: 8 additions & 0 deletions examples/arm/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ scratch_dir_set=false
toolchain=arm-none-eabi-gcc
select_ops_list="aten::_softmax.out"
qdq_fusion_op=false
model_explorer=false

function help() {
echo "Usage: $(basename $0) [options]"
Expand Down Expand Up @@ -71,6 +72,7 @@ function help() {
echo " --et_build_root=<FOLDER> Executorch build output root folder to use, defaults to ${et_build_root}"
echo " --scratch-dir=<FOLDER> Path to your Ethos-U scrach dir if you not using default ${ethos_u_scratch_dir}"
echo " --qdq_fusion_op Enable QDQ fusion op"
echo " --model_explorer Generate and open a visual graph of the compiled model."
exit 0
}

Expand Down Expand Up @@ -99,6 +101,7 @@ for arg in "$@"; do
--et_build_root=*) et_build_root="${arg#*=}";;
--scratch-dir=*) ethos_u_scratch_dir="${arg#*=}" ; scratch_dir_set=true ;;
--qdq_fusion_op) qdq_fusion_op=true;;
--model_explorer) model_explorer=true ;;
*)
;;
esac
Expand Down Expand Up @@ -326,6 +329,11 @@ for i in "${!test_model[@]}"; do
fi
set +x
fi

if [ "$model_explorer" = true ]; then
tosa_flatbuffer_path=$(find ${output_folder} -name "*TOSA*.tosa" | head -n 1)
python3 ${script_dir}/visualize.py ${tosa_flatbuffer_path}
fi
done

exit 0
32 changes: 32 additions & 0 deletions examples/arm/visualize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2025 Arm Limited and/or its affiliates.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

import argparse

import model_explorer

from executorch.devtools.visualization.visualization_utils import (
visualize_model_explorer,
)


def main() -> None:
parser = argparse.ArgumentParser(
description="Visualize a model using model explorer."
)
parser.add_argument("model_path", type=str, help="Path to the model file.")
args = parser.parse_args()

config = model_explorer.config()
(config.add_model_from_path(args.model_path))

visualize_model_explorer(
config=config,
extensions=["tosa_adapter_model_explorer"],
)


if __name__ == "__main__":
main()
Loading