From 54cc7c929c442ec4632a5aeca6bbb733846abf9f Mon Sep 17 00:00:00 2001 From: zhenyan-zhang-meta Date: Thu, 1 May 2025 16:56:41 -0700 Subject: [PATCH 1/2] Improve Quantization Setup Prompts and Doc --- docs/quantization.md | 4 +++- torchchat/utils/scripts/build_native.sh | 4 ++-- torchchat/utils/scripts/build_torchao_ops.sh | 6 ++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/docs/quantization.md b/docs/quantization.md index 79799f1ce..7d65190cf 100644 --- a/docs/quantization.md +++ b/docs/quantization.md @@ -149,6 +149,7 @@ From the torchchat root directory, run bash torchchat/utils/scripts/build_torchao_ops.sh ``` +Note that before running it, you must first clone torchao with `bash torchchat/utils/scripts/clone_torchao.sh` if you have not done so already. This should take about 10 seconds to complete. When building the AOTI and C++ runners, you must pass the flag link_torchao_ops when running the scripts the build the runners. @@ -161,7 +162,7 @@ bash torchchat/utils/scripts/build_native.sh aoti link_torchao_ops bash torchchat/utils/scripts/build_native.sh et link_torchao_ops ``` -Note before running `bash torchchat/utils/scripts/build_native.sh et link_torchao_ops`, you must first install executorch with `bash torchchat/utils/scripts/install_et.sh` if you have not done so already. +Note that before running `bash torchchat/utils/scripts/build_native.sh et link_torchao_ops`, you must first install executorch with `bash torchchat/utils/scripts/install_et.sh` if you have not done so already. ### Examples @@ -218,6 +219,7 @@ From the torchchat root directory, run ``` bash torchchat/utils/scripts/build_torchao_ops.sh mps ``` +Note that before running it, you must first clone torchao with `bash torchchat/utils/scripts/clone_torchao.sh` if you have not done so already. ### Examples diff --git a/torchchat/utils/scripts/build_native.sh b/torchchat/utils/scripts/build_native.sh index 0ba2f6858..afd877c60 100755 --- a/torchchat/utils/scripts/build_native.sh +++ b/torchchat/utils/scripts/build_native.sh @@ -70,14 +70,14 @@ git submodule sync if [[ "$TARGET" == "et" ]]; then if [ ! -d "${TORCHCHAT_ROOT}/${ET_BUILD_DIR}/install" ]; then echo "Directory ${TORCHCHAT_ROOT}/${ET_BUILD_DIR}/install does not exist." - echo "Make sure you run install_executorch_libs" + echo "Make sure you run bash torchchat/utils/scripts/install_et.sh" exit 1 fi if [[ "$LINK_TORCHAO_OPS" == "ON" ]]; then if [ ! -d "${TORCHCHAT_ROOT}/torchao-build" ]; then echo "Directory ${TORCHCHAT_ROOT}/torchao-build does not exist." - echo "Make sure you run clone_torchao" + echo "Make sure you run bash torchchat/utils/scripts/clone_torchao.sh" exit 1 fi diff --git a/torchchat/utils/scripts/build_torchao_ops.sh b/torchchat/utils/scripts/build_torchao_ops.sh index a8388d8d7..c31dca69c 100644 --- a/torchchat/utils/scripts/build_torchao_ops.sh +++ b/torchchat/utils/scripts/build_torchao_ops.sh @@ -12,6 +12,12 @@ if [[ "$device" != "cpu" && "$device" != "mps" ]]; then exit 1 fi +if [ ! -d "${TORCHCHAT_ROOT}/torchao-build" ]; then + echo "Directory ${TORCHCHAT_ROOT}/torchao-build does not exist." + echo "Make sure you run bash torchchat/utils/scripts/clone_torchao.sh" + exit 1 +fi + source "$(dirname "${BASH_SOURCE[0]}")/install_utils.sh" pushd ${TORCHCHAT_ROOT} From 70239cc34c6c986ed347f3c1274a67bc76e038e0 Mon Sep 17 00:00:00 2001 From: zhenyan-zhang-meta Date: Thu, 1 May 2025 16:56:41 -0700 Subject: [PATCH 2/2] Improve Quantization Setup Prompts and Doc --- torchchat/utils/scripts/build_torchao_ops.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/torchchat/utils/scripts/build_torchao_ops.sh b/torchchat/utils/scripts/build_torchao_ops.sh index c31dca69c..070954ff6 100644 --- a/torchchat/utils/scripts/build_torchao_ops.sh +++ b/torchchat/utils/scripts/build_torchao_ops.sh @@ -12,14 +12,14 @@ if [[ "$device" != "cpu" && "$device" != "mps" ]]; then exit 1 fi +source "$(dirname "${BASH_SOURCE[0]}")/install_utils.sh" + if [ ! -d "${TORCHCHAT_ROOT}/torchao-build" ]; then echo "Directory ${TORCHCHAT_ROOT}/torchao-build does not exist." echo "Make sure you run bash torchchat/utils/scripts/clone_torchao.sh" exit 1 fi -source "$(dirname "${BASH_SOURCE[0]}")/install_utils.sh" - pushd ${TORCHCHAT_ROOT} find_cmake_prefix_path install_torchao_aten_ops "$device"