Skip to content

Commit 530b1b6

Browse files
ZePan110pre-commit-ci[bot]Copilot
authored
Refine documents for AvatarChatbot. (#2077)
Signed-off-by: ZePan110 <ze.pan@intel.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 6f7daf8 commit 530b1b6

3 files changed

Lines changed: 217 additions & 289 deletions

File tree

AvatarChatbot/README.md

Lines changed: 15 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
# AvatarChatbot Application
22

3-
The AvatarChatbot service can be effortlessly deployed on either Intel Gaudi2 or Intel XEON Scalable Processors.
3+
The AvatarChatbot example demonstrates the implementation of AI avatar chatbot using OPEA component-level microservices.
44

5-
## AI Avatar Workflow
5+
## Table of contents
6+
7+
1. [Architecture](#architecture)
8+
2. [Deployment Options](#deployment-options)
9+
10+
## Architecture
611

712
The AI Avatar example is implemented using both megaservices and the component-level microservices defined in [GenAIComps](https://github.com/opea-project/GenAIComps). The flow chart below shows the information flow between different megaservices and microservices for this example.
813

@@ -69,37 +74,14 @@ flowchart LR
6974
UI <-.->|6'| WAV2LIP
7075
```
7176

72-
## Deploy AvatarChatbot Service
73-
74-
The AvatarChatbot service can be deployed on either Intel Gaudi2 AI Accelerator or Intel Xeon Scalable Processor.
75-
76-
### Deploy AvatarChatbot on Gaudi
77-
78-
Refer to the [Gaudi Guide](./docker_compose/intel/hpu/gaudi/README.md) for instructions on deploying AvatarChatbot on Gaudi, and on setting up an UI for the application.
79-
80-
### Deploy AvatarChatbot on Xeon
81-
82-
Refer to the [Xeon Guide](./docker_compose/intel/cpu/xeon/README.md) for instructions on deploying AvatarChatbot on Xeon.
83-
84-
## Supported Models
85-
86-
### ASR
87-
88-
The default model is [openai/whisper-small](https://huggingface.co/openai/whisper-small). It also supports all models in the Whisper family, such as `openai/whisper-large-v3`, `openai/whisper-medium`, `openai/whisper-base`, `openai/whisper-tiny`, etc.
89-
90-
To replace the model, please edit the `compose.yaml` and add the `command` line to pass the name of the model you want to use:
91-
92-
```yaml
93-
services:
94-
whisper-service:
95-
...
96-
command: --model_name_or_path openai/whisper-tiny
97-
```
98-
99-
### TTS
77+
This AvatarChatbot use case performs AI avatar chatbot across multiple platforms. Currently, we provide the example for [Intel Gaudi2](https://www.intel.com/content/www/us/en/products/details/processors/ai-accelerators/gaudi-overview.html) and [Intel Xeon Scalable Processors](https://www.intel.com/content/www/us/en/products/details/processors/xeon.html), and we invite contributions from other hardware vendors to expand OPEA ecosystem.
10078

101-
The default model is [microsoft/SpeechT5](https://huggingface.co/microsoft/speecht5_tts). We currently do not support replacing the model. More models under the commercial license will be added in the future.
79+
## Deployment Options
10280

103-
### Animation
81+
The table below lists the available deployment options and their implementation details for different hardware platforms.
10482

105-
The default model is [Rudrabha/Wav2Lip](https://github.com/Rudrabha/Wav2Lip) and [TencentARC/GFPGAN](https://github.com/TencentARC/GFPGAN). We currently do not support replacing the model. More models under the commercial license such as [OpenTalker/SadTalker](https://github.com/OpenTalker/SadTalker) will be added in the future.
83+
| Platform | Deployment Method | Link |
84+
| ------------ | ----------------- | ----------------------------------------------------------------- |
85+
| Intel Xeon | Docker compose | [Deployment on Xeon](./docker_compose/intel/cpu/xeon/README.md) |
86+
| Intel Gaudi2 | Docker compose | [Deployment on Gaudi](./docker_compose/intel/hpu/gaudi/README.md) |
87+
| AMD ROCm | Docker compose | [Deployment on AMD Rocm](./docker_compose/amd/gpu/rocm/README.md) |
Lines changed: 102 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,96 @@
1-
# Build Mega Service of AvatarChatbot on Xeon
1+
# Example AvatarChatbot Deployment on Intel® Xeon® Platform
22

3-
This document outlines the deployment process for a AvatarChatbot application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Xeon server.
3+
This document outlines the deployment process for a AvatarChatbot application utilizing the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline on Intel Xeon server. This example includes the following sections:
44

5-
## 🚀 Build Docker images
5+
- [AvatarChatbot Quick Start Deployment](#avatarchatbot-quick-start-deployment): Demonstrates how to quickly deploy a AvatarChatbot service/pipeline on Intel Xeon server.
6+
- [AvatarChatbot Docker Compose Files](#avatarchatbot-docker-compose-files): Describes some example deployments and their docker compose files.
7+
- [AvatarChatbot Service Configuration](#avatarchatbot-service-configuration): Describes the service and possible configuration changes.
68

7-
### 1. Source Code install GenAIComps
9+
## AvatarChatbot Quick Start Deployment
810

9-
```bash
10-
git clone https://github.com/opea-project/GenAIComps.git
11-
cd GenAIComps
12-
```
13-
14-
### 2. Build ASR Image
15-
16-
```bash
17-
docker build -t opea/whisper:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/third_parties/whisper/src/Dockerfile .
18-
```
19-
20-
### 3. Build LLM Image
11+
This section describes how to quickly deploy and test the AvatarChatbot service manually on Intel Xeon server. The basic steps are:
2112

22-
Intel Xeon optimized image hosted in huggingface repo will be used for TGI service: ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu (https://github.com/huggingface/text-generation-inference)
13+
1. [Access the Code](#access-the-code)
14+
2. [Generate a HuggingFace Access Token](#generate-a-huggingface-access-token)
15+
3. [Configure the Deployment Environment](#configure-the-deployment-environment)
16+
4. [Deploy the Service Using Docker Compose](#deploy-the-service-using-docker-compose)
17+
5. [Check the Deployment Status](#check-the-deployment-status)
18+
6. [Test the Pipeline](#test-the-pipeline)
19+
7. [Cleanup the Deployment](#cleanup-the-deployment)
2320

24-
### 4. Build TTS Image
21+
### Access the Code
2522

26-
```bash
27-
docker build -t opea/speecht5:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/third_parties/speecht5/src/Dockerfile .
28-
```
23+
Clone the GenAIExamples repository and access the AvatarChatbot Intel Xeon server Docker Compose files and supporting scripts:
2924

30-
### 5. Build Animation Image
31-
32-
```bash
33-
docker build -t opea/wav2lip:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/third_parties/wav2lip/src/Dockerfile .
34-
35-
docker build -t opea/animation:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f comps/animation/src/Dockerfile .
3625
```
37-
38-
### 6. Build MegaService Docker Image
39-
40-
To construct the Mega Service, we utilize the [GenAIComps](https://github.com/opea-project/GenAIComps.git) microservice pipeline within the `audioqna.py` Python script. Build the MegaService Docker image using the command below:
41-
42-
```bash
4326
git clone https://github.com/opea-project/GenAIExamples.git
44-
cd GenAIExamples/AvatarChatbot/
45-
docker build --no-cache -t opea/avatarchatbot:latest --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy -f Dockerfile .
27+
cd GenAIExamples/AvatarChatbot/docker_compose/intel/cpu/xeon/
4628
```
4729

48-
Then run the command `docker images`, you will have following images ready:
49-
50-
1. `opea/whisper:latest`
51-
2. `opea/speecht5:latest`
52-
3. `opea/wav2lip:latest`
53-
4. `opea/animation:latest`
54-
5. `opea/avatarchatbot:latest`
30+
Checkout a released version, such as v1.3:
5531

56-
## 🚀 Set the environment variables
32+
```
33+
git checkout v1.3
34+
```
5735

58-
Before starting the services with `docker compose`, you have to recheck the following environment variables.
36+
### Generate a HuggingFace Access Token
5937

60-
```bash
61-
export HF_TOKEN=<your_hf_token>
62-
export host_ip=$(hostname -I | awk '{print $1}')
38+
Some HuggingFace resources, such as some models, are only accessible if you have an access token. If you do not already have a HuggingFace access token, you can create one by first creating an account by following the steps provided at [HuggingFace](https://huggingface.co/) and then generating a [user access token](https://huggingface.co/docs/transformers.js/en/guides/private#step-1-generating-a-user-access-token).
6339

64-
export LLM_MODEL_ID=Intel/neural-chat-7b-v3-3
40+
### Configure the Deployment Environment
6541

66-
export WAV2LIP_ENDPOINT=http://$host_ip:7860
42+
To set up environment variables for deploying AvatarChatbot service, source the _set_env.sh_ script in this directory:
6743

68-
export MEGA_SERVICE_HOST_IP=${host_ip}
69-
export WHISPER_SERVER_HOST_IP=${host_ip}
70-
export WHISPER_SERVER_PORT=7066
71-
export SPEECHT5_SERVER_HOST_IP=${host_ip}
72-
export SPEECHT5_SERVER_PORT=7055
73-
export LLM_SERVER_HOST_IP=${host_ip}
74-
export LLM_SERVER_PORT=3006
75-
export ANIMATION_SERVICE_HOST_IP=${host_ip}
76-
export ANIMATION_SERVICE_PORT=3008
77-
78-
export MEGA_SERVICE_PORT=8888
44+
```
45+
source set_env.sh
7946
```
8047

81-
- Xeon CPU
48+
The set_env.sh script will prompt for required and optional environment variables used to configure the AvatarChatbot service. If a value is not entered, the script will use a default value for the same. It will also generate a env file defining the desired configuration. Consult the section on [AvatarChatbot Service configuration](#avatarchatbot-service-configuration) for information on how service specific configuration parameters affect deployments.
8249

83-
```bash
84-
export DEVICE="cpu"
85-
export WAV2LIP_PORT=7860
86-
export INFERENCE_MODE='wav2lip_only'
87-
export CHECKPOINT_PATH='/usr/local/lib/python3.11/site-packages/Wav2Lip/checkpoints/wav2lip_gan.pth'
88-
export FACE="assets/img/avatar1.jpg"
89-
# export AUDIO='assets/audio/eg3_ref.wav' # audio file path is optional, will use base64str in the post request as input if is 'None'
90-
export AUDIO='None'
91-
export FACESIZE=96
92-
export OUTFILE="/outputs/result.mp4"
93-
export GFPGAN_MODEL_VERSION=1.4 # latest version, can roll back to v1.3 if needed
94-
export UPSCALE_FACTOR=1
95-
export FPS=10
96-
```
97-
98-
## 🚀 Start the MegaService
50+
### Deploy the Service Using Docker Compose
51+
52+
To deploy the AvatarChatbot service, execute the `docker compose up` command with the appropriate arguments. For a default deployment, execute:
9953

10054
```bash
101-
cd GenAIExamples/AvatarChatbot/docker_compose/intel/cpu/xeon/
102-
docker compose -f compose.yaml up -d
55+
docker compose up -d
10356
```
10457

105-
## 🚀 Test MicroServices
58+
The AvatarChatbot docker images should automatically be downloaded from the `OPEA registry` and deployed on the Intel Xeon server:
10659

107-
```bash
108-
# whisper service
109-
curl http://${host_ip}:7066/v1/asr \
110-
-X POST \
111-
-d '{"audio": "UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"}' \
112-
-H 'Content-Type: application/json'
60+
```
61+
[+] Running 7/7
62+
✔ Network xeon_default Created 0.1s
63+
✔ Container whisper-service Started 4.4s
64+
✔ Container speecht5-service Started 4.7s
65+
✔ Container wav2lip-service Started 4.7s
66+
✔ Container animation-server Started 4.1s
67+
✔ Container tgi-service Started 4.7s
68+
✔ Container avatarchatbot-xeon-backend-server Started 1.0s
69+
```
11370

114-
# tgi service
115-
curl http://${host_ip}:3006/generate \
116-
-X POST \
117-
-d '{"inputs":"What is Deep Learning?","parameters":{"max_new_tokens":17, "do_sample": true}}' \
118-
-H 'Content-Type: application/json'
71+
### Check the Deployment Status
11972

120-
# speecht5 service
121-
curl http://${host_ip}:7055/v1/tts \
122-
-X POST \
123-
-d '{"text": "Who are you?"}' \
124-
-H 'Content-Type: application/json'
73+
After running docker compose, check if all the containers launched via docker compose have started:
12574

126-
# wav2lip service
127-
cd ../../../..
128-
curl http://${host_ip}:7860/v1/wav2lip \
129-
-X POST \
130-
-d @assets/audio/sample_minecraft.json \
131-
-H 'Content-Type: application/json'
75+
```
76+
docker ps -a
77+
```
13278

133-
# animation microservice
134-
curl http://${host_ip}:3008/v1/animation \
135-
-X POST \
136-
-d @assets/audio/sample_question.json \
137-
-H "Content-Type: application/json"
79+
For the default deployment, the following 5 containers should be running:
13880

81+
```
82+
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
83+
706f3ae2c4eb opea/avatarchatbot:latest "python avatarchatbo…" 16 seconds ago Up 15 seconds avatarchatbot-xeon-backend-server
84+
5dfa217b5376 opea/animation:latest "python3 opea_animat…" 16 seconds ago Up 15 seconds 0.0.0.0:3008->9066/tcp, :::3008->9066/tcp animation-server
85+
60b69f113f24 ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu "text-generation-lau…" 16 seconds ago Up 15 seconds tgi-service
86+
518b409b59c2 opea/speecht5:latest "python speecht5_ser…" 16 seconds ago Up 16 seconds 0.0.0.0:7055->7055/tcp, :::7055->7055/tcp speecht5-service
87+
6454bf20eb5f opea/wav2lip:latest "/usr/local/bin/entr…" 16 seconds ago Up 2 seconds 0.0.0.0:7860->7860/tcp, :::7860->7860/tcp wav2lip-service
88+
eb751a90f76a opea/whisper:latest "python whisper_serv…" 16 seconds ago Up 15 seconds 0.0.0.0:7066->7066/tcp, :::7066->7066/tcp whisper-service
13989
```
14090

141-
## 🚀 Test MegaService
91+
### Test the Pipeline
92+
93+
Once the AvatarChatbot service are running, test the pipeline using the following command:
14294

14395
```bash
14496
curl http://${host_ip}:3009/v1/avatarchatbot \
@@ -155,25 +107,51 @@ If the megaservice is running properly, you should see the following output:
155107

156108
The output file will be saved in the current working directory, as `${PWD}` is mapped to `/outputs` inside the wav2lip-service Docker container.
157109

158-
## Gradio UI
110+
**Note** The value of _host_ip_ was set using the _set_env.sh_ script and can be found in the _.env_ file.
111+
112+
### Cleanup the Deployment
113+
114+
To stop the containers associated with the deployment, execute the following command:
159115

160-
```bash
161-
cd $WORKPATH/GenAIExamples/AvatarChatbot
162-
python3 ui/gradio/app_gradio_demo_avatarchatbot.py
116+
```
117+
docker compose -f compose.yaml down
163118
```
164119

165-
The UI can be viewed at http://${host_ip}:7861
166-
<img src="../../../../assets/img/UI.png" alt="UI Example" width="60%">
167-
In the current version v1.3, you need to set the avatar figure image/video and the DL model choice in the environment variables before starting AvatarChatbot backend service and running the UI. Please just customize the audio question in the UI.
168-
\*\* We will enable change of avatar figure between runs in v2.0
120+
```
121+
[+] Running 7/7
122+
✔ Container wav2lip-service Removed 10.9s
123+
✔ Container speecht5-service Removed 3.4s
124+
✔ Container whisper-service Removed 2.9s
125+
✔ Container avatarchatbot-xeon-backend-server Removed 10.7s
126+
✔ Container tgi-service Removed 3.5s
127+
✔ Container animation-server Removed 11.1s
128+
✔ Network xeon_default Removed 2.1s
129+
```
169130

170-
## Troubleshooting
131+
All the AvatarChatbot containers will be stopped and then removed on completion of the "down" command.
171132

172-
```bash
173-
cd GenAIExamples/AvatarChatbot/tests
174-
export IMAGE_REPO="opea"
175-
export IMAGE_TAG="latest"
176-
export HF_TOKEN=<your_hf_token>
133+
## AvatarChatbot Docker Compose Files
177134

178-
test_avatarchatbot_on_xeon.sh
179-
```
135+
The compose.yaml is default compose file using tgi as serving framework
136+
137+
| Service Name | Image Name |
138+
| --------------------------------- | ------------------------------------------------------------- |
139+
| tgi-service | ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu |
140+
| whisper-service | opea/whisper:latest |
141+
| speecht5-service | opea/speecht5:latest |
142+
| wav2lip-service | opea/wav2lip:latest |
143+
| animation | opea/animation:latest |
144+
| avatarchatbot-xeon-backend-server | opea/avatarchatbot:latest |
145+
146+
## AvatarChatbot Service Configuration
147+
148+
The table provides a comprehensive overview of the AvatarChatbot service utilized across various deployments as illustrated in the example Docker Compose files. Each row in the table represents a distinct service, detailing its possible images used to enable it and a concise description of its function within the deployment architecture.
149+
150+
| Service Name | Possible Image Names | Optional | Description |
151+
| --------------------------------- | ------------------------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------ |
152+
| tgi-service | ghcr.io/huggingface/text-generation-inference:2.4.0-intel-cpu | No | Specific to the TGI deployment, focuses on text generation inference using Xeon hardware. |
153+
| whisper-service | opea/whisper:latest | No | Provides automatic speech recognition (ASR), converting spoken audio input into text. |
154+
| speecht5-service | opea/speecht5:latest | No | Performs text-to-speech (TTS) synthesis, generating natural-sounding speech from text. |
155+
| wav2lip-service | opea/wav2lip:latest | No | Generates realistic lip-sync animations by aligning speech audio with a video of a face. |
156+
| animation | opea/animation:latest | No | Handles avatar animation, rendering facial expressions and movements for the chatbot avatar. |
157+
| avatarchatbot-xeon-backend-server | opea/avatarchatbot:latest | No | Orchestrates the overall AvatarChatbot pipeline, managing requests and integrating all services. |

0 commit comments

Comments
 (0)