-
Check that the caller is in the repository root:
test -f model_profiling/scripts/setup_repo.sh
-
Choose the setup path.
Fresh machine or no local ExecuTorch checkout. Use this only when EXECUTORCH_REPO_URL points at a repository containing the checked-in pin:
bash model_profiling/scripts/setup_repo.sh
Existing ExecuTorch checkout:
export EXECUTORCH_DIR=/path/to/executorch
bash model_profiling/scripts/setup_repo.sh
The fresh path creates .venv/, clones or refreshes executorch/, checks out the pinned public ExecuTorch ref, initializes submodules, verifies package downloads, and installs ExecuTorch in editable mode. The existing-checkout path creates ./executorch as a symlink to the supplied checkout, verifies that the checkout is at the pinned commit or a clean descendant, initializes submodules, verifies package downloads, and installs it. Setup disables optional MLX/CoreML/LLM/training CMake targets by default because the public profiling flow validates XNNPACK runners and does not require those backends; runner presets also keep LLM/training targets off.
-
Activate the environment for any follow-up Python commands:
source .venv/bin/activate
-
Validate the workspace:
python model_profiling/scripts/validate_setup.py --skip-runners
python -c "import executorch; print(executorch.__file__)"
To check a checkout before linking or installing it:
python model_profiling/scripts/validate_setup.py \
--executorch-dir /path/to/executorch \
--skip-venv \
--skip-submodules \
--skip-runners
Treat Python, .venv, executorch/, version compatibility, local patch, submodule, or import failures as setup failures.