From 9f31ec2d56e2b4714e2aac54f9c991c8193536eb Mon Sep 17 00:00:00 2001
From: fengding <feng1.ding@intel.com>
Date: Fri, 6 Sep 2024 12:56:29 +0800
Subject: [PATCH 1/2] Yaml: add comments to specify gaudi device ids.

Signed-off-by: fengding <feng1.ding@intel.com>
---
 ChatQnA/docker_compose/intel/hpu/gaudi/README.md    | 7 ++++++-
 ChatQnA/docker_compose/intel/hpu/gaudi/compose.yaml | 4 ++--
 ChatQnA/tests/test_compose_on_gaudi.sh              | 2 ++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/ChatQnA/docker_compose/intel/hpu/gaudi/README.md b/ChatQnA/docker_compose/intel/hpu/gaudi/README.md
index 25336952ca..ea95fd0e7c 100644
--- a/ChatQnA/docker_compose/intel/hpu/gaudi/README.md
+++ b/ChatQnA/docker_compose/intel/hpu/gaudi/README.md
@@ -243,8 +243,13 @@ export BACKEND_SERVICE_ENDPOINT="http://${host_ip}:8888/v1/chatqna"
 export DATAPREP_SERVICE_ENDPOINT="http://${host_ip}:6007/v1/dataprep"
 export DATAPREP_GET_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/get_file"
 export DATAPREP_DELETE_FILE_ENDPOINT="http://${host_ip}:6007/v1/dataprep/delete_file"
+
+export llm_service_devices=all
+export tei_embedding_devices=all
 ```
 
+To specify the device ids, "llm_service_devices" and "tei_embedding_devices"` can be set as "0,1,2,3" alike. More info in [gaudi docs](https://docs.habana.ai/en/latest/Orchestration/Multiple_Tenants_on_HPU/Multiple_Dockers_each_with_Single_Workload.html).    
+
 If guardrails microservice is enabled in the pipeline, the below environment variables are necessary to be set.
 
 ```bash
@@ -254,7 +259,7 @@ export SAFETY_GUARD_ENDPOINT="http://${host_ip}:8088"
 export GUARDRAIL_SERVICE_HOST_IP=${host_ip}
 ```
 
-Note: Please replace with `host_ip` with you external IP address, do **NOT** use localhost.
+Note: Please replace `host_ip` with your external IP address, do **NOT** use localhost.    
 
 ### Start all the services Docker Containers
 
diff --git a/ChatQnA/docker_compose/intel/hpu/gaudi/compose.yaml b/ChatQnA/docker_compose/intel/hpu/gaudi/compose.yaml
index e5327b6234..6689efc6f1 100644
--- a/ChatQnA/docker_compose/intel/hpu/gaudi/compose.yaml
+++ b/ChatQnA/docker_compose/intel/hpu/gaudi/compose.yaml
@@ -39,7 +39,7 @@ services:
       no_proxy: ${no_proxy}
       http_proxy: ${http_proxy}
       https_proxy: ${https_proxy}
-      HABANA_VISIBLE_DEVICES: all
+      HABANA_VISIBLE_DEVICES: ${tei_embedding_devices}
       OMPI_MCA_btl_vader_single_copy_mechanism: none
       MAX_WARMUP_SEQUENCE_LENGTH: 512
       INIT_HCCL_ON_ACQUIRE: 0
@@ -121,7 +121,7 @@ services:
       HF_TOKEN: ${HUGGINGFACEHUB_API_TOKEN}
       HF_HUB_DISABLE_PROGRESS_BARS: 1
       HF_HUB_ENABLE_HF_TRANSFER: 0
-      HABANA_VISIBLE_DEVICES: all
+      HABANA_VISIBLE_DEVICES: ${llm_service_devices}
       OMPI_MCA_btl_vader_single_copy_mechanism: none
     runtime: habana
     cap_add:
diff --git a/ChatQnA/tests/test_compose_on_gaudi.sh b/ChatQnA/tests/test_compose_on_gaudi.sh
index 13ecdc113f..d40f7ad1dc 100644
--- a/ChatQnA/tests/test_compose_on_gaudi.sh
+++ b/ChatQnA/tests/test_compose_on_gaudi.sh
@@ -50,6 +50,8 @@ function start_services() {
     export DATAPREP_SERVICE_ENDPOINT="http://${ip_address}:6007/v1/dataprep"
     export DATAPREP_GET_FILE_ENDPOINT="http://${ip_address}:6008/v1/dataprep/get_file"
     export DATAPREP_DELETE_FILE_ENDPOINT="http://${ip_address}:6009/v1/dataprep/delete_file"
+    export llm_service_devices=all
+    export tei_embedding_devices=all
 
     sed -i "s/backend_address/$ip_address/g" $WORKPATH/ui/svelte/.env
 

From e071a19a6cd4a4788d7f8e8931bbd3ad10ea549e Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
 <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Wed, 11 Sep 2024 01:30:20 +0000
Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
---
 ChatQnA/docker_compose/intel/hpu/gaudi/README.md | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ChatQnA/docker_compose/intel/hpu/gaudi/README.md b/ChatQnA/docker_compose/intel/hpu/gaudi/README.md
index ea95fd0e7c..af854e847a 100644
--- a/ChatQnA/docker_compose/intel/hpu/gaudi/README.md
+++ b/ChatQnA/docker_compose/intel/hpu/gaudi/README.md
@@ -248,7 +248,7 @@ export llm_service_devices=all
 export tei_embedding_devices=all
 ```
 
-To specify the device ids, "llm_service_devices" and "tei_embedding_devices"` can be set as "0,1,2,3" alike. More info in [gaudi docs](https://docs.habana.ai/en/latest/Orchestration/Multiple_Tenants_on_HPU/Multiple_Dockers_each_with_Single_Workload.html).    
+To specify the device ids, "llm_service_devices" and "tei_embedding_devices"` can be set as "0,1,2,3" alike. More info in [gaudi docs](https://docs.habana.ai/en/latest/Orchestration/Multiple_Tenants_on_HPU/Multiple_Dockers_each_with_Single_Workload.html).
 
 If guardrails microservice is enabled in the pipeline, the below environment variables are necessary to be set.
 
@@ -259,7 +259,7 @@ export SAFETY_GUARD_ENDPOINT="http://${host_ip}:8088"
 export GUARDRAIL_SERVICE_HOST_IP=${host_ip}
 ```
 
-Note: Please replace `host_ip` with your external IP address, do **NOT** use localhost.    
+Note: Please replace `host_ip` with your external IP address, do **NOT** use localhost.
 
 ### Start all the services Docker Containers
 
