Skip to content
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

Tests for transformers 4.36 #10848

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/actions/llm/example-test-436/action.yml
@@ -0,0 +1,14 @@
name: 'IPEX-LLM example tests'
description: 'IPEX-LLM example tests'

runs:
using: "composite"
steps:
- name: Test LLAMA2
shell: bash
env:
INT4_CKPT_DIR: ./llm/ggml-actions/stable
LLM_DIR: ./llm

run: |
bash python/llm/dev/test/run-example-tests-436.sh
45 changes: 45 additions & 0 deletions .github/actions/llm/setup-llm-env-4.36/action.yml
@@ -0,0 +1,45 @@
name: "Setup IPEX-LLM Env"
description: "IPEX-LLM installation"
inputs:
extra-dependency:
description: "Name of extra dependencies filled in brackets"
required: false
default: "all"
runs:
using: "composite"
steps:
- name: Create conda env for llm tests and conduct install tests
shell: bash
run: |
# make sure we install the latest version for bigdl-core-xe related packages
pip uninstall bigdl-core-xe -y || true
pip uninstall bigdl-core-xe-esimd -y || true
pip uninstall bigdl-core-xe-21 -y || true
pip uninstall bigdl-core-xe-esimd-21 -y || true
sed -i 's/"bigdl-core-xe==" + CORE_XE_VERSION + "/"bigdl-core-xe/g' python/llm/setup.py
sed -i 's/"bigdl-core-xe-esimd==" + CORE_XE_VERSION + "/"bigdl-core-xe-esimd/g' python/llm/setup.py
sed -i 's/"bigdl-core-xe-21==" + CORE_XE_VERSION/"bigdl-core-xe-21"/g' python/llm/setup.py
sed -i 's/"bigdl-core-xe-esimd-21==" + CORE_XE_VERSION/"bigdl-core-xe-esimd-21"/g' python/llm/setup.py

pip install requests
if [[ ${{ runner.os }} == 'Linux' ]]; then
bash python/llm/dev/release_default_linux.sh default false
elif [[ ${{ runner.os }} == 'Windows' ]]; then
bash python/llm/dev/release_default_windows.sh default false
else
echo "Runner os is not supported!!!!!"
exit 1
fi
whl_name=$(ls python/llm/dist)
if [[ ${{ inputs.extra-dependency }} == 'xpu_2.0' ]]; then
pip install --upgrade --pre -i https://pypi.python.org/simple --force-reinstall "python/llm/dist/${whl_name}[xpu_2.0]" --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/cn/
pip install pytest expecttest
elif [[ ${{ inputs.extra-dependency }} == 'xpu_2.1' ]]; then
pip install --upgrade --pre -i https://pypi.python.org/simple --force-reinstall "python/llm/dist/${whl_name}[xpu_2.1]" --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/cn/
pip install pytest expecttest
else
pip install --upgrade --pre -i https://pypi.python.org/simple --force-reinstall "python/llm/dist/${whl_name}[all]"
pip install pytest
bash python/llm/test/run-llm-install-tests.sh
fi
pip install transformers==4.36.2
113 changes: 113 additions & 0 deletions .github/workflows/llm-nightly-test-436.yml
@@ -0,0 +1,113 @@
name: LLM Nightly Tests for 4.36

# Cancel previous runs in the PR when you push new commits
concurrency:
group: ${{ github.workflow }}-llm-nightly-test-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

# Controls when the action will run.
on:
schedule:
- cron: "00 13 * * *" # GMT time, 13:00 GMT == 21:00 China
pull_request:
branches: [main]
paths:
# - ".github/workflows/llm-nightly-test.yml"
# - ".github/actions/llm/setup-llm-env/action.yml"
# - ".github/actions/llm/remove-llm-env/action.yml"
# - ".github/actions/llm/convert-test/action.yml"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
llm-cpp-build:
uses: ./.github/workflows/llm-binary-build.yml
llm-nightly-convert-test:
needs: llm-cpp-build
strategy:
fail-fast: false
matrix:
include:
- os: windows
instruction: AVX-VNNI-UT
python-version: "3.11"
- os: ubuntu-20.04-lts
instruction: avx512
python-version: "3.11"
runs-on: [self-hosted, llm, "${{matrix.instruction}}", "${{matrix.os}}"]
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
steps:
- name: Set model directories
shell: bash
run: |
echo "ORIGIN_DIR=$(pwd)/../llm/origin-models" >> "$GITHUB_ENV"
echo "INT4_CKPT_DIR=$(pwd)/../llm/nightly-converted-models" >> "$GITHUB_ENV"
- name: Create model directories
shell: bash
run: |
if [ ! -d $ORIGIN_DIR ]; then
mkdir -p $ORIGIN_DIR
fi
if [ ! -d $INT4_CKPT_DIR ]; then
mkdir -p $INT4_CKPT_DIR
fi
- name: Set environment variables
shell: bash
run: |
echo "LLAMA_ORIGIN_PATH=${ORIGIN_DIR}/llama-7b-hf" >> "$GITHUB_ENV"
echo "GPTNEOX_ORIGIN_PATH=${ORIGIN_DIR}/gptneox-7b-redpajama-bf16" >> "$GITHUB_ENV"
echo "BLOOM_ORIGIN_PATH=${ORIGIN_DIR}/bloomz-7b1" >> "$GITHUB_ENV"
echo "STARCODER_ORIGIN_PATH=${ORIGIN_DIR}/gpt_bigcode-santacoder" >> "$GITHUB_ENV"

