test(workflow): add model init test (#504)

* add model init test

* reduce timeout

---------

Co-authored-by: wangmengke <wangmengke@pjlab.org.cn>
pull/507/head
kkscilife 2023-11-17 09:59:34 +08:00 committed by GitHub
parent 0bfc86205e
commit 679ed3c8ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 52 additions and 0 deletions

52
.github/workflows/pr_before_merge.yaml vendored Normal file
View File

@ -0,0 +1,52 @@
name: pr-before-merge
on:
pull_request:
branches:
- "develop"
- "main"
paths-ignore:
- "cmds/**"
- "**.md"
env:
WORKSPACE_PREFIX: $(echo $GITHUB_WORKSPACE |cut -d '/' -f 1-4)
SLURM_PARTITION: llm_s
jobs:
check-requirements:
runs-on: [t_cluster]
steps:
- name: mask env
run: |
echo "::add-mask::${{env.WORKSPACE_PREFIX}}"
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: check-requirements
run: |
changed_files=$(git diff --name-only -r HEAD^1 HEAD)
echo $changed_files
if [[ $changed_files =~ "runtime.txt" ]]; then
pip install -r requirements/runtime.txt
fi
if [[ $changed_files =~ "torch.txt" ]]; then
pip install -r requirements/torch.txt
fi
model_init_tests:
if: ${{ !cancelled() }}
needs: check-requirements
runs-on: [t_cluster]
timeout-minutes: 5
steps:
- name: mask env
run: |
echo "::add-mask::${{env.WORKSPACE_PREFIX}}"
- uses: actions/checkout@v3
- name: model_init_tests
run: |
source /mnt/petrelfs/share_data/llm_env/env/llm-flash2.0
export PYTHONPATH=$PWD:$PYTHONPATH
srun -p ${SLURM_PARTITION} --kill-on-bad-exit=1 --job-name=internlm-${GITHUB_RUN_ID}-${GITHUB_JOB} --quotatype=spot -N 1 -n 8 --ntasks-per-node=8 --gpus-per-task=1 python ./tests/test_training/train_CI.py --config ./tests/test_training/7B_check_init.py --seed=1024