diff --git a/DocSum/docker_compose/amd/gpu/rocm/set_env.sh b/DocSum/docker_compose/amd/gpu/rocm/set_env.sh index f4d5081a2..f59784998 100644 --- a/DocSum/docker_compose/amd/gpu/rocm/set_env.sh +++ b/DocSum/docker_compose/amd/gpu/rocm/set_env.sh @@ -3,7 +3,7 @@ # Copyright (C) 2024 Advanced Micro Devices, Inc. # SPDX-License-Identifier: Apache-2.0 -export HOST_IP='' +export HOST_IP=${ip_address} export DOCSUM_MAX_INPUT_TOKENS="2048" export DOCSUM_MAX_TOTAL_TOKENS="4096" export DOCSUM_LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" diff --git a/DocSum/docker_compose/amd/gpu/rocm/set_env_vllm.sh b/DocSum/docker_compose/amd/gpu/rocm/set_env_vllm.sh index eb12d07dd..800e50207 100644 --- a/DocSum/docker_compose/amd/gpu/rocm/set_env_vllm.sh +++ b/DocSum/docker_compose/amd/gpu/rocm/set_env_vllm.sh @@ -3,7 +3,7 @@ # Copyright (C) 2024 Advanced Micro Devices, Inc. # SPDX-License-Identifier: Apache-2.0 -export HOST_IP='' +export HOST_IP=${ip_address} export DOCSUM_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} export DOCSUM_MAX_INPUT_TOKENS=2048 export DOCSUM_MAX_TOTAL_TOKENS=4096 diff --git a/DocSum/docker_compose/set_env.sh b/DocSum/docker_compose/set_env.sh index f41b3c875..6f5351479 100644 --- a/DocSum/docker_compose/set_env.sh +++ b/DocSum/docker_compose/set_env.sh @@ -10,7 +10,7 @@ export no_proxy="${no_proxy},${host_ip}" # Example: no_proxy="localhost, 127.0.0 export http_proxy=$http_proxy export https_proxy=$https_proxy export host_ip=$(hostname -I | awk '{print $1}') # Example: host_ip="192.168.1.1" -export HUGGINGFACEHUB_API_TOKEN="Your_Huggingface_API_Token" +export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} export LLM_ENDPOINT_PORT=8008 export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" @@ -20,10 +20,12 @@ export MAX_TOTAL_TOKENS=2048 export LLM_PORT=9000 export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}" export DocSum_COMPONENT_NAME="OpeaDocSumvLLM" # OpeaDocSumTgi - +export FRONTEND_SERVICE_PORT=5173 export MEGA_SERVICE_HOST_IP=${host_ip} export LLM_SERVICE_HOST_IP=${host_ip} export ASR_SERVICE_HOST_IP=${host_ip} export BACKEND_SERVICE_PORT=8888 export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/docsum" + +export LOGFLAG=True diff --git a/DocSum/tests/README.md b/DocSum/tests/README.md new file mode 100644 index 000000000..6d5f55c7f --- /dev/null +++ b/DocSum/tests/README.md @@ -0,0 +1,45 @@ +# DocSum E2E test scripts + +## Set the required environment variable + +```bash +export HUGGINGFACEHUB_API_TOKEN="Your_Huggingface_API_Token" +``` + +## Run test + +On Intel Xeon with vLLM: + +```bash +bash test_compose_on_xeon.sh +``` + +On Intel Xeon with TGI: + +```bash +bash test_compose_tgi_on_xeon.sh +``` + +On Intel Gaudi with vLLM: + +```bash +bash test_compose_on_gaudi.sh +``` + +On Intel Gaudi with TGI: + +```bash +bash test_compose_tgi_on_gaudi.sh +``` + +On AMD ROCm with TGI: + +```bash +bash test_compose_on_rocm.sh +``` + +On AMD ROCm with vLLM: + +```bash +bash test_compose_vllm_on_rocm.sh +``` diff --git a/DocSum/tests/test_compose_on_gaudi.sh b/DocSum/tests/test_compose_on_gaudi.sh index ffaa50a9f..aecdc006c 100644 --- a/DocSum/tests/test_compose_on_gaudi.sh +++ b/DocSum/tests/test_compose_on_gaudi.sh @@ -10,35 +10,22 @@ export http_proxy=$http_proxy export https_proxy=$https_proxy export host_ip=$(hostname -I | awk '{print $1}') +WORKPATH=$(dirname "$PWD") +LOG_PATH="$WORKPATH/tests" echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}" echo "TAG=IMAGE_TAG=${IMAGE_TAG}" -export no_proxy="${no_proxy},${host_ip}" -export MODEL_CACHE=${model_cache:-"./data"} export REGISTRY=${IMAGE_REPO} export TAG=${IMAGE_TAG} -export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -export LLM_ENDPOINT_PORT=8008 -export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" +source $WORKPATH/docker_compose/set_env.sh + +export MODEL_CACHE=${model_cache:-"./data"} + export NUM_CARDS=1 export BLOCK_SIZE=128 export MAX_NUM_SEQS=256 export MAX_SEQ_LEN_TO_CAPTURE=2048 export MAX_INPUT_TOKENS=2048 export MAX_TOTAL_TOKENS=4096 -export LLM_PORT=9000 -export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}" -export DocSum_COMPONENT_NAME="OpeaDocSumvLLM" -export MEGA_SERVICE_HOST_IP=${host_ip} -export LLM_SERVICE_HOST_IP=${host_ip} -export ASR_SERVICE_HOST_IP=${host_ip} -export FRONTEND_SERVICE_PORT=5173 -export BACKEND_SERVICE_PORT=8888 -export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/docsum" -export LOGFLAG=True - -WORKPATH=$(dirname "$PWD") -LOG_PATH="$WORKPATH/tests" - # Get the root folder of the current script ROOT_FOLDER=$(dirname "$(readlink -f "$0")") diff --git a/DocSum/tests/test_compose_on_rocm.sh b/DocSum/tests/test_compose_on_rocm.sh index c0d4c22d0..ee95ffc0b 100644 --- a/DocSum/tests/test_compose_on_rocm.sh +++ b/DocSum/tests/test_compose_on_rocm.sh @@ -14,21 +14,8 @@ export MODEL_CACHE=${model_cache:-"./data"} WORKPATH=$(dirname "$PWD") LOG_PATH="$WORKPATH/tests" ip_address=$(hostname -I | awk '{print $1}') - -export HOST_IP=${ip_address} export host_ip=${ip_address} -export DOCSUM_MAX_INPUT_TOKENS="2048" -export DOCSUM_MAX_TOTAL_TOKENS="4096" -export DOCSUM_LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" -export DOCSUM_TGI_SERVICE_PORT="8008" -export DOCSUM_TGI_LLM_ENDPOINT="http://${HOST_IP}:${DOCSUM_TGI_SERVICE_PORT}" -export DOCSUM_HUGGINGFACEHUB_API_TOKEN='' -export DOCSUM_WHISPER_PORT="7066" -export ASR_SERVICE_HOST_IP="${HOST_IP}" -export DOCSUM_LLM_SERVER_PORT="9000" -export DOCSUM_BACKEND_SERVER_PORT="18072" -export DOCSUM_FRONTEND_PORT="18073" -export BACKEND_SERVICE_ENDPOINT="http://${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" +source $WORKPATH/docker_compose/amd/gpu/rocm/set_env.sh function build_docker_images() { opea_branch=${opea_branch:-"main"} @@ -129,7 +116,7 @@ function validate_microservices() { # whisper microservice ulimit -s 65536 validate_services \ - "${host_ip}:${DOCSUM_WHISPER_PORT}/v1/asr" \ + "${HOST_IP}:${DOCSUM_WHISPER_PORT}/v1/asr" \ '{"asr_result":"well"}' \ "whisper-service" \ "whisper-service" \ @@ -137,7 +124,7 @@ function validate_microservices() { # tgi for llm service validate_services \ - "${host_ip}:${DOCSUM_TGI_SERVICE_PORT}/generate" \ + "${HOST_IP}:${DOCSUM_TGI_SERVICE_PORT}/generate" \ "generated_text" \ "docsum-tgi-service" \ "docsum-tgi-service" \ @@ -145,7 +132,7 @@ function validate_microservices() { # llm microservice validate_services \ - "${host_ip}:${DOCSUM_LLM_SERVER_PORT}/v1/docsum" \ + "${HOST_IP}:${DOCSUM_LLM_SERVER_PORT}/v1/docsum" \ "text" \ "docsum-llm-server" \ "docsum-llm-server" \ @@ -158,7 +145,7 @@ function validate_megaservice() { local DOCKER_NAME="docsum-backend-server" local EXPECTED_RESULT="[DONE]" local INPUT_DATA="messages=Text Embeddings Inference (TEI) is a toolkit for deploying and serving open source text embeddings and sequence classification models. TEI enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE and E5." - local URL="${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" + local URL="${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" local DATA_TYPE="type=text" local HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST -F "$DATA_TYPE" -F "$INPUT_DATA" -H 'Content-Type: multipart/form-data' "$URL") @@ -188,7 +175,7 @@ function validate_megaservice_json() { echo "" echo ">>> Checking text data with Content-Type: application/json" validate_services \ - "${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ + "${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ "[DONE]" \ "docsum-backend-server" \ "docsum-backend-server" \ @@ -196,7 +183,7 @@ function validate_megaservice_json() { echo ">>> Checking audio data" validate_services \ - "${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ + "${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ "[DONE]" \ "docsum-backend-server" \ "docsum-backend-server" \ @@ -204,7 +191,7 @@ function validate_megaservice_json() { echo ">>> Checking video data" validate_services \ - "${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ + "${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ "[DONE]" \ "docsum-backend-server" \ "docsum-backend-server" \ diff --git a/DocSum/tests/test_compose_on_xeon.sh b/DocSum/tests/test_compose_on_xeon.sh index c0b340b7c..5ff7add6b 100644 --- a/DocSum/tests/test_compose_on_xeon.sh +++ b/DocSum/tests/test_compose_on_xeon.sh @@ -10,30 +10,18 @@ export http_proxy=$http_proxy export https_proxy=$https_proxy export host_ip=$(hostname -I | awk '{print $1}') -echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}" -echo "TAG=IMAGE_TAG=${IMAGE_TAG}" -export no_proxy="${no_proxy},${host_ip}" -export MODEL_CACHE=${model_cache:-"./data"} -export REGISTRY=${IMAGE_REPO} -export TAG=${IMAGE_TAG} -export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -export LLM_ENDPOINT_PORT=8008 -export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" -export MAX_INPUT_TOKENS=2048 -export MAX_TOTAL_TOKENS=4096 -export LLM_PORT=9000 -export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}" -export DocSum_COMPONENT_NAME="OpeaDocSumvLLM" -export MEGA_SERVICE_HOST_IP=${host_ip} -export LLM_SERVICE_HOST_IP=${host_ip} -export ASR_SERVICE_HOST_IP=${host_ip} -export FRONTEND_SERVICE_PORT=5173 -export BACKEND_SERVICE_PORT=8888 -export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/docsum" -export LOGFLAG=True - WORKPATH=$(dirname "$PWD") LOG_PATH="$WORKPATH/tests" +echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}" +echo "TAG=IMAGE_TAG=${IMAGE_TAG}" +export REGISTRY=${IMAGE_REPO} +export TAG=${IMAGE_TAG} + +source $WORKPATH/docker_compose/set_env.sh +export MODEL_CACHE=${model_cache:-"./data"} + +export MAX_INPUT_TOKENS=2048 +export MAX_TOTAL_TOKENS=4096 # Get the root folder of the current script ROOT_FOLDER=$(dirname "$(readlink -f "$0")") diff --git a/DocSum/tests/test_compose_tgi_on_gaudi.sh b/DocSum/tests/test_compose_tgi_on_gaudi.sh index 3f21cdee8..6859e5354 100644 --- a/DocSum/tests/test_compose_tgi_on_gaudi.sh +++ b/DocSum/tests/test_compose_tgi_on_gaudi.sh @@ -9,32 +9,20 @@ IMAGE_TAG=${IMAGE_TAG:-"latest"} export http_proxy=$http_proxy export https_proxy=$https_proxy export host_ip=$(hostname -I | awk '{print $1}') - -echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}" -echo "TAG=IMAGE_TAG=${IMAGE_TAG}" -export no_proxy="${no_proxy},${host_ip}" -export MODEL_CACHE=${model_cache:-"./data"} -export REGISTRY=${IMAGE_REPO} -export TAG=${IMAGE_TAG} -export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -export LLM_ENDPOINT_PORT=8008 -export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" -export MAX_INPUT_TOKENS=2048 -export MAX_TOTAL_TOKENS=4096 -export LLM_PORT=9000 -export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}" -export DocSum_COMPONENT_NAME="OpeaDocSumTgi" -export MEGA_SERVICE_HOST_IP=${host_ip} -export LLM_SERVICE_HOST_IP=${host_ip} -export ASR_SERVICE_HOST_IP=${host_ip} -export FRONTEND_SERVICE_PORT=5173 -export BACKEND_SERVICE_PORT=8888 -export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/docsum" -export LOGFLAG=True - WORKPATH=$(dirname "$PWD") LOG_PATH="$WORKPATH/tests" +echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}" +echo "TAG=IMAGE_TAG=${IMAGE_TAG}" +export REGISTRY=${IMAGE_REPO} +export TAG=${IMAGE_TAG} +source $WORKPATH/docker_compose/set_env.sh +export MODEL_CACHE=${model_cache:-"./data"} + +export MAX_INPUT_TOKENS=2048 +export MAX_TOTAL_TOKENS=4096 + +export DocSum_COMPONENT_NAME="OpeaDocSumTgi" # Get the root folder of the current script ROOT_FOLDER=$(dirname "$(readlink -f "$0")") diff --git a/DocSum/tests/test_compose_tgi_on_xeon.sh b/DocSum/tests/test_compose_tgi_on_xeon.sh index 3d7b3f1b2..f94eabf0c 100644 --- a/DocSum/tests/test_compose_tgi_on_xeon.sh +++ b/DocSum/tests/test_compose_tgi_on_xeon.sh @@ -9,31 +9,20 @@ IMAGE_TAG=${IMAGE_TAG:-"latest"} export http_proxy=$http_proxy export https_proxy=$https_proxy export host_ip=$(hostname -I | awk '{print $1}') - -echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}" -echo "TAG=IMAGE_TAG=${IMAGE_TAG}" -export no_proxy="${no_proxy},${host_ip}" -export MODEL_CACHE=${model_cache:-"./data"} -export REGISTRY=${IMAGE_REPO} -export TAG=${IMAGE_TAG} -export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -export LLM_ENDPOINT_PORT=8008 -export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" -export MAX_INPUT_TOKENS=2048 -export MAX_TOTAL_TOKENS=4096 -export LLM_PORT=9000 -export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}" -export DocSum_COMPONENT_NAME="OpeaDocSumTgi" -export MEGA_SERVICE_HOST_IP=${host_ip} -export LLM_SERVICE_HOST_IP=${host_ip} -export ASR_SERVICE_HOST_IP=${host_ip} -export FRONTEND_SERVICE_PORT=5173 -export BACKEND_SERVICE_PORT=8888 -export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/docsum" -export LOGFLAG=True - WORKPATH=$(dirname "$PWD") LOG_PATH="$WORKPATH/tests" +echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}" +echo "TAG=IMAGE_TAG=${IMAGE_TAG}" +export REGISTRY=${IMAGE_REPO} +export TAG=${IMAGE_TAG} + +source $WORKPATH/docker_compose/set_env.sh +export MODEL_CACHE=${model_cache:-"./data"} + +export MAX_INPUT_TOKENS=2048 +export MAX_TOTAL_TOKENS=4096 + +export DocSum_COMPONENT_NAME="OpeaDocSumTgi" # Get the root folder of the current script ROOT_FOLDER=$(dirname "$(readlink -f "$0")") diff --git a/DocSum/tests/test_compose_vllm_on_rocm.sh b/DocSum/tests/test_compose_vllm_on_rocm.sh index 40d10b039..2eb360f17 100644 --- a/DocSum/tests/test_compose_vllm_on_rocm.sh +++ b/DocSum/tests/test_compose_vllm_on_rocm.sh @@ -16,21 +16,7 @@ WORKPATH=$(dirname "$PWD") LOG_PATH="$WORKPATH/tests" ip_address=$(hostname -I | awk '{print $1}') -export host_ip=${ip_address} -export HOST_IP=${ip_address} -export EXTERNAL_HOST_IP=${ip_address} -export DOCSUM_HUGGINGFACEHUB_API_TOKEN="${HUGGINGFACEHUB_API_TOKEN}" -export DOCSUM_MAX_INPUT_TOKENS=2048 -export DOCSUM_MAX_TOTAL_TOKENS=4096 -export DOCSUM_LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" -export DOCSUM_VLLM_SERVICE_PORT="8008" -export DOCSUM_LLM_ENDPOINT="http://${HOST_IP}:${DOCSUM_VLLM_SERVICE_PORT}" -export DOCSUM_WHISPER_PORT="7066" -export ASR_SERVICE_HOST_IP="${HOST_IP}" -export DOCSUM_LLM_SERVER_PORT="9000" -export DOCSUM_BACKEND_SERVER_PORT="18072" -export DOCSUM_FRONTEND_PORT="18073" -export BACKEND_SERVICE_ENDPOINT="http://${EXTERNAL_HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" +source $WORKPATH/docker_compose/amd/gpu/rocm/set_env_vllm.sh function build_docker_images() { opea_branch=${opea_branch:-"main"} @@ -130,7 +116,7 @@ function validate_microservices() { # whisper microservice ulimit -s 65536 validate_services \ - "${host_ip}:${DOCSUM_WHISPER_PORT}/v1/asr" \ + "${HOST_IP}:${DOCSUM_WHISPER_PORT}/v1/asr" \ '{"asr_result":"well"}' \ "whisper-service" \ "whisper-service" \ @@ -138,7 +124,7 @@ function validate_microservices() { # vLLM service validate_services \ - "${host_ip}:${DOCSUM_VLLM_SERVICE_PORT}/v1/chat/completions" \ + "${HOST_IP}:${DOCSUM_VLLM_SERVICE_PORT}/v1/chat/completions" \ "content" \ "docsum-vllm-service" \ "docsum-vllm-service" \ @@ -146,7 +132,7 @@ function validate_microservices() { # llm microservice validate_services \ - "${host_ip}:${DOCSUM_LLM_SERVER_PORT}/v1/docsum" \ + "${HOST_IP}:${DOCSUM_LLM_SERVER_PORT}/v1/docsum" \ "text" \ "docsum-llm-server" \ "docsum-llm-server" \ @@ -159,7 +145,7 @@ function validate_megaservice() { local DOCKER_NAME="docsum-backend-server" local EXPECTED_RESULT="[DONE]" local INPUT_DATA="messages=Text Embeddings Inference (TEI) is a toolkit for deploying and serving open source text embeddings and sequence classification models. TEI enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE and E5." - local URL="${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" + local URL="${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" local DATA_TYPE="type=text" local HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" -X POST -F "$DATA_TYPE" -F "$INPUT_DATA" -H 'Content-Type: multipart/form-data' "$URL") @@ -189,7 +175,7 @@ function validate_megaservice_json() { echo "" echo ">>> Checking text data with Content-Type: application/json" validate_services \ - "${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ + "${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ "[DONE]" \ "docsum-backend-server" \ "docsum-backend-server" \ @@ -197,7 +183,7 @@ function validate_megaservice_json() { echo ">>> Checking audio data" validate_services \ - "${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ + "${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ "[DONE]" \ "docsum-backend-server" \ "docsum-backend-server" \ @@ -205,7 +191,7 @@ function validate_megaservice_json() { echo ">>> Checking video data" validate_services \ - "${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ + "${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \ "[DONE]" \ "docsum-backend-server" \ "docsum-backend-server" \ diff --git a/InstructionTuning/tests/README.md b/InstructionTuning/tests/README.md new file mode 100644 index 000000000..fd43a2b4a --- /dev/null +++ b/InstructionTuning/tests/README.md @@ -0,0 +1,15 @@ +# Translation E2E test scripts + +## Set the required environment variable + +```bash +export HUGGINGFACEHUB_API_TOKEN="Your_Huggingface_API_Token" +``` + +## Run test + +On Intel Xeon: + +```bash +bash test_compose_on_xeon.sh +```