Skip to content

Commit

Permalink
modify the e2e running way
Browse files Browse the repository at this point in the history
  • Loading branch information
RUIJIEZHONG66166 committed Apr 2, 2024
1 parent e6c3048 commit db5220c
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 6 deletions.
60 changes: 60 additions & 0 deletions .github/scripts/inductor-xpu-e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
suite=${1:-huggingface}
dt=${2:-amp_bf16}
mode=${3:-inference}
scenario=${4:-accuracy}
expected_pass_num=${5:-46}

echo -e "========================================================================="
echo -e "Dependancy Install"
echo -e "========================================================================="
source activate e2e_ci
cp .github/scripts/inductor_xpu_test.sh ../pytorch
cd ../pytorch
if [[ ${suite} == "timm_models" ]]; then
pip install --no-deps "git+https://github.com/rwightman/pytorch-image-models@b9d43c7dcac1fe05e851dd7be7187b108af593d2"
elif [[ ${suite} == "torchbench" ]]; then
pip install transformers==4.38.1 --no-deps
pip install timm==0.9.7 --no-deps
apt-get update -y
apt install libgl1-mesa-glx -y
conda install -y git-lfs pyyaml pandas scipy psutil
pip install tqdm pandas pyre-extensions torchrec tensorboardX dalle2_pytorch torch_geometric scikit-image matplotlib gym fastNLP doctr matplotlib opacus python-doctr higher opacus dominate kaldi-io librosa effdet pycocotools diffusers
pip uninstall -y pyarrow pandas
pip install pyarrow pandas

cd ..
git clone https://github.com/facebookresearch/detectron2.git
python -m pip install -e detectron2

git clone --recursive https://github.com/facebookresearch/multimodal.git multimodal
pushd multimodal
pip install -e .
popd
fi

#TRANSFORMERS_COMMIT=$(cat .ci/docker/ci_commit_pins/huggingface.txt)
#pip install --force-reinstall git+https://github.com/huggingface/transformers@${TRANSFORMERS_COMMIT}
echo -e "========================================================================="
echo -e "E2E Test"
echo -e "========================================================================="
source /opt/intel/oneapi/setvars.sh
#export PYTORCH_ENABLE_XPU_FALLBACK=1
rm -rf inductor_log
bash inductor_xpu_test.sh ${suite} ${dt} ${mode} ${scenario} xpu 3

echo -e "========================================================================="
echo -e "Test Results Summary"
echo -e "========================================================================="
cd ../pytorch/inductor_log/${suite}
cd ${dt}
echo -e "============ Summary for ${suite} ${dt} ${mode} ${scenario} ============" | tee -a ./${suite}_${dt}_${mode}_${scenario}_e2e_summary.log
awk -i inplace '!seen[$0]++' inductor_${suite}_${dt}_${mode}_xpu_${scenario}.csv
csv_lines=$(cat inductor_${suite}_${dt}_${mode}_xpu_${scenario}.csv | wc -l)
let num_total=csv_lines-1
num_passed=$(grep -c "pass" inductor_${suite}_${dt}_${mode}_xpu_${scenario}.csv)
let num_failed=num_total-num_passed
pass_rate=`awk 'BEGIN{printf "%.2f%%\n",('$num_passed'/'$num_total')*100}'`
echo "num_total: $num_total" | tee -a ./${suite}_${dt}_${mode}_${scenario}_e2e_summary.log
echo "num_passed: $num_passed" | tee -a ./${suite}_${dt}_${mode}_${scenario}_e2e_summary.log
echo "num_failed: $num_failed" | tee -a ./${suite}_${dt}_${mode}_${scenario}_e2e_summary.log
echo "pass_rate: $pass_rate" | tee -a ./${suite}_${dt}_${mode}_${scenario}_e2e_summary.log
17 changes: 17 additions & 0 deletions .github/scripts/results-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
suite=${1:-huggingface}
dt=${2:-amp_bf16}
mode=${3:-inference}
scenario=${4:-accuracy}
expected_pass_num=${5:-46}

echo -e "========================================================================="
echo -e "Results Check"
echo -e "========================================================================="

cd ../pytorch/inductor_log/${suite}
cd ${dt}
num_passed=$(grep "num_passed:" ${suite}_${dt}_${mode}_${scenario}_e2e_summary.log | sed -e 's/.*://;s/[^0-9.]//')
if [ $num_passed -lt ${{ inputs.expected_pass_num }} ]; then
echo -e "[ERROR] Inductor E2E CI test for ${suite} ${dt} ${mode} passed_num < ${{ inputs.expected_pass_num }}"
exit 1
fi
17 changes: 11 additions & 6 deletions .github/workflows/inductor_xpu_e2e_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,15 @@ jobs:
uses: ./.github/scripts/install-e2e-suites

- name: Huggingface AMP_BF16 Inference Accuracy Test
uses: ./.github/actions/inductor-xpu-e2e-test
run: |
bash .github/scripts/inductor-xpu-e2e.sh --suite huggingface --dt amp_bf16 --mode inference --scenario accuracy --expected_pass_num 46
- name: Upload Triton Inductor E2E CI Data
uses: actions/upload-artifact@v3
with:
suite: huggingface
dt: amp_bf16
mode: inference
scenario: accuracy
expected_pass_num: 46
name: Triton-Inductor-E2E-CI-Data
path: /home/ipex/actions-runner/_work/intel-extension-for-pytorch/pytorch/inductor_log/

- name: Test Result Check
run: |
bash .github/scripts/results-check.sh

0 comments on commit db5220c

Please sign in to comment.