[LLM] Enable UT workflow logics for LLM (#8243)

* check push connection

* enable UT workflow logics for LLM

* test fix

* add licenses

* test fix according to suggestions

* test fix

* update changes
This commit is contained in:
Pingchuan Ma (Henry) 2023-06-02 17:06:35 +08:00 committed by GitHub
parent 657ea0ee50
commit c48d5f7cff
5 changed files with 83 additions and 20 deletions

View file

@ -27,7 +27,7 @@ jobs:
fail-fast: false
matrix:
os: ["windows-latest"]
python-version: ["3.8"]
python-version: ["3.9"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
@ -39,6 +39,7 @@ jobs:
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools==58.0.4
python -m pip install --upgrade wheel
- name: Run LLM-init test
shell: bash
run: |
@ -46,3 +47,17 @@ jobs:
pip install -i https://pypi.python.org/simple python/llm/dist/bigdl_llm*.whl
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}
- name: Run LLM naive installation test
shell: bash
run: |
bash python/llm/dev/release_default_windows.sh default false
pip install -i https://pypi.python.org/simple python/llm/dist/bigdl_llm*.whl
pip install pytest
pip install numpy
pip install torch
pip install transformers
pip install sentencepiece
bash python/llm/test/run-llm-basic-tests.sh
env:
ANALYTICS_ZOO_ROOT: ${{ github.workspace }}

View file

@ -43,10 +43,8 @@ echo "The effective version is: ${bigdl_version}"
if [ "$platform" == "linux" ]; then
verbose_pname="manylinux2010_x86_64"
setup_file="setup-linux.py"
elif [ "$platform" == "windows" ]; then
verbose_pname="win_amd64"
setup_file="setup.py"
else
echo "Unsupported platform"
fi
@ -55,36 +53,21 @@ if [ -d "${BIGDL_DIR}/python/llm/dist" ]; then
rm -r ${BIGDL_DIR}/python/llm/dist
fi
if [ -d "${BIGDL_DIR}/python/llm/_skbuild" ]; then
rm -r ${BIGDL_DIR}/python/llm/_skbuild
fi
if [ -d "${BIGDL_DIR}/python/llm/build" ]; then
rm -r ${BIGDL_DIR}/python/llm/build
fi
if [ -d "${BIGDL_DIR}/python/llm/bigdl_llm.egg-info" ]; then
rm -r ${BIGDL_DIR}/python/llm/bigdl_llm.egg-info
fi
cd $BIGDL_PYTHON_DIR
wheel_command="python ${setup_file} bdist_wheel --plat-name ${verbose_pname} --python-tag py3"
wheel_command="python setup.py clean --all bdist_wheel --plat-name ${verbose_pname} --python-tag py3"
echo "Packing python distribution: $wheel_command"
${wheel_command}
if [ -d "${BIGDL_DIR}/python/llm/_skbuild" ]; then
rm -r ${BIGDL_DIR}/python/llm/_skbuild
fi
if [ -d "${BIGDL_DIR}/python/llm/build" ]; then
rm -r ${BIGDL_DIR}/python/llm/build
fi
if [ -d "${BIGDL_DIR}/python/llm/bigdl_llm.egg-info" ]; then
rm -r ${BIGDL_DIR}/python/llm/bigdl_llm.egg-info
fi
if [ ${upload} == true ]; then
upload_command="twine upload dist/bigdl_llm-${bigdl_version}-*-${verbose_pname}.whl"
echo "Please manually upload with this command: $upload_command"

View file

@ -0,0 +1,15 @@
#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

View file

@ -0,0 +1,32 @@
#
# Copyright 2016 The BigDL Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import bigdl.llm
import pytest
from unittest import TestCase
class Test_LLM_Basics(TestCase):
def test_naive(self):
from bigdl.llm.ggml import quantize
from bigdl.llm.utils.common import invalidInputError
pass
if __name__ == '__main__':
pytest.main([__file__])

View file

@ -0,0 +1,18 @@
#!/bin/bash
export ANALYTICS_ZOO_ROOT=${ANALYTICS_ZOO_ROOT}
export LLM_HOME=${ANALYTICS_ZOO_ROOT}/python/llm/src
export LLM_BASIC_TEST_DIR=${ANALYTICS_ZOO_ROOT}/python/llm/test/packaging
set -e
# ipex is not installed here. Any tests needs ipex should be moved to next pytest command.
echo "# Start testing"
start=$(date "+%s")
python -m pytest -s ${LLM_BASIC_TEST_DIR}
now=$(date "+%s")
time=$((now-start))
echo "Bigdl-llm tests finished"
echo "Time used:$time seconds"