Skip to content

Commit

Permalink
Add doc for script (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
guangy10 authored Apr 17, 2024
1 parent 7f88c2d commit b781741
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 242 deletions.
20 changes: 12 additions & 8 deletions .ci/scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function generate_compiled_model_output() {
local MODEL_DIR="${CHECKPOINT_PATH%/*}"
local MODEL_NAME=$(basename "$CHECKPOINT_PATH" | sed 's/\.[^.]*$//')

for DTYPE in float32 bfloat16; do
for DTYPE in float32 bfloat16 float16; do
echo ""############### Run inference with torch.compile for dtype $DTYPE "###############"
echo ""
echo "******************************************"
Expand Down Expand Up @@ -98,7 +98,7 @@ function generate_aoti_model_output() {
local MODEL_DIR="${CHECKPOINT_PATH%/*}"
local MODEL_NAME=$(basename "$CHECKPOINT_PATH" | sed 's/\.[^.]*$//')

for DTYPE in float32 bfloat16; do
for DTYPE in float32 bfloat16 float16; do
echo ""############### Run inference with AOT Inductor for dtype $DTYPE "###############"
echo ""
echo "******************************************"
Expand Down Expand Up @@ -150,12 +150,16 @@ function generate_aoti_model_output() {
python -W ignore generate.py --dtype ${DTYPE} --checkpoint-path "$CHECKPOINT_PATH" --temperature 0 --dso-path ${MODEL_DIR}/${MODEL_NAME}.so --device "$TARGET_DEVICE" > "$MODEL_DIR/output_aoti" || exit 1
cat "$MODEL_DIR/output_aoti"

# echo "******************************************"
# echo "******** INT4 group-wise quantized *******"
# echo "******************************************"
# python -W ignore export.py --dtype ${DTYPE} --quant '{"linear:int4" : {"groupsize": 32}}' --checkpoint-path "$CHECKPOINT_PATH" --output-dso-path ${MODEL_DIR}/${MODEL_NAME}.so --device "$TARGET_DEVICE" || exit 1
# python -W ignore generate.py --dtype ${DTYPE} --checkpoint-path "$CHECKPOINT_PATH" --temperature 0 --dso-path ${MODEL_DIR}/${MODEL_NAME}.so --device "$TARGET_DEVICE" > "$MODEL_DIR/output_aoti" || exit 1
# cat "$MODEL_DIR/output_aoti"
echo "******************************************"
echo "******** INT4 group-wise quantized *******"
echo "******************************************"
if [ $(uname -s) == "Linux" ]; then
echo "Skipping INT4 groupwise quantization because AOTI fails"
else
python -W ignore export.py --dtype ${DTYPE} --quant '{"linear:int4" : {"groupsize": 32}}' --checkpoint-path "$CHECKPOINT_PATH" --output-dso-path ${MODEL_DIR}/${MODEL_NAME}.so --device "$TARGET_DEVICE" || exit 1
python -W ignore generate.py --dtype ${DTYPE} --checkpoint-path "$CHECKPOINT_PATH" --temperature 0 --dso-path ${MODEL_DIR}/${MODEL_NAME}.so --device "$TARGET_DEVICE" > "$MODEL_DIR/output_aoti" || exit 1
cat "$MODEL_DIR/output_aoti"
fi
done
}

Expand Down
118 changes: 0 additions & 118 deletions .github/workflows/compile-dtype.yml

This file was deleted.

115 changes: 0 additions & 115 deletions .github/workflows/compile_t4-dtype.yml

This file was deleted.

10 changes: 9 additions & 1 deletion scripts/workflow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

################################################################################
# Usage:
# bash script.sh [cpu|cuda] [model_repo] [optional_command]
# Arguments:
# cpu|cuda: Specify the device to run validation on (cpu or cuda).
# model_repo: Model repository name to validate (e.g., tinyllamas/stories15M).
# optional_command: (optional) Specify additional command "compile", "aoti" or "executorch" to run the selected validation.
################################################################################

set -eu

Expand Down Expand Up @@ -75,7 +83,7 @@ MODEL_REPOS=(
"mistralai/Mistral-7B-v0.1"
"mistralai/Mistral-7B-Instruct-v0.1"
"mistralai/Mistral-7B-Instruct-v0.2"
# "openlm-research/open_llama_7b"
"openlm-research/open_llama_7b"
"codellama/CodeLlama-7b-Python-hf"
"codellama/CodeLlama-34b-Python-hf"
# "meta-llama/Llama-2-7b-chat-hf"
Expand Down

0 comments on commit b781741

Please sign in to comment.