Skip to content

Commit 99b62ae

Browse files
authored
Integrate DocSum set_env to ut scripts. (#1860)
Integrate DocSum set_env to ut scripts. Add README.md for DocSum and InstructionTuning UT scripts. Signed-off-by: ZePan110 <ze.pan@intel.com>
1 parent c546d96 commit 99b62ae

11 files changed

Lines changed: 108 additions & 121 deletions

File tree

DocSum/docker_compose/amd/gpu/rocm/set_env.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (C) 2024 Advanced Micro Devices, Inc.
44
# SPDX-License-Identifier: Apache-2.0
55

6-
export HOST_IP=''
6+
export HOST_IP=${ip_address}
77
export DOCSUM_MAX_INPUT_TOKENS="2048"
88
export DOCSUM_MAX_TOTAL_TOKENS="4096"
99
export DOCSUM_LLM_MODEL_ID="Intel/neural-chat-7b-v3-3"

DocSum/docker_compose/amd/gpu/rocm/set_env_vllm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# Copyright (C) 2024 Advanced Micro Devices, Inc.
44
# SPDX-License-Identifier: Apache-2.0
55

6-
export HOST_IP=''
6+
export HOST_IP=${ip_address}
77
export DOCSUM_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
88
export DOCSUM_MAX_INPUT_TOKENS=2048
99
export DOCSUM_MAX_TOTAL_TOKENS=4096

DocSum/docker_compose/set_env.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export no_proxy="${no_proxy},${host_ip}" # Example: no_proxy="localhost, 127.0.0
1010
export http_proxy=$http_proxy
1111
export https_proxy=$https_proxy
1212
export host_ip=$(hostname -I | awk '{print $1}') # Example: host_ip="192.168.1.1"
13-
export HUGGINGFACEHUB_API_TOKEN="Your_Huggingface_API_Token"
13+
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
1414

1515
export LLM_ENDPOINT_PORT=8008
1616
export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3"
@@ -20,10 +20,12 @@ export MAX_TOTAL_TOKENS=2048
2020
export LLM_PORT=9000
2121
export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}"
2222
export DocSum_COMPONENT_NAME="OpeaDocSumvLLM" # OpeaDocSumTgi
23-
23+
export FRONTEND_SERVICE_PORT=5173
2424
export MEGA_SERVICE_HOST_IP=${host_ip}
2525
export LLM_SERVICE_HOST_IP=${host_ip}
2626
export ASR_SERVICE_HOST_IP=${host_ip}
2727

2828
export BACKEND_SERVICE_PORT=8888
2929
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/docsum"
30+
31+
export LOGFLAG=True

DocSum/tests/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# DocSum E2E test scripts
2+
3+
## Set the required environment variable
4+
5+
```bash
6+
export HUGGINGFACEHUB_API_TOKEN="Your_Huggingface_API_Token"
7+
```
8+
9+
## Run test
10+
11+
On Intel Xeon with vLLM:
12+
13+
```bash
14+
bash test_compose_on_xeon.sh
15+
```
16+
17+
On Intel Xeon with TGI:
18+
19+
```bash
20+
bash test_compose_tgi_on_xeon.sh
21+
```
22+
23+
On Intel Gaudi with vLLM:
24+
25+
```bash
26+
bash test_compose_on_gaudi.sh
27+
```
28+
29+
On Intel Gaudi with TGI:
30+
31+
```bash
32+
bash test_compose_tgi_on_gaudi.sh
33+
```
34+
35+
On AMD ROCm with TGI:
36+
37+
```bash
38+
bash test_compose_on_rocm.sh
39+
```
40+
41+
On AMD ROCm with vLLM:
42+
43+
```bash
44+
bash test_compose_vllm_on_rocm.sh
45+
```

DocSum/tests/test_compose_on_gaudi.sh

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,22 @@ export http_proxy=$http_proxy
1010
export https_proxy=$https_proxy
1111
export host_ip=$(hostname -I | awk '{print $1}')
1212

