From ef7bc5bd87bbc748b6140f53c103401e89cc9ae6 Mon Sep 17 00:00:00 2001 From: artem-astafev Date: Tue, 12 Nov 2024 14:54:59 +0700 Subject: [PATCH 01/24] Add compose example for ChatQnA AMD ROCm deployment Signed-off-by: artem-astafev --- ChatQnA/docker_compose/amd/gpu/rocm/README.md | 430 ++++++++++++++++++ .../docker_compose/amd/gpu/rocm/compose.yaml | 182 ++++++++ .../docker_compose/amd/gpu/rocm/set_env.sh | 34 ++ ChatQnA/tests/test_compose_on_rocm.sh | 262 +++++++++++ 4 files changed, 908 insertions(+) create mode 100644 ChatQnA/docker_compose/amd/gpu/rocm/README.md create mode 100644 ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml create mode 100644 ChatQnA/docker_compose/amd/gpu/rocm/set_env.sh create mode 100644 ChatQnA/tests/test_compose_on_rocm.sh diff --git a/ChatQnA/docker_compose/amd/gpu/rocm/README.md b/ChatQnA/docker_compose/amd/gpu/rocm/README.md new file mode 100644 index 000000000..7a19bd96f --- /dev/null +++ b/ChatQnA/docker_compose/amd/gpu/rocm/README.md @@ -0,0 +1,430 @@ +# Build MegaService of ChatQnA on AMD ROCm GPU + +This document outlines the deployment process for a ChatQnA application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on AMD ROCm GPU platform. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as embedding, retriever, rerank, and llm. We will publish the Docker images to Docker Hub, it will simplify the deployment process for this service. + +Quick Start Deployment Steps: + +1. Set up the environment variables. +2. Run Docker Compose. +3. Consume the ChatQnA Service. + +## Quick Start: 1.Setup Environment Variable + +To set up environment variables for deploying ChatQnA services, follow these steps: + +1. Set the required environment variables: + + ```bash + # Example: host_ip="192.168.1.1" + export HOST_IP=${host_ip} + # Example: no_proxy="localhost, 127.0.0.1, 192.168.1.1" + export CHATQNA_HUGGINGFACEHUB_API_TOKEN=${your_hf_api_token} + ``` + +2. If you are in a proxy environment, also set the proxy-related environment variables: + + ```bash + export http_proxy="Your_HTTP_Proxy" + export https_proxy="Your_HTTPs_Proxy" + ``` + +3. Set up other environment variables: + + ```bash + source ./set_env.sh + ``` + +## Quick Start: 2.Run Docker Compose + +```bash +docker compose up -d +``` + +It will automatically download the docker image on `docker hub`: + +```bash +docker pull opea/chatqna:latest +docker pull opea/chatqna-ui:latest +``` + +In following cases, you could build docker image from source by yourself. + +- Failed to download the docker image. + +- If you want to use a specific version of Docker image. + +Please refer to 'Build Docker Images' in below. + +## QuickStart: 3.Consume the ChatQnA Service + +Prepare and upload test document + +``` +# download pdf file +wget https://raw.githubusercontent.com/opea-project/GenAIComps/main/comps/retrievers/redis/data/nke-10k-2023.pdf +# upload pdf file with dataprep +curl -X POST "http://${host_ip}:6007/v1/dataprep" \ + -H "Content-Type: multipart/form-data" \ + -F "files=@./nke-10k-2023.pdf" +``` + +Get MegaSerice(backend) response: + +```bash +curl http://${host_ip}:8888/v1/chatqna \ + -H "Content-Type: application/json" \ + -d '{ + "messages": "What is the revenue of Nike in 2023?" + }' +``` + +## 🚀 Build Docker Images + +First of all, you need to build Docker Images locally. This step can be ignored after the Docker images published to Docker hub. + +### 1. Source Code install GenAIComps + +```bash +git clone https://github.com/opea-project/GenAIComps.git +cd GenAIComps +``` + +### 2. Build Retriever Image + +```bash +docker build --no-cache -t opea/retriever-redis:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/retrievers/redis/langchain/Dockerfile . +``` + +### 3. Build Dataprep Image + +```bash +docker build --no-cache -t opea/dataprep-redis:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/dataprep/redis/langchain/Dockerfile . +``` + +### 4. Build MegaService Docker Image + +To construct the Mega Service, we utilize the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline within the `chatqna.py` Python script. Build the MegaService Docker image using the command below: + +```bash +git clone https://github.com/opea-project/GenAIExamples.git +cd GenAIExamples/ChatQnA/docker +docker build --no-cache -t opea/chatqna:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile . +cd ../../.. +``` + +### 5. Build UI Docker Image + +Construct the frontend Docker image using the command below: + +```bash +cd GenAIExamples/ChatQnA/ui +docker build --no-cache -t opea/chatqna-ui:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f ./docker/Dockerfile . +cd ../../../.. +``` + +### 6. Build React UI Docker Image (Optional) + +Construct the frontend Docker image using the command below: + +```bash +cd GenAIExamples/ChatQnA/ui +docker build --no-cache -t opea/chatqna-react-ui:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f ./docker/Dockerfile.react . +cd ../../../.. +``` + +### 7. Build Nginx Docker Image + +```bash +cd GenAIComps +docker build -t opea/nginx:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/nginx/Dockerfile . +``` + +Then run the command `docker images`, you will have the following 5 Docker Images: + +1. `opea/retriever-redis:latest` +2. `opea/dataprep-redis:latest` +3. `opea/chatqna:latest` +4. `opea/chatqna-ui:latest` or `opea/chatqna-react-ui:latest` +5. `opea/nginx:latest` + +## 🚀 Start MicroServices and MegaService + +### Required Models + +By default, the embedding, reranking and LLM models are set to a default value as listed below: + +| Service | Model | +| --------- | ------------------------- | +| Embedding | BAAI/bge-base-en-v1.5 | +| Reranking | BAAI/bge-reranker-base | +| LLM | Intel/neural-chat-7b-v3-3 | + +Change the `xxx_MODEL_ID` below for your needs. + +### Setup Environment Variables + +1. Set the required environment variables: + + ```bash + # Example: host_ip="192.168.1.1" + export host_ip="External_Public_IP" + # Example: no_proxy="localhost, 127.0.0.1, 192.168.1.1" + export no_proxy="Your_No_Proxy" + export CHATQNA_HUGGINGFACEHUB_API_TOKEN="Your_Huggingface_API_Token" + # Example: NGINX_PORT=80 + export HOST_IP=${host_ip} + export NGINX_PORT=${your_nginx_port} + export CHATQNA_TGI_SERVICE_IMAGE="ghcr.io/huggingface/text-generation-inference:2.3.1-rocm" + export CHATQNA_EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" + export CHATQNA_RERANK_MODEL_ID="BAAI/bge-reranker-base" + export CHATQNA_LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" + export CHATQNA_TGI_SERVICE_PORT=8008 + export CHATQNA_TEI_EMBEDDING_PORT=8090 + export CHATQNA_TEI_EMBEDDING_ENDPOINT="http://${HOST_IP}:${CHATQNA_TEI_EMBEDDING_PORT}" + export CHATQNA_TEI_RERANKING_PORT=8808 + export CHATQNA_REDIS_VECTOR_PORT=16379 + export CHATQNA_REDIS_VECTOR_INSIGHT_PORT=8001 + export CHATQNA_REDIS_DATAPREP_PORT=6007 + export CHATQNA_REDIS_RETRIEVER_PORT=7000 + export CHATQNA_INDEX_NAME="rag-redis" + export CHATQNA_MEGA_SERVICE_HOST_IP=${HOST_IP} + export CHATQNA_RETRIEVER_SERVICE_HOST_IP=${HOST_IP} + export CHATQNA_BACKEND_SERVICE_ENDPOINT="http://127.0.0.1:${CHATQNA_BACKEND_SERVICE_PORT}/v1/chatqna" + export CHATQNA_DATAPREP_SERVICE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep" + export CHATQNA_DATAPREP_GET_FILE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep/get_file" + export CHATQNA_DATAPREP_DELETE_FILE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep/delete_file" + export CHATQNA_FRONTEND_SERVICE_IP=${HOST_IP} + export CHATQNA_FRONTEND_SERVICE_PORT=5173 + export CHATQNA_BACKEND_SERVICE_NAME=chatqna + export CHATQNA_BACKEND_SERVICE_IP=${HOST_IP} + export CHATQNA_BACKEND_SERVICE_PORT=8888 + export CHATQNA_REDIS_URL="redis://${HOST_IP}:${CHATQNA_REDIS_VECTOR_PORT}" + export CHATQNA_EMBEDDING_SERVICE_HOST_IP=${HOST_IP} + export CHATQNA_RERANK_SERVICE_HOST_IP=${HOST_IP} + export CHATQNA_LLM_SERVICE_HOST_IP=${HOST_IP} + export CHATQNA_NGINX_PORT=5176 + ``` + +2. If you are in a proxy environment, also set the proxy-related environment variables: + + ```bash + export http_proxy="Your_HTTP_Proxy" + export https_proxy="Your_HTTPs_Proxy" + ``` + +3. Note: In order to limit access to a subset of GPUs, please pass each device individually using one or more -device /dev/dri/rendered, where is the card index, starting from 128. (https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/docker.html#docker-restrict-gpus) into tgi-service in compose.yaml file + +Example for set isolation for 1 GPU + +``` + - /dev/dri/card0:/dev/dri/card0 + - /dev/dri/renderD128:/dev/dri/renderD128 +``` + +Example for set isolation for 2 GPUs + +``` + - /dev/dri/card0:/dev/dri/card0 + - /dev/dri/renderD128:/dev/dri/renderD128 + - /dev/dri/card1:/dev/dri/card1 + - /dev/dri/renderD129:/dev/dri/renderD129 +``` + +Please find more information about accessing and restricting AMD GPUs in the link (https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/docker.html#docker-restrict-gpus) + +4. Set up other environment variables: + + ```bash + source ./set_env.sh + ``` + +### Start all the services Docker Containers + +```bash +cd GenAIExamples/ChatQnA/docker_compose/amd/gpu/rocm +docker compose up -d +``` + +### Validate MicroServices and MegaService + +1. TEI Embedding Service + + ```bash + curl ${host_ip}:8090/embed \ + -X POST \ + -d '{"inputs":"What is Deep Learning?"}' \ + -H 'Content-Type: application/json' + ``` + +2. Retriever Microservice + + To consume the retriever microservice, you need to generate a mock embedding vector by Python script. The length of embedding vector + is determined by the embedding model. + Here we use the model `EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5"`, which vector size is 768. + + Check the vecotor dimension of your embedding model, set `your_embedding` dimension equals to it. + + ```bash + export your_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)") + curl http://${host_ip}:7000/v1/retrieval \ + -X POST \ + -d "{\"text\":\"test\",\"embedding\":${your_embedding}}" \ + -H 'Content-Type: application/json' + ``` + +3. TEI Reranking Service + + ```bash + curl http://${host_ip}:8808/rerank \ + -X POST \ + -d '{"query":"What is Deep Learning?", "texts": ["Deep Learning is not...", "Deep learning is..."]}' \ + -H 'Content-Type: application/json' + ``` + +4. TGI Service + + In first startup, this service will take more time to download the model files. After it's finished, the service will be ready. + + Try the command below to check whether the TGI service is ready. + + ```bash + docker logs ${CONTAINER_ID} | grep Connected + ``` + + If the service is ready, you will get the response like below. + + ``` + 2024-09-03T02:47:53.402023Z INFO text_generation_router::server: router/src/server.rs:2311: Connected + ``` + + Then try the `cURL` command below to validate TGI. + + ```bash + curl http://${host_ip}:8008/generate \ + -X POST \ + -d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":64, "do_sample": true}}' \ + -H 'Content-Type: application/json' + ``` + +5. MegaService + + ```bash + curl http://${host_ip}:8888/v1/chatqna -H "Content-Type: application/json" -d '{ + "messages": "What is the revenue of Nike in 2023?" + }' + ``` + +6. Nginx Service + + ```bash + curl http://${host_ip}:${NGINX_PORT}/v1/chatqna \ + -H "Content-Type: application/json" \ + -d '{"messages": "What is the revenue of Nike in 2023?"}' + ``` + +7. Dataprep Microservice(Optional) + +If you want to update the default knowledge base, you can use the following commands: + +Update Knowledge Base via Local File Upload: + +```bash +curl -X POST "http://${host_ip}:6007/v1/dataprep" \ + -H "Content-Type: multipart/form-data" \ + -F "files=@./nke-10k-2023.pdf" +``` + +This command updates a knowledge base by uploading a local file for processing. Update the file path according to your environment. + +Add Knowledge Base via HTTP Links: + +```bash +curl -X POST "http://${host_ip}:6007/v1/dataprep" \ + -H "Content-Type: multipart/form-data" \ + -F 'link_list=["https://opea.dev"]' +``` + +This command updates a knowledge base by submitting a list of HTTP links for processing. + +Also, you are able to get the file list that you uploaded: + +```bash +curl -X POST "http://${host_ip}:6007/v1/dataprep/get_file" \ + -H "Content-Type: application/json" +``` + +To delete the file/link you uploaded: + +```bash +# delete link +curl -X POST "http://${host_ip}:6007/v1/dataprep/delete_file" \ + -d '{"file_path": "https://opea.dev"}' \ + -H "Content-Type: application/json" + +# delete file +curl -X POST "http://${host_ip}:6007/v1/dataprep/delete_file" \ + -d '{"file_path": "nke-10k-2023.pdf"}' \ + -H "Content-Type: application/json" + +# delete all uploaded files and links +curl -X POST "http://${host_ip}:6007/v1/dataprep/delete_file" \ + -d '{"file_path": "all"}' \ + -H "Content-Type: application/json" +``` + +## 🚀 Launch the UI + +### Launch with origin port + +To access the frontend, open the following URL in your browser: http://{host_ip}:5173. By default, the UI runs on port 5173 internally. If you prefer to use a different host port to access the frontend, you can modify the port mapping in the `compose.yaml` file as shown below: + +```yaml + chaqna-ui-server: + image: opea/chatqna-ui:latest + ... + ports: + - "80:5173" +``` + +### Launch with Nginx + +If you want to launch the UI using Nginx, open this URL: `http://${host_ip}:${NGINX_PORT}` in your browser to access the frontend. + +## 🚀 Launch the Conversational UI (Optional) + +To access the Conversational UI (react based) frontend, modify the UI service in the `compose.yaml` file. Replace `chaqna-ui-server` service with the `chatqna-react-ui-server` service as per the config below: + +```yaml +chatqna-react-ui-server: + image: opea/chatqna-react-ui:latest + container_name: chatqna-react-ui-server + environment: + - APP_BACKEND_SERVICE_ENDPOINT=${BACKEND_SERVICE_ENDPOINT} + - APP_DATA_PREP_SERVICE_URL=${DATAPREP_SERVICE_ENDPOINT} + ports: + - "5174:80" + depends_on: + - chaqna-backend-server + ipc: host + restart: always +``` + +Once the services are up, open the following URL in your browser: http://{host_ip}:5174. By default, the UI runs on port 80 internally. If you prefer to use a different host port to access the frontend, you can modify the port mapping in the `compose.yaml` file as shown below: + +```yaml + chaqna-react-ui-server: + image: opea/chatqna-react-ui:latest + ... + ports: + - "80:80" +``` + +![project-screenshot](../../../assets/img/chat_ui_init.png) + +Here is an example of running ChatQnA: + +![project-screenshot](../../../assets/img/chat_ui_response.png) + +Here is an example of running ChatQnA with Conversational UI (React): + +![project-screenshot](../../../assets/img/conversation_ui_response.png) diff --git a/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml b/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml new file mode 100644 index 000000000..f279bf254 --- /dev/null +++ b/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml @@ -0,0 +1,182 @@ +# Copyright (C) 2024 Advanced Micro Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +services: + chatqna-redis-vector-db: + image: redis/redis-stack:7.2.0-v9 + container_name: redis-vector-db + ports: + - "${CHATQNA_REDIS_VECTOR_PORT}:6379" + - "${CHATQNA_REDIS_VECTOR_INSIGHT_PORT}:8001" + chatqna-dataprep-redis-service: + image: ${REGISTRY:-opea}/dataprep-redis:${TAG:-latest} + container_name: dataprep-redis-server + depends_on: + - chatqna-redis-vector-db + - chatqna-tei-embedding-service + ports: + - "${CHATQNA_REDIS_DATAPREP_PORT}:6007" + environment: + no_proxy: ${no_proxy} + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + REDIS_URL: ${CHATQNA_REDIS_URL} + INDEX_NAME: ${CHATQNA_INDEX_NAME} + TEI_ENDPOINT: ${CHATQNA_TEI_EMBEDDING_ENDPOINT} + HUGGINGFACEHUB_API_TOKEN: ${CHATQNA_HUGGINGFACEHUB_API_TOKEN} + chatqna-tei-embedding-service: + image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.5 + container_name: chatqna-tei-embedding-server + ports: + - "${CHATQNA_TEI_EMBEDDING_PORT}:80" + volumes: + - "/var/opea/chatqna-service/data:/data" + shm_size: 1g + ipc: host + environment: + no_proxy: ${no_proxy} + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + command: --model-id ${CHATQNA_EMBEDDING_MODEL_ID} --auto-truncate + devices: + - /dev/kfd:/dev/kfd + - /dev/dri/:/dev/dri/ + cap_add: + - SYS_PTRACE + group_add: + - video + security_opt: + - seccomp:unconfined + chatqna-retriever: + image: ${REGISTRY:-opea}/retriever-redis:${TAG:-latest} + container_name: chatqna-retriever-redis-server + depends_on: + - chatqna-redis-vector-db + ports: + - "${CHATQNA_REDIS_RETRIEVER_PORT}:7000" + ipc: host + environment: + no_proxy: ${no_proxy} + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + REDIS_URL: ${CHATQNA_REDIS_URL} + INDEX_NAME: ${CHATQNA_INDEX_NAME} + TEI_EMBEDDING_ENDPOINT: ${CHATQNA_TEI_EMBEDDING_ENDPOINT} + restart: unless-stopped + chatqna-tei-reranking-service: + image: ghcr.io/huggingface/text-embeddings-inference:cpu-1.5 + container_name: chatqna-tei-reranking-server + ports: + - "${CHATQNA_TEI_RERANKING_PORT}:80" + volumes: + - "/var/opea/chatqna-service/data:/data" + shm_size: 1g + environment: + no_proxy: ${no_proxy} + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + HUGGINGFACEHUB_API_TOKEN: ${CHATQNA_HUGGINGFACEHUB_API_TOKEN} + HF_HUB_DISABLE_PROGRESS_BARS: 1 + HF_HUB_ENABLE_HF_TRANSFER: 0 + devices: + - /dev/kfd:/dev/kfd + - /dev/dri/:/dev/dri/ + cap_add: + - SYS_PTRACE + group_add: + - video + security_opt: + - seccomp:unconfined + command: --model-id ${CHATQNA_RERANK_MODEL_ID} --auto-truncate + chatqna-tgi-service: + image: ${CHATQNA_TGI_SERVICE_IMAGE} + container_name: chatqna-tgi-server + ports: + - "${CHATQNA_TGI_SERVICE_PORT}:80" + environment: + no_proxy: ${no_proxy} + http_proxy: ${http_proxy} + https_proxy: ${https_proxy} + HUGGINGFACEHUB_API_TOKEN: ${CHATQNA_HUGGINGFACEHUB_API_TOKEN} + HF_HUB_DISABLE_PROGRESS_BARS: 1 + HF_HUB_ENABLE_HF_TRANSFER: 0 + volumes: + - "/var/opea/chatqna-service/data:/data" + shm_size: 1g + devices: + - /dev/kfd:/dev/kfd + - /dev/dri/:/dev/dri/ + cap_add: + - SYS_PTRACE + group_add: + - video + security_opt: + - seccomp:unconfined + command: --model-id ${CHATQNA_LLM_MODEL_ID} + ipc: host + chatqna-backend-server: + image: ${REGISTRY:-opea}/chatqna:${TAG:-latest} + container_name: chatqna-backend-server + depends_on: + - chatqna-redis-vector-db + - chatqna-tei-embedding-service + - chatqna-retriever + - chatqna-tei-reranking-service + - chatqna-tgi-service + ports: + - "${CHATQNA_BACKEND_SERVICE_PORT}:8888" + environment: + - no_proxy=${no_proxy} + - https_proxy=${https_proxy} + - http_proxy=${http_proxy} + - MEGA_SERVICE_HOST_IP=${CHATQNA_MEGA_SERVICE_HOST_IP} + - EMBEDDING_SERVER_HOST_IP=${HOST_IP} + - EMBEDDING_SERVER_PORT=${CHATQNA_TEI_EMBEDDING_PORT:-80} + - RETRIEVER_SERVICE_HOST_IP=${HOST_IP} + - RERANK_SERVER_HOST_IP=${HOST_IP} + - RERANK_SERVER_PORT=${CHATQNA_TEI_RERANKING_PORT:-80} + - LLM_SERVER_HOST_IP=${HOST_IP} + - LLM_SERVER_PORT=${CHATQNA_TGI_SERVICE_PORT:-80} + - LLM_MODEL=${CHATQNA_LLM_MODEL_ID} + ipc: host + restart: always + chatqna-ui-server: + image: ${REGISTRY:-opea}/chatqna-ui:${TAG:-latest} + container_name: chatqna-ui-server + depends_on: + - chatqna-backend-server + ports: + - "${CHATQNA_FRONTEND_SERVICE_PORT}:5173" + environment: + - no_proxy=${no_proxy} + - https_proxy=${https_proxy} + - http_proxy=${http_proxy} + - CHAT_BASE_URL=${CHATQNA_BACKEND_SERVICE_ENDPOINT} + - UPLOAD_FILE_BASE_URL=${CHATQNA_DATAPREP_SERVICE_ENDPOINT} + - GET_FILE=${CHATQNA_DATAPREP_GET_FILE_ENDPOINT} + - DELETE_FILE=${CHATQNA_DATAPREP_DELETE_FILE_ENDPOINT} + ipc: host + restart: always + chatqna-nginx-server: + image: ${REGISTRY:-opea}/nginx:${TAG:-latest} + container_name: chaqna-nginx-server + depends_on: + - chatqna-backend-server + - chatqna-ui-server + ports: + - "${CHATQNA_NGINX_PORT}:80" + environment: + - no_proxy=${no_proxy} + - https_proxy=${https_proxy} + - http_proxy=${http_proxy} + - FRONTEND_SERVICE_IP=${CHATQNA_FRONTEND_SERVICE_IP} + - FRONTEND_SERVICE_PORT=${CHATQNA_FRONTEND_SERVICE_PORT} + - BACKEND_SERVICE_NAME=${CHATQNA_BACKEND_SERVICE_NAME} + - BACKEND_SERVICE_IP=${CHATQNA_BACKEND_SERVICE_IP} + - BACKEND_SERVICE_PORT=${CHATQNA_BACKEND_SERVICE_PORT} + ipc: host + restart: always + +networks: + default: + driver: bridge diff --git a/ChatQnA/docker_compose/amd/gpu/rocm/set_env.sh b/ChatQnA/docker_compose/amd/gpu/rocm/set_env.sh new file mode 100644 index 000000000..0a581dc86 --- /dev/null +++ b/ChatQnA/docker_compose/amd/gpu/rocm/set_env.sh @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# Copyright (C) 2024 Advanced Micro Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +export CHATQNA_TGI_SERVICE_IMAGE="ghcr.io/huggingface/text-generation-inference:2.3.1-rocm" +export CHATQNA_EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" +export CHATQNA_RERANK_MODEL_ID="BAAI/bge-reranker-base" +export CHATQNA_LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" +export CHATQNA_TGI_SERVICE_PORT=18008 +export CHATQNA_TEI_EMBEDDING_PORT=18090 +export CHATQNA_TEI_EMBEDDING_ENDPOINT="http://${HOST_IP}:${CHATQNA_TEI_EMBEDDING_PORT}" +export CHATQNA_TEI_RERANKING_PORT=18808 +export CHATQNA_REDIS_VECTOR_PORT=16379 +export CHATQNA_REDIS_VECTOR_INSIGHT_PORT=8001 +export CHATQNA_REDIS_DATAPREP_PORT=6007 +export CHATQNA_REDIS_RETRIEVER_PORT=7000 +export CHATQNA_INDEX_NAME="rag-redis" +export CHATQNA_MEGA_SERVICE_HOST_IP=${HOST_IP} +export CHATQNA_RETRIEVER_SERVICE_HOST_IP=${HOST_IP} +export CHATQNA_BACKEND_SERVICE_ENDPOINT="http://127.0.0.1:${CHATQNA_BACKEND_SERVICE_PORT}/v1/chatqna" +export CHATQNA_DATAPREP_SERVICE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep" +export CHATQNA_DATAPREP_GET_FILE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep/get_file" +export CHATQNA_DATAPREP_DELETE_FILE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep/delete_file" +export CHATQNA_FRONTEND_SERVICE_IP=${HOST_IP} +export CHATQNA_FRONTEND_SERVICE_PORT=15173 +export CHATQNA_BACKEND_SERVICE_NAME=chatqna +export CHATQNA_BACKEND_SERVICE_IP=${HOST_IP} +export CHATQNA_BACKEND_SERVICE_PORT=18888 +export CHATQNA_REDIS_URL="redis://${HOST_IP}:${CHATQNA_REDIS_VECTOR_PORT}" +export CHATQNA_EMBEDDING_SERVICE_HOST_IP=${HOST_IP} +export CHATQNA_RERANK_SERVICE_HOST_IP=${HOST_IP} +export CHATQNA_LLM_SERVICE_HOST_IP=${HOST_IP} +export CHATQNA_NGINX_PORT=15176 diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh new file mode 100644 index 000000000..734965bc8 --- /dev/null +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -0,0 +1,262 @@ +#!/bin/bash +# Copyright (C) 2024 Advanced Micro Devices, Inc. +# SPDX-License-Identifier: Apache-2.0 + +set -e +IMAGE_REPO=${IMAGE_REPO:-"opea"} +IMAGE_TAG=${IMAGE_TAG:-"latest"} +echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}" +echo "TAG=IMAGE_TAG=${IMAGE_TAG}" +export REGISTRY=${IMAGE_REPO} +export TAG=${IMAGE_TAG} + +WORKPATH=$(dirname "$PWD") +LOG_PATH="$WORKPATH/tests" +ip_address=$(hostname -I | awk '{print $1}') + +function build_docker_images() { + cd "$WORKPATH"/docker_image_build + git clone https://github.com/opea-project/GenAIComps.git && cd GenAIComps && git checkout "${opea_branch:-"main"}" && cd ../ + + echo "Build all the images with --no-cache, check docker_image_build.log for details..." + service_list="chatqna chatqna-ui chatqna-conversation-ui dataprep-redis retriever-redis nginx" + docker compose -f build.yaml build "${service_list}" --no-cache > "${LOG_PATH}"/docker_image_build.log + + docker pull ghcr.io/huggingface/text-generation-inference:2.3.1-rocm + docker pull ghcr.io/huggingface/text-embeddings-inference:cpu-1.5 + + docker images && sleep 1s +} + +function start_services() { + cd "$WORKPATH"/docker_compose/amd/gpu/rocm + + export CHATQNA_TGI_SERVICE_IMAGE="ghcr.io/huggingface/text-generation-inference:2.3.1-rocm" + export CHATQNA_EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" + export CHATQNA_RERANK_MODEL_ID="BAAI/bge-reranker-base" + export CHATQNA_LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" + export CHATQNA_TGI_SERVICE_PORT=18008 + export CHATQNA_TEI_EMBEDDING_PORT=18090 + export CHATQNA_TEI_EMBEDDING_ENDPOINT="http://${HOST_IP}:${CHATQNA_TEI_EMBEDDING_PORT}" + export CHATQNA_TEI_RERANKING_PORT=18808 + export CHATQNA_REDIS_VECTOR_PORT=16379 + export CHATQNA_REDIS_VECTOR_INSIGHT_PORT=8001 + export CHATQNA_REDIS_DATAPREP_PORT=6007 + export CHATQNA_REDIS_RETRIEVER_PORT=7000 + export CHATQNA_INDEX_NAME="rag-redis" + export CHATQNA_MEGA_SERVICE_HOST_IP=${HOST_IP} + export CHATQNA_RETRIEVER_SERVICE_HOST_IP=${HOST_IP} + export CHATQNA_BACKEND_SERVICE_ENDPOINT="http://127.0.0.1:${CHATQNA_BACKEND_SERVICE_PORT}/v1/chatqna" + export CHATQNA_DATAPREP_SERVICE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep" + export CHATQNA_DATAPREP_GET_FILE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep/get_file" + export CHATQNA_DATAPREP_DELETE_FILE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep/delete_file" + export CHATQNA_FRONTEND_SERVICE_IP=${HOST_IP} + export CHATQNA_FRONTEND_SERVICE_PORT=15173 + export CHATQNA_BACKEND_SERVICE_NAME=chatqna + export CHATQNA_BACKEND_SERVICE_IP=${HOST_IP} + export CHATQNA_BACKEND_SERVICE_PORT=18888 + export CHATQNA_REDIS_URL="redis://${HOST_IP}:${CHATQNA_REDIS_VECTOR_PORT}" + export CHATQNA_EMBEDDING_SERVICE_HOST_IP=${HOST_IP} + export CHATQNA_RERANK_SERVICE_HOST_IP=${HOST_IP} + export CHATQNA_LLM_SERVICE_HOST_IP=${HOST_IP} + export CHATQNA_NGINX_PORT=15176 + export CHATQNA_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} + + # Start Docker Containers + docker compose -f compose.yaml up -d > "${LOG_PATH}"/start_services_with_compose.log + + n=0 + until [[ "$n" -ge 500 ]]; do + docker logs chatqna-tgi-service > "${LOG_PATH}"/tgi_service_start.log + if grep -q Connected "${LOG_PATH}"/tgi_service_start.log; then + break + fi + sleep 1s + n=$((n+1)) + done +} + +function validate_service() { + local URL="$1" + local EXPECTED_RESULT="$2" + local SERVICE_NAME="$3" + local DOCKER_NAME="$4" + local INPUT_DATA="$5" + + if [[ $SERVICE_NAME == *"dataprep_upload_file"* ]]; then + cd "$LOG_PATH" + HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST -F 'files=@./dataprep_file.txt' -H 'Content-Type: multipart/form-data' "$URL") + elif [[ $SERVICE_NAME == *"dataprep_upload_link"* ]]; then + HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST -F 'link_list=["https://www.ces.tech/"]' "$URL") + elif [[ $SERVICE_NAME == *"dataprep_get"* ]]; then + HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST -H 'Content-Type: application/json' "$URL") + elif [[ $SERVICE_NAME == *"dataprep_del"* ]]; then + HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST -d '{"file_path": "all"}' -H 'Content-Type: application/json' "$URL") + else + HTTP_RESPONSE=$(curl --silent --write-out "HTTPSTATUS:%{http_code}" -X POST -d "$INPUT_DATA" -H 'Content-Type: application/json' "$URL") + fi + HTTP_STATUS=$(echo "$HTTP_RESPONSE" | tr -d '\n' | sed -e 's/.*HTTPSTATUS://') + RESPONSE_BODY=$(echo "$HTTP_RESPONSE" | sed -e 's/HTTPSTATUS\:.*//g') + + docker logs "${DOCKER_NAME}" >> "${LOG_PATH}"/"${SERVICE_NAME}".log + + # check response status + if [ "$HTTP_STATUS" -ne "200" ]; then + echo "[ $SERVICE_NAME ] HTTP status is not 200. Received status was $HTTP_STATUS" + exit 1 + else + echo "[ $SERVICE_NAME ] HTTP status is 200. Checking content..." + fi + # check response body + if [[ "$RESPONSE_BODY" != *"$EXPECTED_RESULT"* ]]; then + echo "[ $SERVICE_NAME ] Content does not match the expected result: $RESPONSE_BODY" + exit 1 + else + echo "[ $SERVICE_NAME ] Content is as expected." + fi + + sleep 1s +} + +function validate_microservices() { + # Check if the microservices are running correctly. + + # tei for embedding service + validate_service \ + "${ip_address}:6006/embed" \ + "[[" \ + "tei-embedding" \ + "tei-embedding-server" \ + '{"inputs":"What is Deep Learning?"}' + + sleep 1m # retrieval can't curl as expected, try to wait for more time + + # test /v1/dataprep upload file + echo "Deep learning is a subset of machine learning that utilizes neural networks with multiple layers to analyze various levels of abstract data representations. It enables computers to identify patterns and make decisions with minimal human intervention by learning from large amounts of data." > "$LOG_PATH"/dataprep_file.txt + validate_service \ + "http://${ip_address}:6007/v1/dataprep" \ + "Data preparation succeeded" \ + "dataprep_upload_file" \ + "dataprep-redis-server" + + # test /v1/dataprep upload link + validate_service \ + "http://${ip_address}:6007/v1/dataprep" \ + "Data preparation succeeded" \ + "dataprep_upload_link" \ + "dataprep-redis-server" + + # test /v1/dataprep/get_file + validate_service \ + "http://${ip_address}:6007/v1/dataprep/get_file" \ + '{"name":' \ + "dataprep_get" \ + "dataprep-redis-server" + + # test /v1/dataprep/delete_file + validate_service \ + "http://${ip_address}:6007/v1/dataprep/delete_file" \ + '{"status":true}' \ + "dataprep_del" \ + "dataprep-redis-server" + + # retrieval microservice + test_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)") + validate_service \ + "${ip_address}:7000/v1/retrieval" \ + "retrieved_docs" \ + "retrieval-microservice" \ + "retriever-redis-server" \ + "{\"text\":\"What is the revenue of Nike in 2023?\",\"embedding\":${test_embedding}}" + + # tei for rerank microservice + validate_service \ + "${ip_address}:8808/rerank" \ + '{"index":1,"score":' \ + "tei-rerank" \ + "tei-reranking-server" \ + '{"query":"What is Deep Learning?", "texts": ["Deep Learning is not...", "Deep learning is..."]}' + + # tgi for llm service + validate_service \ + "${ip_address}:9009/generate" \ + "generated_text" \ + "tgi-llm" \ + "tgi-service" \ + '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' + +} + +function validate_megaservice() { + # Curl the Mega Service + validate_service \ + "${ip_address}:8888/v1/chatqna" \ + "data: " \ + "chatqna-megaservice" \ + "chatqna-xeon-backend-server" \ + '{"messages": "What is the revenue of Nike in 2023?"}' + +} + +function validate_frontend() { + echo "[ TEST INFO ]: --------- frontend test started ---------" + cd "$WORKPATH"/ui/svelte + local conda_env_name="OPEA_e2e" + export PATH=${HOME}/miniforge3/bin/:$PATH + if conda info --envs | grep -q "$conda_env_name"; then + echo "$conda_env_name exist!" + else + conda create -n ${conda_env_name} python=3.12 -y + fi + source activate ${conda_env_name} + echo "[ TEST INFO ]: --------- conda env activated ---------" + + sed -i "s/localhost/$ip_address/g" playwright.config.ts + + conda install -c conda-forge nodejs -y + npm install && npm ci && npx playwright install --with-deps + node -v && npm -v && pip list + + exit_status=0 + npx playwright test || exit_status=$? + + if [ $exit_status -ne 0 ]; then + echo "[TEST INFO]: ---------frontend test failed---------" + exit $exit_status + else + echo "[TEST INFO]: ---------frontend test passed---------" + fi +} + +function stop_docker() { + cd "$WORKPATH"/docker_compose/amd/gpu/rocm + docker compose stop && docker compose rm -f +} + +function main() { + + stop_docker + if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi + start_time=$(date +%s) + start_services + end_time=$(date +%s) + duration=$((end_time-start_time)) + echo "Mega service start duration is $duration s" && sleep 1s + + if [ "${mode}" == "perf" ]; then + python3 "$WORKPATH"/tests/chatqna_benchmark.py + elif [ "${mode}" == "" ]; then + validate_microservices + echo "==== microservices validated ====" + validate_megaservice + echo "==== megaservice validated ====" +# validate_frontend +# echo "==== frontend validated ====" + fi + + stop_docker + echo y | docker system prune + +} + +main From ee6d1724e6bf9e8b79d1fe805e6a7cd1824cdae1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 12 Nov 2024 09:39:48 +0000 Subject: [PATCH 02/24] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ChatQnA/docker_compose/amd/gpu/rocm/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChatQnA/docker_compose/amd/gpu/rocm/README.md b/ChatQnA/docker_compose/amd/gpu/rocm/README.md index 7a19bd96f..b154e9126 100644 --- a/ChatQnA/docker_compose/amd/gpu/rocm/README.md +++ b/ChatQnA/docker_compose/amd/gpu/rocm/README.md @@ -211,7 +211,7 @@ Change the `xxx_MODEL_ID` below for your needs. export http_proxy="Your_HTTP_Proxy" export https_proxy="Your_HTTPs_Proxy" ``` - + 3. Note: In order to limit access to a subset of GPUs, please pass each device individually using one or more -device /dev/dri/rendered, where is the card index, starting from 128. (https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/docker.html#docker-restrict-gpus) into tgi-service in compose.yaml file Example for set isolation for 1 GPU From 26b31fb5af8072eec71750d5bd7f982df1e8efed Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Wed, 13 Nov 2024 17:31:39 +0700 Subject: [PATCH 03/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 62 +++++++++++++-------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 734965bc8..0c42ded0a 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -14,6 +14,37 @@ WORKPATH=$(dirname "$PWD") LOG_PATH="$WORKPATH/tests" ip_address=$(hostname -I | awk '{print $1}') +export CHATQNA_TGI_SERVICE_IMAGE="ghcr.io/huggingface/text-generation-inference:2.3.1-rocm" +export CHATQNA_EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" +export CHATQNA_RERANK_MODEL_ID="BAAI/bge-reranker-base" +export CHATQNA_LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" +export CHATQNA_TGI_SERVICE_PORT=9009 +export CHATQNA_TEI_EMBEDDING_PORT=8090 +export CHATQNA_TEI_EMBEDDING_ENDPOINT="http://${HOST_IP}:${CHATQNA_TEI_EMBEDDING_PORT}" +export CHATQNA_TEI_RERANKING_PORT=8808 +export CHATQNA_REDIS_VECTOR_PORT=6379 +export CHATQNA_REDIS_VECTOR_INSIGHT_PORT=8001 +export CHATQNA_REDIS_DATAPREP_PORT=6007 +export CHATQNA_REDIS_RETRIEVER_PORT=7000 +export CHATQNA_INDEX_NAME="rag-redis" +export CHATQNA_MEGA_SERVICE_HOST_IP=${HOST_IP} +export CHATQNA_RETRIEVER_SERVICE_HOST_IP=${HOST_IP} +export CHATQNA_BACKEND_SERVICE_ENDPOINT="http://127.0.0.1:${CHATQNA_BACKEND_SERVICE_PORT}/v1/chatqna" +export CHATQNA_DATAPREP_SERVICE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep" +export CHATQNA_DATAPREP_GET_FILE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep/get_file" +export CHATQNA_DATAPREP_DELETE_FILE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep/delete_file" +export CHATQNA_FRONTEND_SERVICE_IP=${HOST_IP} +export CHATQNA_FRONTEND_SERVICE_PORT=15173 +export CHATQNA_BACKEND_SERVICE_NAME=chatqna +export CHATQNA_BACKEND_SERVICE_IP=${HOST_IP} +export CHATQNA_BACKEND_SERVICE_PORT=8888 +export CHATQNA_REDIS_URL="redis://${HOST_IP}:${CHATQNA_REDIS_VECTOR_PORT}" +export CHATQNA_EMBEDDING_SERVICE_HOST_IP=${HOST_IP} +export CHATQNA_RERANK_SERVICE_HOST_IP=${HOST_IP} +export CHATQNA_LLM_SERVICE_HOST_IP=${HOST_IP} +export CHATQNA_NGINX_PORT=15176 +export CHATQNA_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} + function build_docker_images() { cd "$WORKPATH"/docker_image_build git clone https://github.com/opea-project/GenAIComps.git && cd GenAIComps && git checkout "${opea_branch:-"main"}" && cd ../ @@ -31,37 +62,6 @@ function build_docker_images() { function start_services() { cd "$WORKPATH"/docker_compose/amd/gpu/rocm - export CHATQNA_TGI_SERVICE_IMAGE="ghcr.io/huggingface/text-generation-inference:2.3.1-rocm" - export CHATQNA_EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" - export CHATQNA_RERANK_MODEL_ID="BAAI/bge-reranker-base" - export CHATQNA_LLM_MODEL_ID="Intel/neural-chat-7b-v3-3" - export CHATQNA_TGI_SERVICE_PORT=18008 - export CHATQNA_TEI_EMBEDDING_PORT=18090 - export CHATQNA_TEI_EMBEDDING_ENDPOINT="http://${HOST_IP}:${CHATQNA_TEI_EMBEDDING_PORT}" - export CHATQNA_TEI_RERANKING_PORT=18808 - export CHATQNA_REDIS_VECTOR_PORT=16379 - export CHATQNA_REDIS_VECTOR_INSIGHT_PORT=8001 - export CHATQNA_REDIS_DATAPREP_PORT=6007 - export CHATQNA_REDIS_RETRIEVER_PORT=7000 - export CHATQNA_INDEX_NAME="rag-redis" - export CHATQNA_MEGA_SERVICE_HOST_IP=${HOST_IP} - export CHATQNA_RETRIEVER_SERVICE_HOST_IP=${HOST_IP} - export CHATQNA_BACKEND_SERVICE_ENDPOINT="http://127.0.0.1:${CHATQNA_BACKEND_SERVICE_PORT}/v1/chatqna" - export CHATQNA_DATAPREP_SERVICE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep" - export CHATQNA_DATAPREP_GET_FILE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep/get_file" - export CHATQNA_DATAPREP_DELETE_FILE_ENDPOINT="http://127.0.0.1:${CHATQNA_REDIS_DATAPREP_PORT}/v1/dataprep/delete_file" - export CHATQNA_FRONTEND_SERVICE_IP=${HOST_IP} - export CHATQNA_FRONTEND_SERVICE_PORT=15173 - export CHATQNA_BACKEND_SERVICE_NAME=chatqna - export CHATQNA_BACKEND_SERVICE_IP=${HOST_IP} - export CHATQNA_BACKEND_SERVICE_PORT=18888 - export CHATQNA_REDIS_URL="redis://${HOST_IP}:${CHATQNA_REDIS_VECTOR_PORT}" - export CHATQNA_EMBEDDING_SERVICE_HOST_IP=${HOST_IP} - export CHATQNA_RERANK_SERVICE_HOST_IP=${HOST_IP} - export CHATQNA_LLM_SERVICE_HOST_IP=${HOST_IP} - export CHATQNA_NGINX_PORT=15176 - export CHATQNA_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} - # Start Docker Containers docker compose -f compose.yaml up -d > "${LOG_PATH}"/start_services_with_compose.log From 92f4fcd336f3f047a8827d47a079f1ce61c61a85 Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Wed, 13 Nov 2024 17:34:14 +0700 Subject: [PATCH 04/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 0c42ded0a..9d986fdfc 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -50,8 +50,7 @@ function build_docker_images() { git clone https://github.com/opea-project/GenAIComps.git && cd GenAIComps && git checkout "${opea_branch:-"main"}" && cd ../ echo "Build all the images with --no-cache, check docker_image_build.log for details..." - service_list="chatqna chatqna-ui chatqna-conversation-ui dataprep-redis retriever-redis nginx" - docker compose -f build.yaml build "${service_list}" --no-cache > "${LOG_PATH}"/docker_image_build.log + docker compose -f build.yaml build --no-cache > "${LOG_PATH}"/docker_image_build.log docker pull ghcr.io/huggingface/text-generation-inference:2.3.1-rocm docker pull ghcr.io/huggingface/text-embeddings-inference:cpu-1.5 From 4e09e9449286b961545a4979b1e914188a84e3db Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Wed, 13 Nov 2024 17:36:47 +0700 Subject: [PATCH 05/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 9d986fdfc..68ba8a6b1 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -235,7 +235,7 @@ function stop_docker() { function main() { stop_docker - if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi +# if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi start_time=$(date +%s) start_services end_time=$(date +%s) From c9aacfb8ca5dbefdb755123e492a9f73b553a6ff Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Wed, 13 Nov 2024 17:40:35 +0700 Subject: [PATCH 06/24] Update compose.yaml Signed-off-by: Artem Astafev --- ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml b/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml index f279bf254..d97d7d5df 100644 --- a/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml +++ b/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml @@ -9,7 +9,7 @@ services: - "${CHATQNA_REDIS_VECTOR_PORT}:6379" - "${CHATQNA_REDIS_VECTOR_INSIGHT_PORT}:8001" chatqna-dataprep-redis-service: - image: ${REGISTRY:-opea}/dataprep-redis:${TAG:-latest} + image: ${REGISTRY:-opea}/dataprep-redis:latest container_name: dataprep-redis-server depends_on: - chatqna-redis-vector-db @@ -48,7 +48,7 @@ services: security_opt: - seccomp:unconfined chatqna-retriever: - image: ${REGISTRY:-opea}/retriever-redis:${TAG:-latest} + image: ${REGISTRY:-opea}/retriever-redis:latest container_name: chatqna-retriever-redis-server depends_on: - chatqna-redis-vector-db @@ -115,7 +115,7 @@ services: command: --model-id ${CHATQNA_LLM_MODEL_ID} ipc: host chatqna-backend-server: - image: ${REGISTRY:-opea}/chatqna:${TAG:-latest} + image: ${REGISTRY:-opea}/chatqna:latest container_name: chatqna-backend-server depends_on: - chatqna-redis-vector-db @@ -141,7 +141,7 @@ services: ipc: host restart: always chatqna-ui-server: - image: ${REGISTRY:-opea}/chatqna-ui:${TAG:-latest} + image: ${REGISTRY:-opea}/chatqna-ui:latest container_name: chatqna-ui-server depends_on: - chatqna-backend-server @@ -158,7 +158,7 @@ services: ipc: host restart: always chatqna-nginx-server: - image: ${REGISTRY:-opea}/nginx:${TAG:-latest} + image: ${REGISTRY:-opea}/nginx:latest container_name: chaqna-nginx-server depends_on: - chatqna-backend-server From 732aefb2dcaf3f2ff6e79f5c7801f31728279d2e Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Wed, 13 Nov 2024 17:44:03 +0700 Subject: [PATCH 07/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 68ba8a6b1..7a81cfd5d 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -66,7 +66,7 @@ function start_services() { n=0 until [[ "$n" -ge 500 ]]; do - docker logs chatqna-tgi-service > "${LOG_PATH}"/tgi_service_start.log + docker logs chatqna-tgi-server > "${LOG_PATH}"/tgi_service_start.log if grep -q Connected "${LOG_PATH}"/tgi_service_start.log; then break fi From 81d76bbc30e8c215299c23624b29f9458a259961 Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Wed, 13 Nov 2024 17:58:28 +0700 Subject: [PATCH 08/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 7a81cfd5d..41590c1a8 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -14,6 +14,7 @@ WORKPATH=$(dirname "$PWD") LOG_PATH="$WORKPATH/tests" ip_address=$(hostname -I | awk '{print $1}') +export HOST_IP=${ip_address} export CHATQNA_TGI_SERVICE_IMAGE="ghcr.io/huggingface/text-generation-inference:2.3.1-rocm" export CHATQNA_EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" export CHATQNA_RERANK_MODEL_ID="BAAI/bge-reranker-base" From ae50c39cb1821f10790be63eb21343caa4af14ec Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 10:58:52 +0000 Subject: [PATCH 09/24] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- ChatQnA/tests/test_compose_on_rocm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 41590c1a8..0574ff9a1 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -14,7 +14,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 CHATQNA_TGI_SERVICE_IMAGE="ghcr.io/huggingface/text-generation-inference:2.3.1-rocm" export CHATQNA_EMBEDDING_MODEL_ID="BAAI/bge-base-en-v1.5" export CHATQNA_RERANK_MODEL_ID="BAAI/bge-reranker-base" From eb1aec9b5e291623f9018e8133a61ff33f6dbf0a Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Wed, 13 Nov 2024 19:32:04 +0700 Subject: [PATCH 10/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 0574ff9a1..6ce3c85af 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -242,17 +242,21 @@ function main() { end_time=$(date +%s) duration=$((end_time-start_time)) echo "Mega service start duration is $duration s" && sleep 1s - - if [ "${mode}" == "perf" ]; then - python3 "$WORKPATH"/tests/chatqna_benchmark.py - elif [ "${mode}" == "" ]; then - validate_microservices - echo "==== microservices validated ====" - validate_megaservice - echo "==== megaservice validated ====" + validate_microservices + echo "==== microservices validated ====" + validate_megaservice + echo "==== megaservice validated ====" + +# if [ "${mode}" == "perf" ]; then +# python3 "$WORKPATH"/tests/chatqna_benchmark.py +# elif [ "${mode}" == "" ]; then +# validate_microservices +# echo "==== microservices validated ====" +# validate_megaservice +# echo "==== megaservice validated ====" # validate_frontend # echo "==== frontend validated ====" - fi +# fi stop_docker echo y | docker system prune From f1f9f7a9635527717e8a34731755dd94710a6541 Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Thu, 14 Nov 2024 15:05:13 +0700 Subject: [PATCH 11/24] Update compose.yaml Signed-off-by: Artem Astafev --- ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml b/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml index d97d7d5df..f279bf254 100644 --- a/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml +++ b/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml @@ -9,7 +9,7 @@ services: - "${CHATQNA_REDIS_VECTOR_PORT}:6379" - "${CHATQNA_REDIS_VECTOR_INSIGHT_PORT}:8001" chatqna-dataprep-redis-service: - image: ${REGISTRY:-opea}/dataprep-redis:latest + image: ${REGISTRY:-opea}/dataprep-redis:${TAG:-latest} container_name: dataprep-redis-server depends_on: - chatqna-redis-vector-db @@ -48,7 +48,7 @@ services: security_opt: - seccomp:unconfined chatqna-retriever: - image: ${REGISTRY:-opea}/retriever-redis:latest + image: ${REGISTRY:-opea}/retriever-redis:${TAG:-latest} container_name: chatqna-retriever-redis-server depends_on: - chatqna-redis-vector-db @@ -115,7 +115,7 @@ services: command: --model-id ${CHATQNA_LLM_MODEL_ID} ipc: host chatqna-backend-server: - image: ${REGISTRY:-opea}/chatqna:latest + image: ${REGISTRY:-opea}/chatqna:${TAG:-latest} container_name: chatqna-backend-server depends_on: - chatqna-redis-vector-db @@ -141,7 +141,7 @@ services: ipc: host restart: always chatqna-ui-server: - image: ${REGISTRY:-opea}/chatqna-ui:latest + image: ${REGISTRY:-opea}/chatqna-ui:${TAG:-latest} container_name: chatqna-ui-server depends_on: - chatqna-backend-server @@ -158,7 +158,7 @@ services: ipc: host restart: always chatqna-nginx-server: - image: ${REGISTRY:-opea}/nginx:latest + image: ${REGISTRY:-opea}/nginx:${TAG:-latest} container_name: chaqna-nginx-server depends_on: - chatqna-backend-server From c0179c40b8e5e3a59a2704c77452a8bf5dd5526d Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Thu, 14 Nov 2024 15:08:17 +0700 Subject: [PATCH 12/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 6ce3c85af..3e2ae4300 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -51,7 +51,8 @@ function build_docker_images() { git clone https://github.com/opea-project/GenAIComps.git && cd GenAIComps && git checkout "${opea_branch:-"main"}" && cd ../ echo "Build all the images with --no-cache, check docker_image_build.log for details..." - docker compose -f build.yaml build --no-cache > "${LOG_PATH}"/docker_image_build.log + service_list="chatqna chatqna-ui chatqna-conversation-ui dataprep-redis retriever-redis nginx" + docker compose -f build.yaml build ${service_list} --no-cache > "${LOG_PATH}"/docker_image_build.log docker pull ghcr.io/huggingface/text-generation-inference:2.3.1-rocm docker pull ghcr.io/huggingface/text-embeddings-inference:cpu-1.5 @@ -236,27 +237,24 @@ function stop_docker() { function main() { stop_docker -# if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi + if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi start_time=$(date +%s) start_services end_time=$(date +%s) duration=$((end_time-start_time)) echo "Mega service start duration is $duration s" && sleep 1s - validate_microservices - echo "==== microservices validated ====" - validate_megaservice - echo "==== megaservice validated ====" - -# if [ "${mode}" == "perf" ]; then -# python3 "$WORKPATH"/tests/chatqna_benchmark.py -# elif [ "${mode}" == "" ]; then -# validate_microservices -# echo "==== microservices validated ====" -# validate_megaservice -# echo "==== megaservice validated ====" + + + if [ "${mode}" == "perf" ]; then + python3 "$WORKPATH"/tests/chatqna_benchmark.py + elif [ "${mode}" == "" ]; then + validate_microservices + echo "==== microservices validated ====" + validate_megaservice + echo "==== megaservice validated ====" # validate_frontend # echo "==== frontend validated ====" -# fi + fi stop_docker echo y | docker system prune From 5580c08191ada49ddc809d76569a5d47b3cc42ba Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Thu, 14 Nov 2024 15:15:48 +0700 Subject: [PATCH 13/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 3e2ae4300..0c3172aa9 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -240,9 +240,9 @@ function main() { if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi start_time=$(date +%s) start_services - end_time=$(date +%s) - duration=$((end_time-start_time)) - echo "Mega service start duration is $duration s" && sleep 1s +# end_time=$(date +%s) +# duration=$((end_time-start_time)) +# echo "Mega service start duration is $duration s" && sleep 1s if [ "${mode}" == "perf" ]; then From b9097ceb56796e0ffc2b1e275dbe682fa0498055 Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Thu, 14 Nov 2024 17:31:29 +0700 Subject: [PATCH 14/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 0c3172aa9..9d6c56a71 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -2,7 +2,7 @@ # Copyright (C) 2024 Advanced Micro Devices, Inc. # SPDX-License-Identifier: Apache-2.0 -set -e +set -xe IMAGE_REPO=${IMAGE_REPO:-"opea"} IMAGE_TAG=${IMAGE_TAG:-"latest"} echo "REGISTRY=IMAGE_REPO=${IMAGE_REPO}" @@ -124,10 +124,10 @@ function validate_microservices() { # tei for embedding service validate_service \ - "${ip_address}:6006/embed" \ + "${ip_address}:8090/embed" \ "[[" \ "tei-embedding" \ - "tei-embedding-server" \ + "chatqna-tei-embedding-server" \ '{"inputs":"What is Deep Learning?"}' sleep 1m # retrieval can't curl as expected, try to wait for more time @@ -138,28 +138,28 @@ function validate_microservices() { "http://${ip_address}:6007/v1/dataprep" \ "Data preparation succeeded" \ "dataprep_upload_file" \ - "dataprep-redis-server" + "chatqna-dataprep-redis-server" # test /v1/dataprep upload link validate_service \ "http://${ip_address}:6007/v1/dataprep" \ "Data preparation succeeded" \ "dataprep_upload_link" \ - "dataprep-redis-server" + "chatqna-dataprep-redis-server" # test /v1/dataprep/get_file validate_service \ "http://${ip_address}:6007/v1/dataprep/get_file" \ '{"name":' \ "dataprep_get" \ - "dataprep-redis-server" + "chatqna-dataprep-redis-server" # test /v1/dataprep/delete_file validate_service \ "http://${ip_address}:6007/v1/dataprep/delete_file" \ '{"status":true}' \ "dataprep_del" \ - "dataprep-redis-server" + "chatqna-dataprep-redis-server" # retrieval microservice test_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)") @@ -167,7 +167,7 @@ function validate_microservices() { "${ip_address}:7000/v1/retrieval" \ "retrieved_docs" \ "retrieval-microservice" \ - "retriever-redis-server" \ + "chatqna-retriever-redis-server" \ "{\"text\":\"What is the revenue of Nike in 2023?\",\"embedding\":${test_embedding}}" # tei for rerank microservice @@ -175,7 +175,7 @@ function validate_microservices() { "${ip_address}:8808/rerank" \ '{"index":1,"score":' \ "tei-rerank" \ - "tei-reranking-server" \ + "chatqna-tei-reranking-server" \ '{"query":"What is Deep Learning?", "texts": ["Deep Learning is not...", "Deep learning is..."]}' # tgi for llm service @@ -183,7 +183,7 @@ function validate_microservices() { "${ip_address}:9009/generate" \ "generated_text" \ "tgi-llm" \ - "tgi-service" \ + "chatqna-tgi-service" \ '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' } From 5fe8fd4d4bbe1267763661fa3c9f084cd2fd9745 Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Thu, 14 Nov 2024 17:47:41 +0700 Subject: [PATCH 15/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 9d6c56a71..24e68219b 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -138,14 +138,14 @@ function validate_microservices() { "http://${ip_address}:6007/v1/dataprep" \ "Data preparation succeeded" \ "dataprep_upload_file" \ - "chatqna-dataprep-redis-server" + "dataprep-redis-server" # test /v1/dataprep upload link validate_service \ "http://${ip_address}:6007/v1/dataprep" \ "Data preparation succeeded" \ "dataprep_upload_link" \ - "chatqna-dataprep-redis-server" + "dataprep-redis-server" # test /v1/dataprep/get_file validate_service \ @@ -159,7 +159,7 @@ function validate_microservices() { "http://${ip_address}:6007/v1/dataprep/delete_file" \ '{"status":true}' \ "dataprep_del" \ - "chatqna-dataprep-redis-server" + "dataprep-redis-server" # retrieval microservice test_embedding=$(python3 -c "import random; embedding = [random.uniform(-1, 1) for _ in range(768)]; print(embedding)") From 84779a6ef662074f5fcb39bfba600a8cf568c668 Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Thu, 14 Nov 2024 17:55:24 +0700 Subject: [PATCH 16/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 24e68219b..b67b79d44 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -152,7 +152,7 @@ function validate_microservices() { "http://${ip_address}:6007/v1/dataprep/get_file" \ '{"name":' \ "dataprep_get" \ - "chatqna-dataprep-redis-server" + "dataprep-redis-server" # test /v1/dataprep/delete_file validate_service \ From 79e56ee66f01359da769bcb0329821d2feac3175 Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Thu, 14 Nov 2024 18:16:35 +0700 Subject: [PATCH 17/24] Update compose.yaml Signed-off-by: Artem Astafev --- ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml b/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml index f279bf254..dd0c4ddc7 100644 --- a/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml +++ b/ChatQnA/docker_compose/amd/gpu/rocm/compose.yaml @@ -40,7 +40,8 @@ services: command: --model-id ${CHATQNA_EMBEDDING_MODEL_ID} --auto-truncate devices: - /dev/kfd:/dev/kfd - - /dev/dri/:/dev/dri/ + - /dev/dri/card1:/dev/dri/card1 + - /dev/dri/renderD136:/dev/dri/renderD136 cap_add: - SYS_PTRACE group_add: From c786f97388061bfab3fd373377c879f68b7002bd Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Thu, 14 Nov 2024 18:47:41 +0700 Subject: [PATCH 18/24] Update README.md Signed-off-by: Artem Astafev --- ChatQnA/docker_compose/amd/gpu/rocm/README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ChatQnA/docker_compose/amd/gpu/rocm/README.md b/ChatQnA/docker_compose/amd/gpu/rocm/README.md index b154e9126..b96f26b33 100644 --- a/ChatQnA/docker_compose/amd/gpu/rocm/README.md +++ b/ChatQnA/docker_compose/amd/gpu/rocm/README.md @@ -1,4 +1,8 @@ -# Build MegaService of ChatQnA on AMD ROCm GPU +###### Copyright (C) 2024 Advanced Micro Devices, Inc. + +# Build and deploy CodeGen Application on AMD GPU (ROCm) + +## Build MegaService of ChatQnA on AMD ROCm GPU This document outlines the deployment process for a ChatQnA application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on AMD ROCm GPU platform. The steps include Docker image creation, container deployment via Docker Compose, and service execution to integrate microservices such as embedding, retriever, rerank, and llm. We will publish the Docker images to Docker Hub, it will simplify the deployment process for this service. From 8cd857521352197ff5c7351d3ede0f6f4b22d92c Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Thu, 14 Nov 2024 18:54:34 +0700 Subject: [PATCH 19/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index b67b79d44..d85f101f2 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -183,7 +183,7 @@ function validate_microservices() { "${ip_address}:9009/generate" \ "generated_text" \ "tgi-llm" \ - "chatqna-tgi-service" \ + "chatqna-tgi-server" \ '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' } @@ -194,7 +194,7 @@ function validate_megaservice() { "${ip_address}:8888/v1/chatqna" \ "data: " \ "chatqna-megaservice" \ - "chatqna-xeon-backend-server" \ + "chatqna-backend-server" \ '{"messages": "What is the revenue of Nike in 2023?"}' } From 1eeb3b86efab5cdb880a7580d5d8c0b44169f8b4 Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Fri, 15 Nov 2024 10:46:47 +0700 Subject: [PATCH 20/24] Update README.md Signed-off-by: Artem Astafev --- ChatQnA/docker_compose/amd/gpu/rocm/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/ChatQnA/docker_compose/amd/gpu/rocm/README.md b/ChatQnA/docker_compose/amd/gpu/rocm/README.md index b96f26b33..2f8a0086f 100644 --- a/ChatQnA/docker_compose/amd/gpu/rocm/README.md +++ b/ChatQnA/docker_compose/amd/gpu/rocm/README.md @@ -1,5 +1,3 @@ -###### Copyright (C) 2024 Advanced Micro Devices, Inc. - # Build and deploy CodeGen Application on AMD GPU (ROCm) ## Build MegaService of ChatQnA on AMD ROCm GPU From 61e6de1c00fbefc9a657421a4244595576d1a74d Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Fri, 15 Nov 2024 11:00:10 +0700 Subject: [PATCH 21/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index d85f101f2..d3df09330 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -240,9 +240,9 @@ function main() { if [[ "$IMAGE_REPO" == "opea" ]]; then build_docker_images; fi start_time=$(date +%s) start_services -# end_time=$(date +%s) -# duration=$((end_time-start_time)) -# echo "Mega service start duration is $duration s" && sleep 1s + end_time=$(date +%s) + duration=$((end_time-start_time)) + echo "Mega service start duration is $duration s" && sleep 1s if [ "${mode}" == "perf" ]; then @@ -252,8 +252,8 @@ function main() { echo "==== microservices validated ====" validate_megaservice echo "==== megaservice validated ====" -# validate_frontend -# echo "==== frontend validated ====" + validate_frontend + echo "==== frontend validated ====" fi stop_docker From 929a677b3334da0e8d995a49296e5948c92bfa3a Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Fri, 15 Nov 2024 11:32:43 +0700 Subject: [PATCH 22/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index d3df09330..6823ba6bb 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -45,6 +45,7 @@ export CHATQNA_RERANK_SERVICE_HOST_IP=${HOST_IP} export CHATQNA_LLM_SERVICE_HOST_IP=${HOST_IP} export CHATQNA_NGINX_PORT=15176 export CHATQNA_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} +export PATH="/home/huggingface/miniconda3/bin:$PATH" function build_docker_images() { cd "$WORKPATH"/docker_image_build From 0885cedbc8bd19092f303c9f5838dcea5cd348df Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Fri, 15 Nov 2024 11:43:40 +0700 Subject: [PATCH 23/24] Update test_compose_on_rocm.sh Signed-off-by: Artem Astafev --- ChatQnA/tests/test_compose_on_rocm.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ChatQnA/tests/test_compose_on_rocm.sh b/ChatQnA/tests/test_compose_on_rocm.sh index 6823ba6bb..6518578e6 100644 --- a/ChatQnA/tests/test_compose_on_rocm.sh +++ b/ChatQnA/tests/test_compose_on_rocm.sh @@ -43,7 +43,7 @@ export CHATQNA_REDIS_URL="redis://${HOST_IP}:${CHATQNA_REDIS_VECTOR_PORT}" export CHATQNA_EMBEDDING_SERVICE_HOST_IP=${HOST_IP} export CHATQNA_RERANK_SERVICE_HOST_IP=${HOST_IP} export CHATQNA_LLM_SERVICE_HOST_IP=${HOST_IP} -export CHATQNA_NGINX_PORT=15176 +export CHATQNA_NGINX_PORT=80 export CHATQNA_HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} export PATH="/home/huggingface/miniconda3/bin:$PATH" From 0e6f4dc1ae84d206f900a31681d22e4ae49f160c Mon Sep 17 00:00:00 2001 From: Artem Astafev Date: Fri, 15 Nov 2024 14:21:11 +0700 Subject: [PATCH 24/24] Update README.md Signed-off-by: Artem Astafev --- ChatQnA/docker_compose/amd/gpu/rocm/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ChatQnA/docker_compose/amd/gpu/rocm/README.md b/ChatQnA/docker_compose/amd/gpu/rocm/README.md index 2f8a0086f..9e18d0f61 100644 --- a/ChatQnA/docker_compose/amd/gpu/rocm/README.md +++ b/ChatQnA/docker_compose/amd/gpu/rocm/README.md @@ -421,12 +421,12 @@ Once the services are up, open the following URL in your browser: http://{host_i - "80:80" ``` -![project-screenshot](../../../assets/img/chat_ui_init.png) +![project-screenshot](../../../../assets/img/chat_ui_init.png) Here is an example of running ChatQnA: -![project-screenshot](../../../assets/img/chat_ui_response.png) +![project-screenshot](../../../../assets/img/chat_ui_response.png) Here is an example of running ChatQnA with Conversational UI (React): -![project-screenshot](../../../assets/img/conversation_ui_response.png) +![project-screenshot](../../../../assets/img/conversation_ui_response.png)