Skip to content

split cpu eval CI by dtype #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 29, 2024
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
22 changes: 20 additions & 2 deletions .ci/scripts/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,11 @@ function eval_model() {
function eval_model_sanity_check() {
local CHECKPOINT_PATH="$1"
local TARGET_DEVICE="${2:-cpu}"
local DTYPES="$3"
local MODEL_DIR="${CHECKPOINT_PATH%/*}"
local MODEL_NAME=$(basename "$CHECKPOINT_PATH" | sed 's/\.[^.]*$//')

for DTYPE in float32 bfloat16 float16; do
for DTYPE in $DTYPES; do
echo ""############### Run eval with torch.compile for dtype $DTYPE "###############"
echo ""
echo "******************************************"
Expand Down Expand Up @@ -320,7 +321,8 @@ function run_eval(){
}

function run_eval_sanity_check(){
eval_model_sanity_check "$CHECKPOINT_PATH" "$TARGET_DEVICE" || exit 1
echo "Passing DTYPES=$DTYPES"
eval_model_sanity_check "$CHECKPOINT_PATH" "$TARGET_DEVICE" "$DTYPES" || exit 1
}

CHECKPOINT_PATH="$1"
Expand Down Expand Up @@ -365,6 +367,22 @@ if [ "$#" -gt 2 ]; then
;;
"eval_sanity_check")
echo "arg:$arg"
DTYPES="bfloat16 float16 float32"
run_eval_sanity_check || exit 1
;;
"eval_sanity_check-bfloat16")
echo "arg:$arg"
DTYPES="bfloat16"
run_eval_sanity_check || exit 1
;;
"eval_sanity_check-float16")
echo "arg:$arg"
DTYPES="float16"
run_eval_sanity_check || exit 1
;;
"eval_sanity_check-float32")
echo "arg:$arg"
DTYPES="float32"
run_eval_sanity_check || exit 1
;;
*)
Expand Down
82 changes: 77 additions & 5 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,79 @@ jobs:
python3 -c 'import torch;print(f"torch: {torch.__version__, torch.version.git_version}")'
pushd ${TORCHCHAT_ROOT}
bash .ci/scripts/convert_checkpoint.sh ${REPO_NAME}
bash .ci/scripts/validate.sh "./checkpoints/${REPO_NAME}/model.pth" "cpu" "eval_sanity_check"
bash .ci/scripts/validate.sh "./checkpoints/${REPO_NAME}/model.pth" "cpu" "eval_sanity_check-bfloat16"

test-cpu-eval-sanity-check-float16:
name: test-cpu-eval-sanity-check-float16 (${{ matrix.platform }}, ${{ matrix.model_name }})
needs: gather-models-cpu
strategy:
matrix: ${{ fromJSON(needs.gather-models-cpu.outputs.models) }}
fail-fast: false
runs-on: ${{ matrix.runner }}
env:
TORCHCHAT_ROOT: ${{ github.workspace }}
REPO_NAME: ${{ matrix.repo_name }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Print machine info
run: |
echo "$(uname -a)"
- name: Install dependencies
run: |
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
pip3 install -r requirements.txt
pip3 list
python3 -c 'import torch;print(f"torch: {torch.__version__, torch.version.git_version}")'
- name: Download checkpoints
run: |
bash ${TORCHCHAT_ROOT}/.ci/scripts/wget_checkpoint.sh ${{ matrix.repo_name }} "${{ matrix.resources }}"
- name: Run validation
run: |
python3 -c 'import torch;print(f"torch: {torch.__version__, torch.version.git_version}")'
pushd ${TORCHCHAT_ROOT}
bash .ci/scripts/convert_checkpoint.sh ${REPO_NAME}
bash .ci/scripts/validate.sh "./checkpoints/${REPO_NAME}/model.pth" "cpu" "eval_sanity_check-float16"

test-cpu-eval-sanity-check-float32:
name: test-cpu-eval-sanity-check-float32 (${{ matrix.platform }}, ${{ matrix.model_name }})
needs: gather-models-cpu
strategy:
matrix: ${{ fromJSON(needs.gather-models-cpu.outputs.models) }}
fail-fast: false
runs-on: ${{ matrix.runner }}
env:
TORCHCHAT_ROOT: ${{ github.workspace }}
REPO_NAME: ${{ matrix.repo_name }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Print machine info
run: |
echo "$(uname -a)"
- name: Install dependencies
run: |
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu
pip3 install -r requirements.txt
pip3 list
python3 -c 'import torch;print(f"torch: {torch.__version__, torch.version.git_version}")'
- name: Download checkpoints
run: |
bash ${TORCHCHAT_ROOT}/.ci/scripts/wget_checkpoint.sh ${{ matrix.repo_name }} "${{ matrix.resources }}"
- name: Run validation
run: |
python3 -c 'import torch;print(f"torch: {torch.__version__, torch.version.git_version}")'
pushd ${TORCHCHAT_ROOT}
bash .ci/scripts/convert_checkpoint.sh ${REPO_NAME}
bash .ci/scripts/validate.sh "./checkpoints/${REPO_NAME}/model.pth" "cpu" "eval_sanity_check-float32"

gather-models-gpu:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -203,7 +275,7 @@ jobs:
echo "::group::Install newer objcopy that supports --set-section-alignment"
yum install -y devtoolset-10-binutils
export PATH=/opt/rh/devtoolset-10/root/usr/bin/:$PATH
echo "::endgroup::"
echo "::endgroup::"

echo "::group::Install required packages"
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121
Expand Down Expand Up @@ -244,7 +316,7 @@ jobs:
echo "::group::Install newer objcopy that supports --set-section-alignment"
yum install -y devtoolset-10-binutils
export PATH=/opt/rh/devtoolset-10/root/usr/bin/:$PATH
echo "::endgroup::"
echo "::endgroup::"

echo "::group::Install required packages"
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121
Expand Down Expand Up @@ -291,7 +363,7 @@ jobs:
echo "::group::Install newer objcopy that supports --set-section-alignment"
yum install -y devtoolset-10-binutils
export PATH=/opt/rh/devtoolset-10/root/usr/bin/:$PATH
echo "::endgroup::"
echo "::endgroup::"

echo "::group::Install required packages"
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu121
Expand Down Expand Up @@ -441,7 +513,7 @@ jobs:
export MODEL_PATH=checkpoints/stories15M/stories15M.pt
export MODEL_NAME=stories15M
export MODEL_DIR=/tmp

echo "******************************************"
echo "*** vanilla ***"
echo "******************************************"
Expand Down