ipex-llm/python/llm/test/run-langchain-upstream-tests.sh
Kai Huang f8dd2e52ad
Fix Langchain upstream ut (#10985)
* Fix Langchain upstream ut

* Small fix

* Install bigdl-llm

* Update run-langchain-upstream-tests.sh

* Update run-langchain-upstream-tests.sh

* Update llm_unit_tests.yml

* Update run-langchain-upstream-tests.sh

* Update llm_unit_tests.yml

* Update run-langchain-upstream-tests.sh

* fix git checkout

* fix

---------

Co-authored-by: Zhangky11 <2321096202@qq.com>
Co-authored-by: Keyan (Kyrie) Zhang <79576162+Zhangky11@users.noreply.github.com>
2024-05-11 14:40:37 +08:00

23 lines
1.6 KiB
Bash

export ANALYTICS_ZOO_ROOT=${ANALYTICS_ZOO_ROOT}
export LLM_HOME=${ANALYTICS_ZOO_ROOT}/python/llm/src
export LLM_INFERENCE_TEST_DIR=${ANALYTICS_ZOO_ROOT}/python/llm/test/langchain_gpu
export TEST_BIGDLLLM_MODEL_IDS=${VICUNA_7B_1_3_ORIGIN_PATH}
export TEST_IPEXLLM_MODEL_IDS=${VICUNA_7B_1_3_ORIGIN_PATH}
set -e
echo ">>> Testing LangChain upstream unit test"
cp ${ANALYTICS_ZOO_ROOT}/langchain_upstream/libs/community/tests/integration_tests/llms/test_bigdl_llm.py ${ANALYTICS_ZOO_ROOT}/langchain_upstream
cp ${ANALYTICS_ZOO_ROOT}/langchain_upstream/libs/community/tests/integration_tests/llms/test_ipex_llm.py ${ANALYTICS_ZOO_ROOT}/langchain_upstream
python -m pytest -s ${ANALYTICS_ZOO_ROOT}/langchain_upstream/test_bigdl_llm.py
python -m pytest -s ${ANALYTICS_ZOO_ROOT}/langchain_upstream/test_ipex_llm.py
echo ">>> Testing LangChain upstream ipynb"
cp ${ANALYTICS_ZOO_ROOT}/langchain_upstream/docs/docs/integrations/llms/ipex_llm.ipynb ${ANALYTICS_ZOO_ROOT}/langchain_upstream/langchain_example.ipynb
bash ./apps/ipynb2py.sh ${ANALYTICS_ZOO_ROOT}/langchain_upstream/langchain_example
sed -i '/^get_ipython/d' ${ANALYTICS_ZOO_ROOT}/langchain_upstream/langchain_example.py
sed -i "s,model_id=\"[^\"]*\",model_id=\"$TEST_IPEXLLM_MODEL_IDS\",g" ${ANALYTICS_ZOO_ROOT}/langchain_upstream/langchain_example.py
sed -i 's|saved_lowbit_model_path = "./vicuna-7b-1.5-low-bit"|saved_lowbit_model_path = "./langchain_upstream/vicuna-7b-1.5-low-bit"|' ${ANALYTICS_ZOO_ROOT}/langchain_upstream/langchain_example.py
python ${ANALYTICS_ZOO_ROOT}/langchain_upstream/langchain_example.py
rm -rf ${ANALYTICS_ZOO_ROOT}/langchain_upstream