From 95a386068497ba31b2529a1444d8fccfab6579c8 Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Wed, 23 Apr 2025 11:10:33 +0800 Subject: [PATCH 1/2] Integrate set_env to ut scripts. Signed-off-by: ZePan110 --- .../docker_compose/amd/gpu/rocm/set_env.sh | 14 +++--- .../amd/gpu/rocm/set_env_vllm.sh | 14 +++--- CodeTrans/tests/README.md | 45 +++++++++++++++++++ CodeTrans/tests/test_compose_on_gaudi.sh | 23 +++------- CodeTrans/tests/test_compose_on_rocm.sh | 16 +------ CodeTrans/tests/test_compose_on_xeon.sh | 16 ++----- CodeTrans/tests/test_compose_tgi_on_gaudi.sh | 16 ++----- CodeTrans/tests/test_compose_tgi_on_xeon.sh | 16 ++----- CodeTrans/tests/test_compose_vllm_on_rocm.sh | 17 +------ 9 files changed, 78 insertions(+), 99 deletions(-) create mode 100644 CodeTrans/tests/README.md diff --git a/CodeTrans/docker_compose/amd/gpu/rocm/set_env.sh b/CodeTrans/docker_compose/amd/gpu/rocm/set_env.sh index c62b26477b..c1acc4464d 100644 --- a/CodeTrans/docker_compose/amd/gpu/rocm/set_env.sh +++ b/CodeTrans/docker_compose/amd/gpu/rocm/set_env.sh @@ -8,14 +8,14 @@ # which can be used to connect to the server from the Internet. It must be specified in the EXTERNAL_HOST_IP variable. # If the server is used only on the internal network or has a direct external address, # specify it in HOST_IP and in EXTERNAL_HOST_IP. -export HOST_IP='' -export EXTERNAL_HOST_IP='' +export HOST_IP=${ip_address} +export EXTERNAL_HOST_IP=${ip_address} ### Model ID export CODETRANS_LLM_MODEL_ID="Qwen/Qwen2.5-Coder-7B-Instruct" ### The port of the TGI service. On this port, the TGI service will accept connections -export CODETRANS_TGI_SERVICE_PORT=18156 +export CODETRANS_TGI_SERVICE_PORT=8008 ### The endpoint of the TGI service to which requests to this service will be sent (formed from previously set variables) export CODETRANS_TGI_LLM_ENDPOINT="http://${HOST_IP}:${CODETRANS_TGI_SERVICE_PORT}" @@ -24,7 +24,7 @@ export CODETRANS_TGI_LLM_ENDPOINT="http://${HOST_IP}:${CODETRANS_TGI_SERVICE_POR export CODETRANS_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} ### The port of the LLM service. On this port, the LLM service will accept connections -export CODETRANS_LLM_SERVICE_PORT=18157 +export CODETRANS_LLM_SERVICE_PORT=9000 ### The IP address or domain name of the server for CodeTrans MegaService export CODETRANS_MEGA_SERVICE_HOST_IP=${HOST_IP} @@ -36,7 +36,7 @@ export CODETRANS_LLM_SERVICE_HOST_IP=${HOST_IP} export CODETRANS_FRONTEND_SERVICE_IP=${HOST_IP} ### The port of the frontend service -export CODETRANS_FRONTEND_SERVICE_PORT=18155 +export CODETRANS_FRONTEND_SERVICE_PORT=5173 ### Name of GenAI service for route requests to application export CODETRANS_BACKEND_SERVICE_NAME=codetrans @@ -45,10 +45,10 @@ export CODETRANS_BACKEND_SERVICE_NAME=codetrans export CODETRANS_BACKEND_SERVICE_IP=${HOST_IP} ### The port of the backend service -export CODETRANS_BACKEND_SERVICE_PORT=18154 +export CODETRANS_BACKEND_SERVICE_PORT=7777 ### The port of the Nginx reverse proxy for application -export CODETRANS_NGINX_PORT=18153 +export CODETRANS_NGINX_PORT=8088 ### Endpoint of the backend service export CODETRANS_BACKEND_SERVICE_URL="http://${EXTERNAL_HOST_IP}:${CODETRANS_BACKEND_SERVICE_PORT}/v1/codetrans" diff --git a/CodeTrans/docker_compose/amd/gpu/rocm/set_env_vllm.sh b/CodeTrans/docker_compose/amd/gpu/rocm/set_env_vllm.sh index cafa4a19a1..ffcbd35df5 100644 --- a/CodeTrans/docker_compose/amd/gpu/rocm/set_env_vllm.sh +++ b/CodeTrans/docker_compose/amd/gpu/rocm/set_env_vllm.sh @@ -8,14 +8,14 @@ # which can be used to connect to the server from the Internet. It must be specified in the EXTERNAL_HOST_IP variable. # If the server is used only on the internal network or has a direct external address, # specify it in HOST_IP and in EXTERNAL_HOST_IP. -export HOST_IP='' -export EXTERNAL_HOST_IP='' +export HOST_IP=${ip_address} +export EXTERNAL_HOST_IP=${ip_address} ### Model ID export CODETRANS_LLM_MODEL_ID="Qwen/Qwen2.5-Coder-7B-Instruct" ### The port of the TGI service. On this port, the TGI service will accept connections -export CODETRANS_VLLM_SERVICE_PORT=18156 +export CODETRANS_VLLM_SERVICE_PORT=8008 ### The endpoint of the TGI service to which requests to this service will be sent (formed from previously set variables) export CODETRANS_LLM_ENDPOINT="http://${HOST_IP}:${CODETRANS_VLLM_SERVICE_PORT}" @@ -24,7 +24,7 @@ export CODETRANS_LLM_ENDPOINT="http://${HOST_IP}:${CODETRANS_VLLM_SERVICE_PORT}" export CODETRANS_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} ### The port of the LLM service. On this port, the LLM service will accept connections -export CODETRANS_LLM_SERVICE_PORT=18157 +export CODETRANS_LLM_SERVICE_PORT=9000 ### The IP address or domain name of the server for CodeTrans MegaService export CODETRANS_MEGA_SERVICE_HOST_IP=${HOST_IP} @@ -36,7 +36,7 @@ export CODETRANS_LLM_SERVICE_HOST_IP=${HOST_IP} export CODETRANS_FRONTEND_SERVICE_IP=${HOST_IP} ### The port of the frontend service -export CODETRANS_FRONTEND_SERVICE_PORT=18155 +export CODETRANS_FRONTEND_SERVICE_PORT=5173 ### Name of GenAI service for route requests to application export CODETRANS_BACKEND_SERVICE_NAME=codetrans @@ -45,10 +45,10 @@ export CODETRANS_BACKEND_SERVICE_NAME=codetrans export CODETRANS_BACKEND_SERVICE_IP=${HOST_IP} ### The port of the backend service -export CODETRANS_BACKEND_SERVICE_PORT=18154 +export CODETRANS_BACKEND_SERVICE_PORT=7777 ### The port of the Nginx reverse proxy for application -export CODETRANS_NGINX_PORT=18153 +export CODETRANS_NGINX_PORT=8088 ### Endpoint of the backend service export CODETRANS_BACKEND_SERVICE_URL="http://${EXTERNAL_HOST_IP}:${CODETRANS_BACKEND_SERVICE_PORT}/v1/codetrans" diff --git a/CodeTrans/tests/README.md b/CodeTrans/tests/README.md new file mode 100644 index 0000000000..62edebc6a8 --- /dev/null +++ b/CodeTrans/tests/README.md @@ -0,0 +1,45 @@ +# CodeTrans E2E test scripts + +## Set the required environment variable + +```bash +export HUGGINGFACEHUB_API_TOKEN="Your_Huggingface_API_Token" +``` + +## Run test + +On Intel Xeon with TGI: + +```bash +bash test_compose_tgi_on_xeon.sh +``` + +On Intel Xeon with vLLM: + +```bash +bash test_compose_on_xeon.sh +``` + +On Intel Gaudi with TGI: + +```bash +bash test_compose_tgi_on_gaudi.sh +``` + +On Intel Gaudi with vLLM: + +```bash +bash test_compose_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/CodeTrans/tests/test_compose_on_gaudi.sh b/CodeTrans/tests/test_compose_on_gaudi.sh index 8d4691f849..ce4b682775 100644 --- a/CodeTrans/tests/test_compose_on_gaudi.sh +++ b/CodeTrans/tests/test_compose_on_gaudi.sh @@ -42,28 +42,15 @@ function build_docker_images() { } function start_services() { - cd $WORKPATH/docker_compose/intel/hpu/gaudi - + cd $WORKPATH/docker_compose + export host_ip=${ip_address} export http_proxy=${http_proxy} export https_proxy=${http_proxy} - export LLM_MODEL_ID="mistralai/Mistral-7B-Instruct-v0.3" - export LLM_ENDPOINT="http://${ip_address}:8008" - export LLM_COMPONENT_NAME="OpeaTextGenService" - export NUM_CARDS=1 - export BLOCK_SIZE=128 - export MAX_NUM_SEQS=256 - export MAX_SEQ_LEN_TO_CAPTURE=2048 + export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} - export MEGA_SERVICE_HOST_IP=${ip_address} - export LLM_SERVICE_HOST_IP=${ip_address} - export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:7777/v1/codetrans" - export FRONTEND_SERVICE_IP=${ip_address} - export FRONTEND_SERVICE_PORT=5173 - export BACKEND_SERVICE_NAME=codetrans - export BACKEND_SERVICE_IP=${ip_address} - export BACKEND_SERVICE_PORT=7777 export NGINX_PORT=80 - export host_ip=${ip_address} + source set_env.sh + cd intel/hpu/gaudi sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env diff --git a/CodeTrans/tests/test_compose_on_rocm.sh b/CodeTrans/tests/test_compose_on_rocm.sh index b0cbbd62a1..e0d96cafa9 100644 --- a/CodeTrans/tests/test_compose_on_rocm.sh +++ b/CodeTrans/tests/test_compose_on_rocm.sh @@ -44,21 +44,7 @@ function start_services() { cd $WORKPATH/docker_compose/amd/gpu/rocm/ export http_proxy=${http_proxy} export https_proxy=${http_proxy} - export CODETRANS_TGI_SERVICE_PORT=8008 - export CODETRANS_LLM_SERVICE_PORT=9000 - export CODETRANS_LLM_MODEL_ID="Qwen/Qwen2.5-Coder-7B-Instruct" - export CODETRANS_TGI_LLM_ENDPOINT="http://${ip_address}:${CODETRANS_TGI_SERVICE_PORT}" - export CODETRANS_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} - export CODETRANS_MEGA_SERVICE_HOST_IP=${ip_address} - export CODETRANS_LLM_SERVICE_HOST_IP=${ip_address} - export CODETRANS_FRONTEND_SERVICE_IP=${ip_address} - export CODETRANS_FRONTEND_SERVICE_PORT=5173 - export CODETRANS_BACKEND_SERVICE_NAME=codetrans - export CODETRANS_BACKEND_SERVICE_IP=${ip_address} - export CODETRANS_BACKEND_SERVICE_PORT=7777 - export CODETRANS_NGINX_PORT=8088 - export CODETRANS_BACKEND_SERVICE_URL="http://${ip_address}:${CODETRANS_BACKEND_SERVICE_PORT}/v1/codetrans" - export HOST_IP=${ip_address} + source set_env.sh sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env diff --git a/CodeTrans/tests/test_compose_on_xeon.sh b/CodeTrans/tests/test_compose_on_xeon.sh index 8b279b2f2e..53acc776a4 100644 --- a/CodeTrans/tests/test_compose_on_xeon.sh +++ b/CodeTrans/tests/test_compose_on_xeon.sh @@ -44,23 +44,15 @@ function build_docker_images() { } function start_services() { - cd $WORKPATH/docker_compose/intel/cpu/xeon/ + cd $WORKPATH/docker_compose export http_proxy=${http_proxy} export https_proxy=${http_proxy} - export LLM_MODEL_ID="mistralai/Mistral-7B-Instruct-v0.3" - export LLM_ENDPOINT="http://${ip_address}:8008" - export LLM_COMPONENT_NAME="OpeaTextGenService" export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} - export MEGA_SERVICE_HOST_IP=${ip_address} - export LLM_SERVICE_HOST_IP=${ip_address} - export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:7777/v1/codetrans" - export FRONTEND_SERVICE_IP=${ip_address} - export FRONTEND_SERVICE_PORT=5173 - export BACKEND_SERVICE_NAME=codetrans - export BACKEND_SERVICE_IP=${ip_address} - export BACKEND_SERVICE_PORT=7777 + export NGINX_PORT=80 export host_ip=${ip_address} + source set_env.sh + cd intel/cpu/xeon/ sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env diff --git a/CodeTrans/tests/test_compose_tgi_on_gaudi.sh b/CodeTrans/tests/test_compose_tgi_on_gaudi.sh index 1c0404d397..6cb4893f31 100644 --- a/CodeTrans/tests/test_compose_tgi_on_gaudi.sh +++ b/CodeTrans/tests/test_compose_tgi_on_gaudi.sh @@ -40,23 +40,15 @@ function build_docker_images() { } function start_services() { - cd $WORKPATH/docker_compose/intel/hpu/gaudi/ + cd $WORKPATH/docker_compose export http_proxy=${http_proxy} export https_proxy=${http_proxy} - export LLM_MODEL_ID="mistralai/Mistral-7B-Instruct-v0.3" - export LLM_ENDPOINT="http://${ip_address}:8008" - export LLM_COMPONENT_NAME="OpeaTextGenService" export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} - export MEGA_SERVICE_HOST_IP=${ip_address} - export LLM_SERVICE_HOST_IP=${ip_address} - export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:7777/v1/codetrans" - export FRONTEND_SERVICE_IP=${ip_address} - export FRONTEND_SERVICE_PORT=5173 - export BACKEND_SERVICE_NAME=codetrans - export BACKEND_SERVICE_IP=${ip_address} - export BACKEND_SERVICE_PORT=7777 + export NGINX_PORT=80 export host_ip=${ip_address} + source set_env.sh + cd intel/hpu/gaudi/ sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env diff --git a/CodeTrans/tests/test_compose_tgi_on_xeon.sh b/CodeTrans/tests/test_compose_tgi_on_xeon.sh index 95154c7c9d..bdebbf27ff 100644 --- a/CodeTrans/tests/test_compose_tgi_on_xeon.sh +++ b/CodeTrans/tests/test_compose_tgi_on_xeon.sh @@ -40,23 +40,15 @@ function build_docker_images() { } function start_services() { - cd $WORKPATH/docker_compose/intel/cpu/xeon/ + cd $WORKPATH/docker_compose export http_proxy=${http_proxy} export https_proxy=${http_proxy} - export LLM_MODEL_ID="mistralai/Mistral-7B-Instruct-v0.3" - export LLM_ENDPOINT="http://${ip_address}:8008" - export LLM_COMPONENT_NAME="OpeaTextGenService" export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} - export MEGA_SERVICE_HOST_IP=${ip_address} - export LLM_SERVICE_HOST_IP=${ip_address} - export BACKEND_SERVICE_ENDPOINT="http://${ip_address}:7777/v1/codetrans" - export FRONTEND_SERVICE_IP=${ip_address} - export FRONTEND_SERVICE_PORT=5173 - export BACKEND_SERVICE_NAME=codetrans - export BACKEND_SERVICE_IP=${ip_address} - export BACKEND_SERVICE_PORT=7777 + export NGINX_PORT=80 export host_ip=${ip_address} + source set_env.sh + cd intel/cpu/xeon/ sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env diff --git a/CodeTrans/tests/test_compose_vllm_on_rocm.sh b/CodeTrans/tests/test_compose_vllm_on_rocm.sh index 4574da774b..c0a8b25175 100644 --- a/CodeTrans/tests/test_compose_vllm_on_rocm.sh +++ b/CodeTrans/tests/test_compose_vllm_on_rocm.sh @@ -42,22 +42,7 @@ function start_services() { cd $WORKPATH/docker_compose/amd/gpu/rocm/ export http_proxy=${http_proxy} export https_proxy=${http_proxy} - export HOST_IP=${ip_address} - export CODETRANS_VLLM_SERVICE_PORT=8008 - export CODETRANS_LLM_SERVICE_PORT=9000 - export CODETRANS_LLM_MODEL_ID="Qwen/Qwen2.5-Coder-7B-Instruct" - export CODETRANS_LLM_ENDPOINT="http://${ip_address}:${CODETRANS_VLLM_SERVICE_PORT}" - export CODETRANS_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} - export CODETRANS_MEGA_SERVICE_HOST_IP=${ip_address} - export CODETRANS_LLM_SERVICE_HOST_IP=${ip_address} - export CODETRANS_FRONTEND_SERVICE_IP=${ip_address} - export CODETRANS_FRONTEND_SERVICE_PORT=5173 - export CODETRANS_BACKEND_SERVICE_NAME=codetrans - export CODETRANS_BACKEND_SERVICE_IP=${ip_address} - export CODETRANS_BACKEND_SERVICE_PORT=7777 - export CODETRANS_NGINX_PORT=8088 - export CODETRANS_BACKEND_SERVICE_URL="http://${ip_address}:${CODETRANS_BACKEND_SERVICE_PORT}/v1/codetrans" - export HOST_IP=${ip_address} + source set_env_vllm.sh sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env From 45f5ec86bf175c3fe2b719c890e1d4aa0af48e6c Mon Sep 17 00:00:00 2001 From: ZePan110 Date: Thu, 24 Apr 2025 15:09:27 +0800 Subject: [PATCH 2/2] fix Signed-off-by: ZePan110 --- CodeTrans/tests/test_compose_on_gaudi.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/CodeTrans/tests/test_compose_on_gaudi.sh b/CodeTrans/tests/test_compose_on_gaudi.sh index ba36a63259..5f287eb025 100644 --- a/CodeTrans/tests/test_compose_on_gaudi.sh +++ b/CodeTrans/tests/test_compose_on_gaudi.sh @@ -45,6 +45,7 @@ function start_services() { cd $WORKPATH/docker_compose export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} export NGINX_PORT=80 + export host_ip=${ip_address} source set_env.sh cd intel/hpu/gaudi