13+
WORKPATH=$(dirname "$PWD")
14+
LOG_PATH="$WORKPATH/tests"
1315
echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}"
1416
echo "TAG=IMAGE_TAG=${IMAGE_TAG}"
15-
export no_proxy="${no_proxy},${host_ip}"
16-
export MODEL_CACHE=${model_cache:-"./data"}
1717
export REGISTRY=${IMAGE_REPO}
1818
export TAG=${IMAGE_TAG}
19-
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
20-
export LLM_ENDPOINT_PORT=8008
21-
export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3"
19+
source $WORKPATH/docker_compose/set_env.sh
20+
21+
export MODEL_CACHE=${model_cache:-"./data"}
22+
2223
export NUM_CARDS=1
2324
export BLOCK_SIZE=128
2425
export MAX_NUM_SEQS=256
2526
export MAX_SEQ_LEN_TO_CAPTURE=2048
2627
export MAX_INPUT_TOKENS=2048
2728
export MAX_TOTAL_TOKENS=4096
28-
export LLM_PORT=9000
29-
export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}"
30-
export DocSum_COMPONENT_NAME="OpeaDocSumvLLM"
31-
export MEGA_SERVICE_HOST_IP=${host_ip}
32-
export LLM_SERVICE_HOST_IP=${host_ip}
33-
export ASR_SERVICE_HOST_IP=${host_ip}
34-
export FRONTEND_SERVICE_PORT=5173
35-
export BACKEND_SERVICE_PORT=8888
36-
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/docsum"
37-
export LOGFLAG=True
38-
39-
WORKPATH=$(dirname "$PWD")
40-
LOG_PATH="$WORKPATH/tests"
41-
4229

4330
# Get the root folder of the current script
4431
ROOT_FOLDER=$(dirname "$(readlink -f "$0")")

DocSum/tests/test_compose_on_rocm.sh

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,8 @@ export MODEL_CACHE=${model_cache:-"./data"}
1414
WORKPATH=$(dirname "$PWD")
1515
LOG_PATH="$WORKPATH/tests"
1616
ip_address=$(hostname -I | awk '{print $1}')
17-
18-
export HOST_IP=${ip_address}
1917
export host_ip=${ip_address}
20-
export DOCSUM_MAX_INPUT_TOKENS="2048"
21-
export DOCSUM_MAX_TOTAL_TOKENS="4096"
22-
export DOCSUM_LLM_MODEL_ID="Intel/neural-chat-7b-v3-3"
23-
export DOCSUM_TGI_SERVICE_PORT="8008"
24-
export DOCSUM_TGI_LLM_ENDPOINT="http://${HOST_IP}:${DOCSUM_TGI_SERVICE_PORT}"
25-
export DOCSUM_HUGGINGFACEHUB_API_TOKEN=''
26-
export DOCSUM_WHISPER_PORT="7066"
27-
export ASR_SERVICE_HOST_IP="${HOST_IP}"
28-
export DOCSUM_LLM_SERVER_PORT="9000"
29-
export DOCSUM_BACKEND_SERVER_PORT="18072"
30-
export DOCSUM_FRONTEND_PORT="18073"
31-
export BACKEND_SERVICE_ENDPOINT="http://${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum"
18+
source $WORKPATH/docker_compose/amd/gpu/rocm/set_env.sh
3219

