Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docsum #1095

Merged
merged 165 commits into from
Nov 18, 2024
Merged

Docsum #1095

Show file tree
Hide file tree
Changes from 117 commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
40246c1
initial
MSCetin37 Oct 14, 2024
10912e4
update the compose file
MSCetin37 Oct 16, 2024
fab8069
updates
MSCetin37 Oct 17, 2024
c9c1a4c
add docsum data
MSCetin37 Oct 17, 2024
8dee06a
updates
MSCetin37 Oct 18, 2024
b49f2c4
updates
MSCetin37 Oct 18, 2024
53abcc2
updates
MSCetin37 Oct 18, 2024
06d1ead
updates
MSCetin37 Oct 21, 2024
1a2eb00
add functional test and data
MSCetin37 Oct 22, 2024
3faf2f9
update the bash test functions
MSCetin37 Oct 25, 2024
58617f5
test_compose
MSCetin37 Oct 25, 2024
381d782
update the test function
MSCetin37 Oct 25, 2024
0ee2c4c
add ui
MSCetin37 Oct 25, 2024
d6b73b2
update the py test file
MSCetin37 Oct 28, 2024
a9959b4
update docsum name to multimedia
MSCetin37 Oct 28, 2024
65ee6ca
update hpu
MSCetin37 Oct 29, 2024
64835a0
gaudi updates
MSCetin37 Nov 1, 2024
d17eb80
update gaudi test
MSCetin37 Nov 1, 2024
6ff021c
updates
MSCetin37 Nov 1, 2024
a39a273
add test files
MSCetin37 Nov 2, 2024
70b2446
gaudi data updates
MSCetin37 Nov 2, 2024
6f46d78
update read me file
MSCetin37 Nov 3, 2024
2d8621a
update read me file
MSCetin37 Nov 3, 2024
2a50c1a
update read me file
MSCetin37 Nov 3, 2024
4418a5f
update read me file
MSCetin37 Nov 3, 2024
eebff1f
update read me file
MSCetin37 Nov 3, 2024
972ca0f
update read me file
MSCetin37 Nov 3, 2024
7e83d71
update read me file
MSCetin37 Nov 3, 2024
70d145b
update read me file
MSCetin37 Nov 3, 2024
e7d6ca0
update read me file
MSCetin37 Nov 3, 2024
e5a4afb
update read me file
MSCetin37 Nov 3, 2024
ea9a9b9
update read me file
MSCetin37 Nov 3, 2024
8422110
update read me file
MSCetin37 Nov 3, 2024
aea5b2d
update read me file
MSCetin37 Nov 3, 2024
9ebc833
update read me file
MSCetin37 Nov 3, 2024
4217473
update read me file
MSCetin37 Nov 3, 2024
e32ad40
update read me file
MSCetin37 Nov 3, 2024
2a885a0
update read me file
MSCetin37 Nov 3, 2024
ee19652
update read me file
MSCetin37 Nov 3, 2024
c37aaa9
update read me file
MSCetin37 Nov 3, 2024
3d006be
update read me file
MSCetin37 Nov 3, 2024
cf5351a
update read me file
MSCetin37 Nov 3, 2024
f940e2b
update read me file
MSCetin37 Nov 3, 2024
5e887cd
update read me file
MSCetin37 Nov 3, 2024
7b7d71a
update read me file
MSCetin37 Nov 3, 2024
28c9e4a
update read me file
MSCetin37 Nov 3, 2024
6ad2149
update read me file
MSCetin37 Nov 3, 2024
be8f7da
update read me file
MSCetin37 Nov 3, 2024
6ff1d00
updates
MSCetin37 Nov 3, 2024
a0334b5
ui updates
MSCetin37 Nov 4, 2024
63f4ba2
UI updates
MSCetin37 Nov 6, 2024
12b3d81
update readme files
MSCetin37 Nov 6, 2024
70d0e89
update readme files
MSCetin37 Nov 6, 2024
40b6000
updates
MSCetin37 Nov 7, 2024
a0db1a5
updates
MSCetin37 Nov 7, 2024
901d269
updates
MSCetin37 Nov 7, 2024
097fbca
updates
MSCetin37 Nov 7, 2024
846e63f
updates
MSCetin37 Nov 7, 2024
bb27363
update the readme file
MSCetin37 Nov 7, 2024
45acc71
update readme file
MSCetin37 Nov 7, 2024
e7619df
removing unused files
MSCetin37 Nov 7, 2024
2d6302d
Added requirement
HarshaRamayanam Nov 7, 2024
a96080a
Merge branch 'docsum_gradio' into docsum
HarshaRamayanam Nov 7, 2024
d77ccf7
Added test for frontend ui gradio
HarshaRamayanam Nov 7, 2024
a903c2c
Merge branch 'docsum_gradio' into docsum
HarshaRamayanam Nov 7, 2024
a4bb851
removing gradio test
MSCetin37 Nov 7, 2024
39be34b
update readme files
MSCetin37 Nov 7, 2024
107f55d
readme updates
MSCetin37 Nov 7, 2024
7bd9524
merge and sync
MSCetin37 Nov 7, 2024
ce4c389
merge and sync
MSCetin37 Nov 7, 2024
e8b7e60
update test_manifest_on_xeon
MSCetin37 Nov 8, 2024
cf8c602
update docker
MSCetin37 Nov 8, 2024
c0d42eb
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 8, 2024
e75b897
Merge branch 'main' into docsum
MSCetin37 Nov 8, 2024
8eb84b7
update image build test
MSCetin37 Nov 9, 2024
79bba64
update image build test
MSCetin37 Nov 9, 2024
5a34cec
update image build test
MSCetin37 Nov 9, 2024
3762cbc
update the test files
MSCetin37 Nov 9, 2024
234e557
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 9, 2024
c2a00de
update tests
MSCetin37 Nov 11, 2024
e7fbc51
merge & snyc
MSCetin37 Nov 13, 2024
e6baf1d
update test compose files
MSCetin37 Nov 13, 2024
d7ee7a4
Merge branch 'main' into docsum
MSCetin37 Nov 13, 2024
30adb97
update test compose files
MSCetin37 Nov 13, 2024
c7e8d9d
update test files
MSCetin37 Nov 13, 2024
f9d0740
merge & sync
MSCetin37 Nov 13, 2024
e006c13
update the test file
MSCetin37 Nov 13, 2024
a0e579d
update the readme files
MSCetin37 Nov 13, 2024
dc81145
update test files
MSCetin37 Nov 13, 2024
a4ace12
update test files
MSCetin37 Nov 13, 2024
2fd420a
update test files
MSCetin37 Nov 13, 2024
e89bed1
update test files
MSCetin37 Nov 13, 2024
c952a57
update test files
MSCetin37 Nov 13, 2024
4ae2077
update test files
MSCetin37 Nov 13, 2024
a7c64e8
update test files
MSCetin37 Nov 13, 2024
0db430f
update test f compose file
MSCetin37 Nov 13, 2024
3c4618b
update test f compose file
MSCetin37 Nov 13, 2024
bf18378
update test and compose file
MSCetin37 Nov 13, 2024
c0b192c
update test and compose file
MSCetin37 Nov 13, 2024
1135d44
update test and compose file
MSCetin37 Nov 13, 2024
6e5dc73
update test and compose file
MSCetin37 Nov 13, 2024
8a284d1
update test and compose file
MSCetin37 Nov 13, 2024
e00e7a9
update test and compose file
MSCetin37 Nov 13, 2024
6a77ac7
update test and compose file
MSCetin37 Nov 13, 2024
29ba8c3
update test and compose file
MSCetin37 Nov 13, 2024
6217f66
update test and compose file
MSCetin37 Nov 14, 2024
0dc8121
update test and compose file
MSCetin37 Nov 14, 2024
b5e786d
update test and compose file
MSCetin37 Nov 14, 2024
fcdfd82
Merge branch 'main' into docsum
MSCetin37 Nov 14, 2024
d5bffe2
update test and compose file
MSCetin37 Nov 14, 2024
1d67ab0
update test and compose file
MSCetin37 Nov 14, 2024
51b3d07
update test and compose file
MSCetin37 Nov 14, 2024
8fa91a5
update test and compose file
MSCetin37 Nov 14, 2024
eda4598
update test and compose file
MSCetin37 Nov 14, 2024
630b5bf
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 14, 2024
ddb1868
update test compose_on_gaudi
MSCetin37 Nov 14, 2024
264f383
update gaudi test
MSCetin37 Nov 14, 2024
3be5b78
update the tests
MSCetin37 Nov 14, 2024
f9ed21b
test manifest
MSCetin37 Nov 14, 2024
95a35c7
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 14, 2024
65e51cc
Merge branch 'main' into docsum
MSCetin37 Nov 14, 2024
160f824
update test xeon
MSCetin37 Nov 14, 2024
5740812
update test xeon
MSCetin37 Nov 14, 2024
2f0db1c
update the xeon test
MSCetin37 Nov 14, 2024
3f2284b
update test compose files
MSCetin37 Nov 14, 2024
34bdff6
update test compose files
MSCetin37 Nov 14, 2024
5eb16af
update test compose files
MSCetin37 Nov 14, 2024
052ad53
update test compose files
MSCetin37 Nov 14, 2024
11acdc9
update test compose files
MSCetin37 Nov 14, 2024
cb9c390
update test compose files
MSCetin37 Nov 14, 2024
fc3184c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 14, 2024
84141db
update gaudi test
MSCetin37 Nov 14, 2024
374b483
update gaudi test
MSCetin37 Nov 14, 2024
a66ab87
update gateway test
MSCetin37 Nov 15, 2024
6d12d05
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 15, 2024
75f0654
Merge branch 'main' into docsum
MSCetin37 Nov 15, 2024
4dcbdac
Merge branch 'main' into docsum
XinyaoWa Nov 15, 2024
20f8480
update the test and readme
MSCetin37 Nov 15, 2024
9628412
minor updates
MSCetin37 Nov 15, 2024
1f578e2
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 15, 2024
0279516
Merge branch 'main' into docsum
ashahba Nov 15, 2024
4c9394c
update readme files
MSCetin37 Nov 15, 2024
6a54288
adding UT for frontend
MSCetin37 Nov 15, 2024
d26c77f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 15, 2024
6663f9b
Merge branch 'main' into docsum
MSCetin37 Nov 15, 2024
3a0b5bc
removing UT for frontend
MSCetin37 Nov 15, 2024
df1860e
removing UT for frontend
MSCetin37 Nov 15, 2024
a22439c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 15, 2024
f6decd1
Merge branch 'main' into docsum
MSCetin37 Nov 15, 2024
750ea9c
removing UT for frontend
MSCetin37 Nov 15, 2024
4389874
Merge branch 'main' into docsum
MSCetin37 Nov 15, 2024
e9939d1
update the service names
MSCetin37 Nov 15, 2024
cd620bb
update the readme
MSCetin37 Nov 15, 2024
c1f41c5
readme updates
MSCetin37 Nov 15, 2024
4448175
readme updates
MSCetin37 Nov 15, 2024
bd7da2d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 15, 2024
9eb5a26
readme updates
MSCetin37 Nov 15, 2024
a6c9c2b
readme updates
MSCetin37 Nov 16, 2024
5e87348
readme updates
MSCetin37 Nov 16, 2024
46dc312
update build.yaml
MSCetin37 Nov 16, 2024
3ca23cb
Merge branch 'main' into docsum
chensuyue Nov 17, 2024
1e99f0f
update build.yaml
MSCetin37 Nov 17, 2024
45acb0a
update test manifest
MSCetin37 Nov 17, 2024
282c84e
update test manifest
MSCetin37 Nov 17, 2024
dd019a4
Merge branch 'main' into docsum
MSCetin37 Nov 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions DocSum/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

