Skip to content

Commit 5ffbfa6

Browse files
authored
Merge pull request #79 from intel/update-branch
feat: fix dependencies and update run command (#242)
2 parents 64f84ce + a3d968b commit 5ffbfa6

File tree

9 files changed

+441
-158
lines changed

9 files changed

+441
-158
lines changed

usecases/ai/rag-toolkit/Dockerfile

Lines changed: 0 additions & 37 deletions
This file was deleted.

usecases/ai/rag-toolkit/README.md

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -19,59 +19,59 @@ Please ensure that you have these ports available before running the application
1919
| Serving | 8012 |
2020

2121
## Quick Start
22-
### Prerequisite
23-
If you are using this bundle without any finetuned model, you **must** follow the steps below before running the setup.
24-
2522
### 1. Install operating system
2623
Install the latest [Ubuntu* 22.04 LTS Desktop](https://releases.ubuntu.com/jammy/). Refer to [Ubuntu Desktop installation tutorial](https://ubuntu.com/tutorials/install-ubuntu-desktop#1-overview) if needed.
2724

25+
### 2. Install GPU driver (Optional)
26+
If you plan to use GPU to perform inference, please install the GPU driver according to your GPU version.
27+
* Intel® Arc™ A-Series Graphics: [link](https://github.com/intel/edge-developer-kit-reference-scripts/tree/main/gpu/arc/dg2)
28+
* Intel® Data Center GPU Flex Series: [link](https://github.com/intel/edge-developer-kit-reference-scripts/tree/main/gpu/flex/ats)
29+
30+
### 3. Setup docker
31+
Refer to [here](https://docs.docker.com/engine/install/) to setup docker and docker compose.
32+
2833
<a name="hf-token-anchor"></a>
29-
### 2. Create a Hugging Face account and generate an access token. For more information, please refer to [link](https://huggingface.co/docs/hub/en/security-tokens).
34+
### 4. Create a Hugging Face account and generate an access token. For more information, please refer to [link](https://huggingface.co/docs/hub/en/security-tokens).
3035

3136
<a name="hf-access-anchor"></a>
32-
### 3. Login to your Hugging Face account and browse to [mistralai/Mistral-7B-Instruct-v0.3](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3) and click on the `Agree and access repository` button.
37+
### 5. Login to your Hugging Face account and browse to [mistralai/Mistral-7B-Instruct-v0.3](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3) and click on the `Agree and access repository` button.
3338

34-
### 4. Run the setup script
35-
This step will download all the dependencies needed to run the application.
39+
### 6. Build docker images with with your preference inference backend
40+
This step will download all the necessary files online, please ensure you have a valid network connection.
3641
```bash
37-
./install.sh
42+
# OLLAMA GPU backend
43+
docker compose build --build-arg INSTALL_OPTION=2
44+
45+
# OpenVINO CPU backend (OpenVINO backend required Hugging Face token to be provided to download the model)
46+
docker compose build --build-arg INSTALL_OPTION=1 \
47+
--build-arg HF_TOKEN=<your-huggingface-token>
3848
```
3949

40-
### 5. Start all the services
41-
Run the script to start all the services. During the first time running, the script will download some assets required to run the services, please ensure you have internet connection.
50+
### 7. Start docker container
4251
```bash
43-
./run.sh
52+
docker compose up -d
4453
```
45-
## Docker Setup
46-
### Prerequisite
47-
1. Docker and docker compose should be setup before running the commands below. Refer to [here](https://docs.docker.com/engine/install/) to setup docker.
48-
1. Install necessary GPU drivers.
49-
- Refer to [here](../../../gpu/arc/dg2/README.md) to setup GPU drivers
50-
51-
52-
### 1. Setup env
53-
Set the INSTALL_OPTION in env file.
5454

55-
1 = VLLM (OpenVINO - CPU)
56-
- Please also provide HF_TOKEN if using this option. Refer [here](#hf-token-anchor) to create a token.
57-
- Ensure the hugging face token has access to Mistral 7b instruct v0.3 model. Refer [here](#hf-access-anchor) to get access to model.
58-
59-
2 [default] = OLLAMA (SYCL LLAMA.CPP - CPU/GPU)
55+
## Development
56+
On host installation can be done by following the steps below:
57+
### 1. Run the setup script
58+
This step will download all the dependencies needed to run the application.
6059
```bash
61-
cp .env.template .env
60+
./install.sh
6261
```
6362

64-
### 2. Build docker container
63+
### 2. Start all the services
64+
Run the script to start all the services. During the first time running, the script will download some assets required to run the services, please ensure you have internet connection.
6565
```bash
66-
docker compose build
66+
./run.sh
6767
```
68-
69-
### 3. Start docker container
68+
69+
## FAQ
70+
### Uninstall the app
7071
```bash
71-
docker compose up -d
72+
./uninstall.sh
7273
```
7374

74-
## FAQ
7575
### Utilize NPU in AI PC
7676
The Speech to Text model inference can be offloaded on the NPU device on an AI PC. Edit the `ENCODER_DEVICE` to *NPU* in `backend/config.yaml` to run the encoder model on NPU. *Currently only encoder model is supported to run on NPU device*
7777
```
@@ -82,11 +82,6 @@ STT:
8282
DECODER_DEVICE: CPU
8383
```
8484

85-
### Uninstall the app
86-
```bash
87-
./uninstall.sh
88-
```
89-
9085
### Environmental variables
9186
You can change the port of the backend server api to route to specific OpenAI compatible server running as well as the serving port.
9287
| Environmental variable | Default Value |
@@ -98,6 +93,3 @@ You can change the port of the backend server api to route to specific OpenAI co
9893
## Limitations
9994
1. Current speech-to-text feature only work with localhost.
10095
2. RAG documents will use all the documents that are uploaded.
101-
102-
## Troubleshooting
103-
1. If you have error to run the applications, you can refer to the log files in the logs folder.

usecases/ai/rag-toolkit/backend/requirements.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ numpy==1.26.4
99
openai==1.39.0
1010
pyyaml==6.0.1
1111
pypdf==5.0.0
12-
chromadb==0.5.5
13-
langchain-chroma==0.1.2
14-
langchain==0.3.5
15-
langchain-community==0.3.5
12+
langchain==0.3.7
13+
langchain-chroma==0.1.4
14+
langchain-community===0.3.5
15+
chromadb==0.5.18
1616
huggingface_hub>=0.23.0
1717
botocore==1.34.88
1818
cached_path==1.6.3
@@ -21,4 +21,4 @@ cached_path==1.6.3
2121
torch==2.4.0
2222
torchaudio==2.4.0
2323
openvino==2024.3.0
24-
optimum[openvino,nncf]
24+
optimum[openvino,nncf]
Lines changed: 52 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,63 @@
1-
# Copyright (C) 2024 Intel Corporation
2-
# SPDX-License-Identifier: Apache-2.0
3-
41
services:
52
backend:
63
build:
74
context: .
8-
dockerfile: Dockerfile
5+
dockerfile: ./docker/Dockerfile
96
args:
10-
- INSTALL_OPTION=${INSTALL_OPTION}
11-
- HF_TOKEN=${HF_TOKEN}
12-
image: rag-toolkit.deployment
13-
container_name: rag-toolkit.deployment
7+
- INSTALL_OPTION
8+
- HF_TOKEN
9+
image: edge-ai-development-assistance-tool.deployment
10+
container_name: edge-ai-development-assistance-tool.deployment-backend
1411
privileged: true
1512
ipc: host
1613
network_mode: host
14+
depends_on:
15+
serving:
16+
condition: service_healthy
1717
volumes:
18-
- /home/intel/edge-ui/.next
18+
- app-data:/home/intel/data
1919
devices:
20-
- /dev:/dev:rw
20+
- /dev/dri:/dev/dri:rw
2121
- /lib/modules:/lib/modules:rw
22-
command: './run.sh'
22+
working_dir: /home/intel/backend
23+
healthcheck:
24+
test: ["CMD", "curl", "-f", "http://localhost:8011/healthcheck"]
25+
interval: 30s
26+
timeout: 10s
27+
retries: 5
28+
command: ["/bin/bash", "-c", "source /home/intel/.venv/bin/activate && uvicorn app:app --host localhost --port 8011"]
29+
30+
serving:
31+
image: edge-ai-development-assistance-tool.deployment
32+
container_name: edge-ai-development-assistance-tool.deployment-serving
33+
privileged: true
34+
ipc: host
35+
network_mode: host
36+
volumes:
37+
- app-data:/home/intel/data
38+
devices:
39+
- /dev/dri:/dev/dri:rw
40+
- /lib/modules:/lib/modules:rw
41+
healthcheck:
42+
test: ["CMD", "curl", "-f", "http://localhost:8012/v1/models"]
43+
interval: 30s
44+
timeout: 10s
45+
retries: 5
46+
command: './run-serving.sh'
47+
48+
frontend:
49+
image: edge-ai-development-assistance-tool.deployment
50+
container_name: edge-ai-development-assistance-tool.deployment-frontend
51+
network_mode: host
52+
depends_on:
53+
backend:
54+
condition: service_healthy
55+
volumes:
56+
- /home/intel/edge-ui/.next
57+
working_dir: /home/intel/edge-ui
58+
command: npm run start
59+
60+
volumes:
61+
app-data:
62+
63+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM intel/oneapi-basekit:2024.0.1-devel-ubuntu22.04
2+
3+
USER root
4+
5+
RUN rm /etc/apt/sources.list.d/intel-graphics.list
6+
RUN wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
7+
RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list
8+
RUN apt update && apt upgrade -y && apt install -y sudo software-properties-common pciutils
9+
10+
# Install python 3.11
11+
ARG DEBIAN_FRONTEND=noninteractive
12+
RUN apt update && apt install -y python3.11 python3.11-dev python3.11-venv python3-pip
13+
RUN python3.11 -m pip install --upgrade pip
14+
15+
# Create new user
16+
RUN groupadd -g 110 render
17+
RUN useradd -m intel
18+
RUN usermod -aG sudo intel
19+
RUN usermod -aG render intel
20+
# Set user to have sudo privileges
21+
RUN echo "intel ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
22+
23+
# GPU Driver Installation
24+
RUN wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \
25+
gpg --yes --dearmor --output /usr/share/keyrings/intel-graphics.gpg && \
26+
echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \
27+
tee /etc/apt/sources.list.d/intel-gpu-jammy.list && \
28+
apt update && \
29+
apt-get install -y --no-install-recommends libze1 intel-level-zero-gpu intel-opencl-icd clinfo libze-dev intel-ocloc
30+
31+
USER intel
32+
WORKDIR /home/intel
33+
ENV USER=intel
34+
35+
# Install deps
36+
COPY --chown=intel . .
37+
RUN mv docker/run-serving.sh ./
38+
RUN chown -R intel:intel /home/intel
39+
40+
ARG INSTALL_OPTION=2
41+
ENV INSTALL_OPTION=$INSTALL_OPTION
42+
ARG HF_TOKEN=""
43+
ENV HF_TOKEN=$HF_TOKEN
44+
RUN ./install.sh
45+
# Unset the HF_TOKEN after installation
46+
ENV HF_TOKEN=
47+
48+
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
49+
CMD wget --no-verbose -O /dev/null --tries=1 http://localhost:8011/healthcheck || exit 1

0 commit comments

Comments
 (0)