3320
function build_docker_images() {
3421
opea_branch=${opea_branch:-"main"}
@@ -129,23 +116,23 @@ function validate_microservices() {
129116
# whisper microservice
130117
ulimit -s 65536
131118
validate_services \
132-
"${host_ip}:${DOCSUM_WHISPER_PORT}/v1/asr" \
119+
"${HOST_IP}:${DOCSUM_WHISPER_PORT}/v1/asr" \
133120
'{"asr_result":"well"}' \
134121
"whisper-service" \
135122
"whisper-service" \
136123
"{\"audio\": \"$(input_data_for_test "audio")\"}"
137124

138125
# tgi for llm service
139126
validate_services \
140-
"${host_ip}:${DOCSUM_TGI_SERVICE_PORT}/generate" \
127+
"${HOST_IP}:${DOCSUM_TGI_SERVICE_PORT}/generate" \
141128
"generated_text" \
142129
"docsum-tgi-service" \
143130
"docsum-tgi-service" \
144131
'{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}'
145132

146133
# llm microservice
147134
validate_services \
148-
"${host_ip}:${DOCSUM_LLM_SERVER_PORT}/v1/docsum" \
135+
"${HOST_IP}:${DOCSUM_LLM_SERVER_PORT}/v1/docsum" \
149136
"text" \
150137
"docsum-llm-server" \
151138
"docsum-llm-server" \
@@ -158,7 +145,7 @@ function validate_megaservice() {
158145
local DOCKER_NAME="docsum-backend-server"
159146
local EXPECTED_RESULT="[DONE]"
160147
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."
161-
local URL="${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum"
148+
local URL="${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum"
162149
local DATA_TYPE="type=text"
163150

164151
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,23 +175,23 @@ function validate_megaservice_json() {
188175
echo ""
189176
echo ">>> Checking text data with Content-Type: application/json"
190177
validate_services \
191-
"${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \
178+
"${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \
192179
"[DONE]" \
193180
"docsum-backend-server" \
194181
"docsum-backend-server" \
195182
'{"type": "text", "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."}'
196183

197184
echo ">>> Checking audio data"
198185
validate_services \
199-
"${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \
186+
"${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \
200187
"[DONE]" \
201188
"docsum-backend-server" \
202189
"docsum-backend-server" \
203190
"{\"type\": \"audio\", \"messages\": \"$(input_data_for_test "audio")\"}"
204191

205192
echo ">>> Checking video data"
206193
validate_services \
207-
"${host_ip}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \
194+
"${HOST_IP}:${DOCSUM_BACKEND_SERVER_PORT}/v1/docsum" \
208195
"[DONE]" \
209196
"docsum-backend-server" \
210197
"docsum-backend-server" \

DocSum/tests/test_compose_on_xeon.sh

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,18 @@ export http_proxy=$http_proxy
1010
export https_proxy=$https_proxy
1111
export host_ip=$(hostname -I | awk '{print $1}')
1212

13+
WORKPATH=$(dirname "$PWD")
14+
LOG_PATH="$WORKPATH/tests"
1315
echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}"
1416
echo "TAG=IMAGE_TAG=${IMAGE_TAG}"
15-
export no_proxy="${no_proxy},${host_ip}"
16-
export MODEL_CACHE=${model_cache:-"./data"}
1717
export REGISTRY=${IMAGE_REPO}
1818
export TAG=${IMAGE_TAG}
19-
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
20-
export LLM_ENDPOINT_PORT=8008
21-
export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3"
19+
20+
source $WORKPATH/docker_compose/set_env.sh
21+
export MODEL_CACHE=${model_cache:-"./data"}
22+
2223
export MAX_INPUT_TOKENS=2048
2324
export MAX_TOTAL_TOKENS=4096
24-
export LLM_PORT=9000
25-
export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}"
26-
export DocSum_COMPONENT_NAME="OpeaDocSumvLLM"
27-
export MEGA_SERVICE_HOST_IP=${host_ip}
28-
export LLM_SERVICE_HOST_IP=${host_ip}
29-
export ASR_SERVICE_HOST_IP=${host_ip}
30-
export FRONTEND_SERVICE_PORT=5173
31-
export BACKEND_SERVICE_PORT=8888
32-
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/docsum"
33-
export LOGFLAG=True
34-
35-
WORKPATH=$(dirname "$PWD")
36-
LOG_PATH="$WORKPATH/tests"
3725

3826
# Get the root folder of the current script
3927
ROOT_FOLDER=$(dirname "$(readlink -f "$0")")

DocSum/tests/test_compose_tgi_on_gaudi.sh

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,20 @@ IMAGE_TAG=${IMAGE_TAG:-"latest"}
99
export http_proxy=$http_proxy
1010
export https_proxy=$https_proxy
1111
export host_ip=$(hostname -I | awk '{print $1}')
12-
12+
WORKPATH=$(dirname "$PWD")
13+
LOG_PATH="$WORKPATH/tests"
1314
echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}"
1415
echo "TAG=IMAGE_TAG=${IMAGE_TAG}"
15-
export no_proxy="${no_proxy},${host_ip}"
16-
export MODEL_CACHE=${model_cache:-"./data"}
1716
export REGISTRY=${IMAGE_REPO}
1817
export TAG=${IMAGE_TAG}
19-
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
20-
export LLM_ENDPOINT_PORT=8008
21-
export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3"
18+
19+
source $WORKPATH/docker_compose/set_env.sh
20+
export MODEL_CACHE=${model_cache:-"./data"}
21+
2222
export MAX_INPUT_TOKENS=2048
2323
export MAX_TOTAL_TOKENS=4096
24-
export LLM_PORT=9000
25-
export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}"
26-
export DocSum_COMPONENT_NAME="OpeaDocSumTgi"
27-
export MEGA_SERVICE_HOST_IP=${host_ip}
28-
export LLM_SERVICE_HOST_IP=${host_ip}
29-
export ASR_SERVICE_HOST_IP=${host_ip}
30-
export FRONTEND_SERVICE_PORT=5173
31-
export BACKEND_SERVICE_PORT=8888
32-
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/docsum"
33-
export LOGFLAG=True
34-
35-
WORKPATH=$(dirname "$PWD")
36-
LOG_PATH="$WORKPATH/tests"
3724