Expand Down Expand Up @@ -30,3 +28,4 @@ USER user
WORKDIR /home/user

ENTRYPOINT ["python", "docsum.py"]

72 changes: 27 additions & 45 deletions DocSum/README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,23 @@
# Document Summarization Application

Large Language Models (LLMs) have revolutionized the way we interact with text. These models can be used to create summaries of news articles, research papers, technical documents, legal documents and other types of text. Suppose you have a set of documents (PDFs, Notion pages, customer questions, etc.) and you want to summarize the content. In this example use case, we utilize LangChain to implement summarization strategies and facilitate LLM inference using Text Generation Inference.

The architecture for document summarization will be illustrated/described below:
Large Language Models (LLMs) have revolutionized the way we interact with text. These models can be used to create summaries of news articles, research papers, technical documents, legal documents, multimedia documents, and other types of documents. Suppose you have a set of documents (PDFs, Notion pages, customer questions, multimedia files, etc.) and you want to summarize the content. In this example use case, we utilize LangChain to implement summarization strategies and facilitate LLM inference using Text Generation Inference.

![Architecture](./assets/img/docsum_architecture.png)

![Workflow](./assets/img/docsum_workflow.png)

## Deploy Document Summarization Service

The Document Summarization service can be effortlessly deployed on either Intel Gaudi2 or Intel Xeon Scalable Processors.
Based on whether you want to use Docker or Kubernetes, follow the instructions below.