echo "LLAMA_INT4_CKPT_PATH=${INT4_CKPT_DIR}/bigdl_llm_llama_q4_0.bin" >> "$GITHUB_ENV"
echo "GPTNEOX_INT4_CKPT_PATH=${INT4_CKPT_DIR}/bigdl_llm_gptneox_q4_0.bin" >> "$GITHUB_ENV"
echo "BLOOM_INT4_CKPT_PATH=${INT4_CKPT_DIR}/bigdl_llm_bloom_q4_0.bin" >> "$GITHUB_ENV"
echo "STARCODER_INT4_CKPT_PATH=${INT4_CKPT_DIR}/bigdl_llm_starcoder_q4_0.bin" >> "$GITHUB_ENV"
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools==58.0.4
python -m pip install --upgrade wheel

- name: Download llm binary
uses: ./.github/actions/llm/download-llm-binary

- name: Install IPEX-LLM
uses: ./.github/actions/llm/setup-llm-env

- name: Download original models & convert
uses: ./.github/actions/llm/convert-test

- name: Upload ckpt to ftp
shell: bash
if: runner.os == 'Linux' && github.event_name == 'schedule'
run: |
curl -T $LLAMA_INT4_CKPT_PATH ${LLM_FTP_URL}/llm/ggml-actions/nightly/bigdl_llm_llama_7b_q4_0.bin
curl -T $GPTNEOX_INT4_CKPT_PATH ${LLM_FTP_URL}/llm/ggml-actions/nightly/bigdl_llm_redpajama_7b_q4_0.bin
curl -T $BLOOM_INT4_CKPT_PATH ${LLM_FTP_URL}/llm/ggml-actions/nightly/bigdl_llm_bloom_7b_q4_0.bin
curl -T $STARCODER_INT4_CKPT_PATH ${LLM_FTP_URL}/llm/ggml-actions/nightly/bigdl_llm_santacoder_1b_q4_0.bin
- name: Delete ckpt
shell: bash
run: |
rm -rf $LLAMA_INT4_CKPT_PATH
rm -rf $GPTNEOX_INT4_CKPT_PATH
rm -rf $BLOOM_INT4_CKPT_PATH
rm -rf $STARCODER_INT4_CKPT_PATH

llm-unit-tests:
needs: llm-cpp-build
uses: ./.github/workflows/llm_unit_tests_4.36.yml
llm-example-test:
needs: llm-cpp-build
uses: ./.github/workflows/llm_example_tests_436.yml
81 changes: 81 additions & 0 deletions .github/workflows/llm_example_tests_436.yml
@@ -0,0 +1,81 @@
name: LLM Example Test for 4.36

# Cancel previous runs in the PR when you push new commits
concurrency:
group: ${{ github.workflow }}-llm-example-tests-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: true

permissions:
contents: read

# Controls when the action will run.
on:
# schedule:
# - cron: '00 13 * * *' # GMT time, 13:00 GMT == 21:00 China
pull_request:
branches: [ main ]
paths:
- '.github/workflows/llm_example_tests.yml'
- '.github/workflows/llm-binary-build.yml'
- '.github/actions/llm/example-test/action.yml'
- '.github/actions/llm/setup-llm-env/action.yml'
- '.github/actions/llm/remove-llm-env/action.yml'
- '.github/actions/llm/download-llm-binary/action.yml'
- 'python/llm/dev/test/run-example-tests.sh'
- 'python/llm/example/**'
workflow_dispatch:
workflow_call:

env:
INT4_CKPT_DIR: ./llm/ggml-actions/stable
LLM_DIR: ./llm

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
llm-cpp-build:
uses: ./.github/workflows/llm-binary-build.yml
llm-example-test:
needs: llm-cpp-build
strategy:
fail-fast: false
matrix:
python-version: ["3.11"]
instruction: ["AVX512"]
runs-on: [ self-hosted, llm,"${{matrix.instruction}}", ubuntu-20.04-lts ]
env:
THREAD_NUM: 24
steps:
- uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools==58.0.4
python -m pip install --upgrade wheel

# - name: Download llm binary
# uses: ./.github/actions/llm/download-llm-binary
#
# - name: Run LLM install (all) test
# uses: ./.github/actions/llm/setup-llm-env
# env:
# ANALYTICS_ZOO_ROOT: ${{ github.workspace }}

- name: Install IPEX-LLM from Pypi
shell: bash
run: |
pip install --pre --upgrade ipex-llm[all]
pip install transformers==4.36.2

- name: Run LLM example test
uses: ./.github/actions/llm/example-test
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}

# - name: Clean up test environment
# uses: ./.github/actions/llm/remove-llm-env
# env:
# ANALYTICS_ZOO_ROOT: ${{ github.workspace }}