You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ed72896
Browse filesBrowse the repository at this point in the historyBrowse files
Arm backend: Make Model Explorer dependencies optional (pytorch#22993)
### Summary
Related to pytorch#22314.
Default Arm setup installs Model Explorer adapters that require Python
below 3.13, even when visualization is unused. Make visualization opt-in
with `--enable-model-explorer` and install its complete dependency graph
in an isolated directory so its FlatBuffers requirements do not conflict
with the TOSA toolchain.
Update `run.sh` to request the optional dependencies during automatic
setup, validate only the selected adapter, and expose the isolated
packages only during visualization. Resolve Python from the active
environment and check its major/minor version instead of retaining an
absolute interpreter path. Document supported versions and reject
unsupported visualization configurations early.
The core toolchain versions remain unchanged. The existing `tosa-tools`
pin still prevents Python 3.14 installation and needs a separate
dependency upgrade. The PTE adapter also retains its upstream transitive
dependency on the VGF adapter; this change adds no separate VGF
requirement.
Authored with assistance from Codex.
### Test plan
On Python 3.12, installed the complete optional dependency graph into an
isolated directory. `pip check`, deep PTE/TOSA adapter imports, and the
Model Explorer CLI passed. Repeated validation after replacing the
virtual environment and moving the installed packages.
To repeat the isolated dependency checks from the repository root:
```bash
check_dir=$(mktemp -d)
python3.12 -m venv "$check_dir/venv"
"$check_dir/venv/bin/python" -m pip install \
--ignore-installed --no-warn-conflicts \
--target "$check_dir/packages" \
-r backends/arm/requirements-arm-model-explorer.txt
PYTHONPATH="$check_dir/packages" "$check_dir/venv/bin/python" -m pip check
PYTHONPATH="$check_dir/packages" "$check_dir/venv/bin/python" -c \
'import pte_adapter_model_explorer.main, tosa_adapter_model_explorer.main'
PYTHONPATH="$check_dir/packages" "$check_dir/venv/bin/python" \
-m model_explorer --help
```
Passed 15 local shell behavior checks using a temporary harness with
stubbed setup/export: early rejection of unsupported Python versions,
sourced-shell behavior, automatic setup with and without visualization,
selected-adapter validation, Python minor-version mismatch, invalid
flags, and isolation from model export. This harness is not added to the
repository.
Shell syntax and whitespace checks passed:
```bash
bash -n examples/arm/setup.sh
bash -n examples/arm/run.sh
git diff --check HEAD^ HEAD
```
Lintrunner and the Arm pre-push checks also passed, including license
checks, documentation checks, VGF operator coverage, and public API
manifest validation. Full model export and FVP execution were not rerun
for this dependency-isolation change.
cc @digantdesai@freddan80@per@zingo@oscarandersson8218@mansnils@Sebastian-Larsson@robell@rascani
Signed-off-by: Usamah Zaheer <usamah.zaheer@arm.com>
local model_explorer_args=(--model_dir "${output_folder}")
743
+
if [[ "$visualize_tosa"=true ]];then
744
+
model_explorer_args+=(--tosa)
745
+
else
746
+
model_explorer_args+=(--pte)
747
+
fi
748
+
if [[ "$perf_overlay"=true ]];then
749
+
model_explorer_args+=(
750
+
--trace "${output_folder}/pmu_trace.gz"
751
+
--tables "${output_folder}/output/out_debug.xml"
752
+
)
753
+
fi
754
+
755
+
PYTHONPATH="${model_explorer_pythonpath}" \
756
+
python3 "${script_dir}/visualize.py" \
757
+
"${model_explorer_args[@]}"
758
+
}
759
+
679
760
if [[ -z"$model_name" ]];then
680
761
echo"[run.sh] WARNING: Built-in test models executed when --model_name is omitted are deprecated and will be removed after the ExecuTorch 1.2 release.">&2
681
762
# the test models run, and whether to delegate
@@ -766,6 +847,7 @@ for i in "${!test_model[@]}"; do
766
847
767
848
if [[ ${target}==*"TOSA"* ]];then
768
849
echo"Build for ${target} skip generating a .elf and running it"
850
+
visualize_model
769
851
continue
770
852
elif [[ ${target}== cortex-m* ]];then
771
853
# Cortex-M backend uses a semihosting executor_runner (built by
@@ -828,23 +910,7 @@ for i in "${!test_model[@]}"; do
0 commit comments