Currently we support two ways of deploying Document Summarization services with docker compose:

1. Start services using the docker image on `docker hub`:

```bash
docker pull opea/docsum:latest
```

2. Start services using the docker images `built from source`: [Guide](https://github.com/opea-project/GenAIExamples/tree/main/DocSum/docker_compose)
Based on whether you want to use Docker or Kubernetes, follow the instructions below. Currently we support deploying Document Summarization services with docker compose.

### Required Models

We set default model as "Intel/neural-chat-7b-v3-3", change "LLM_MODEL_ID" in "docker_compose/set_env.sh" if you want to use other models.
Default model is "Intel/neural-chat-7b-v3-3". Change "LLM_MODEL_ID" environment variable in commands below if you want to use another model.

```
```bash
export LLM_MODEL_ID="Intel/neural-chat-7b-v3-3"
```

If use gated models, you also need to provide [huggingface token](https://huggingface.co/docs/hub/security-tokens) to "HUGGINGFACEHUB_API_TOKEN" environment variable.
When using gated models, you also need to provide [HuggingFace token](https://huggingface.co/docs/hub/security-tokens) to "HUGGINGFACEHUB_API_TOKEN" environment variable.

### Setup Environment Variable

Expand All @@ -57,32 +43,34 @@ To set up environment variables for deploying Document Summarization services, f
3. Set up other environment variables:

```bash
source ./docker_compose/set_env.sh
source GenAIExamples/DocSum/docker_compose/set_env.sh
```

### Deploy using Docker

#### Deploy on Gaudi

Find the corresponding [compose.yaml](./docker_compose/intel/hpu/gaudi/compose.yaml).
Follow the instructions provided in the [Gaudi Guide](./docker_compose/intel/hpu/gaudi/README.md) to build Docker images from source. Once the images are built, run the following command to start the services:

```bash
cd GenAIExamples/DocSum/docker_compose/intel/hpu/gaudi/
docker compose -f compose.yaml up -d
```

Refer to the [Gaudi Guide](./docker_compose/intel/hpu/gaudi/README.md) to build docker images from source.
Find the corresponding [compose.yaml](./docker_compose/intel/hpu/gaudi/compose.yaml).

> Notice: Currently only the **Habana Driver 1.16.x** is supported for Gaudi.

#### Deploy on Xeon

Find the corresponding [compose.yaml](./docker_compose/intel/cpu/xeon/compose.yaml).
Follow the instructions provided in the [Xeon Guide](./docker_compose/intel/cpu/xeon/README.md) to build Docker images from source. Once the images are built, run the following command to start the services:

```bash
cd GenAIExamples/DocSum/docker_compose/intel/cpu/xeon/
docker compose up -d
docker compose -f compose.yaml up -d
```

Refer to the [Xeon Guide](./docker_compose/intel/cpu/xeon/README.md) for more instructions on building docker images from source.
Find the corresponding [compose.yaml](./docker_compose/intel/cpu/xeon/compose.yaml).

### Deploy using Kubernetes with GMC

Expand Down Expand Up @@ -120,9 +108,12 @@ flowchart LR
classDef invisible fill:transparent,stroke:transparent;
style DocSum-MegaService stroke:#000000



%% Subgraphs %%
subgraph DocSum-MegaService["DocSum MegaService "]
direction LR
M2T([Multimedia2text MicroService]):::blue
LLM([LLM MicroService]):::blue
end
subgraph UserInterface[" User Interface "]
Expand All @@ -132,20 +123,24 @@ flowchart LR
end


LLM_gen{{LLM Service <br>}}
A2T_SRV{{Audio2Text service<br>}}
V2A_SRV{{Video2Audio service<br>}}
WSP_SRV{{whisper service<br>}}
GW([DocSum GateWay<br>]):::orange


%% Questions interaction
direction LR
a[User Input Query] --> UI
a[User Document for Summarization] --> UI
UI --> GW
GW <==> DocSum-MegaService

M2T ==> LLM

%% Embedding service flow
direction LR
LLM <-.-> LLM_gen
M2T .-> V2A_SRV
M2T <-.-> A2T_SRV <-.-> WSP_SRV
V2A_SRV .-> A2T_SRV

```

Expand All @@ -156,21 +151,9 @@ Two ways of consuming Document Summarization Service:
1. Use cURL command on terminal

```bash
#Use English mode (default).
curl http://${host_ip}:8888/v1/docsum \
-H "Content-Type: multipart/form-data" \
-F "messages=Text Embeddings Inference (TEI) is a toolkit for deploying and serving open source text embeddings and sequence classification models. TEI enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE and E5." \
-F "max_tokens=32" \
-F "language=en" \
-F "stream=true"

#Use Chinese mode.
curl http://${host_ip}:8888/v1/docsum \
-H "Content-Type: multipart/form-data" \
-F "messages=2024年9月26日,北京——今日,英特尔正式发布英特尔® 至强® 6性能核处理器(代号Granite Rapids),为AI、数据分析、科学计算等计算密集型业务提供卓越性能。" \
-F "max_tokens=32" \
-F "language=zh" \
-F "stream=true"
curl -X POST http://${host_ip}:8888/v1/docsum \
-H "Content-Type: application/json" \
-d '{"type": "text", "messages": "Text Embeddings Inference (TEI) is a toolkit for deploying and serving open source text embeddings and sequence classification models. TEI enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE and E5."}'
MSCetin37 marked this conversation as resolved.
Show resolved Hide resolved
```

2. Access via frontend
Expand All @@ -184,7 +167,6 @@ Two ways of consuming Document Summarization Service:
1. If you get errors like "Access Denied", [validate micro service](https://github.com/opea-project/GenAIExamples/tree/main/DocSum/docker_compose/intel/cpu/xeon/README.md#validate-microservices) first. A simple example:

```bash
http_proxy=""
curl http://${host_ip}:8008/generate \
-X POST \
-d '{"inputs":"What is Deep Learning?","parameters":{"max_tokens":17, "do_sample": true}}' \
Expand Down
Binary file removed DocSum/assets/img/docSum_ui_exchange.png
Binary file not shown.
Binary file removed DocSum/assets/img/docSum_ui_response.png
Binary file not shown.
Binary file modified DocSum/assets/img/docSum_ui_text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed DocSum/assets/img/docSum_ui_upload.png
Binary file not shown.
Binary file removed DocSum/assets/img/docsum-ui-react-error.png
Binary file not shown.
Binary file removed DocSum/assets/img/docsum-ui-react-file.png
Binary file not shown.
Binary file removed DocSum/assets/img/docsum-ui-react.png
Binary file not shown.
Binary file removed DocSum/assets/img/docsum_workflow.png
Binary file not shown.
Loading
Loading