25+
export DocSum_COMPONENT_NAME="OpeaDocSumTgi"
3826

3927
# Get the root folder of the current script
4028
ROOT_FOLDER=$(dirname "$(readlink -f "$0")")

DocSum/tests/test_compose_tgi_on_xeon.sh

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,20 @@ IMAGE_TAG=${IMAGE_TAG:-"latest"}
99
export http_proxy=$http_proxy
1010
export https_proxy=$https_proxy
1111
export host_ip=$(hostname -I | awk '{print $1}')
12-
12+
WORKPATH=$(dirname "$PWD")
13+
LOG_PATH="$WORKPATH/tests"
1314
echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}"
1415
echo "TAG=IMAGE_TAG=${IMAGE_TAG}"
15-
export no_proxy="${no_proxy},${host_ip}"
16-
export MODEL_CACHE=${model_cache:-"./data"}
1716
export REGISTRY=${IMAGE_REPO}
1817
export TAG=${IMAGE_TAG}
19-
export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
20-
export LLM_ENDPOINT_PORT=8008
21-
export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3"
18+
19+
source $WORKPATH/docker_compose/set_env.sh
20+
export MODEL_CACHE=${model_cache:-"./data"}
21+
2222
export MAX_INPUT_TOKENS=2048
2323
export MAX_TOTAL_TOKENS=4096
24-
export LLM_PORT=9000
25-
export LLM_ENDPOINT="http://${host_ip}:${LLM_ENDPOINT_PORT}"
26-
export DocSum_COMPONENT_NAME="OpeaDocSumTgi"
27-
export MEGA_SERVICE_HOST_IP=${host_ip}
28-
export LLM_SERVICE_HOST_IP=${host_ip}
29-
export ASR_SERVICE_HOST_IP=${host_ip}
30-
export FRONTEND_SERVICE_PORT=5173
31-
export BACKEND_SERVICE_PORT=8888
32-
export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:${BACKEND_SERVICE_PORT}/v1/docsum"
33-
export LOGFLAG=True
3424

35-
WORKPATH=$(dirname "$PWD")
36-
LOG_PATH="$WORKPATH/tests"
25+
export DocSum_COMPONENT_NAME="OpeaDocSumTgi"
3726

3827
# Get the root folder of the current script
3928
ROOT_FOLDER=$(dirname "$(readlink -f "$0")")

0 commit comments

Comments
 (0)