Skip to content

Commit

Permalink
Merge branch 'tylertitsworth-main'
Browse files Browse the repository at this point in the history
  • Loading branch information
lvliang-intel committed Mar 27, 2024
2 parents 6c00ee5 + 6b72d3b commit b33fea6
Show file tree
Hide file tree
Showing 14 changed files with 137 additions and 124 deletions.
14 changes: 4 additions & 10 deletions ChatQnA/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,28 +51,22 @@ export TGI_LLM_ENDPOINT="http://xxx.xxx.xxx.xxx:8080"

## Launch Redis
```bash
docker pull redis/redis-stack:latest
docker compose -f langchain/docker/docker-compose-redis.yml up -d
```

## Launch LangChain Docker

### Build LangChain Docker Image

```bash
cd langchain/docker/
bash ./build_docker.sh
```

### Lanuch LangChain Docker

Update the `HUGGINGFACEHUB_API_TOKEN` environment variable with your huggingface token in the `docker-compose-langchain.yml`

```bash
cd langchain/docker
docker compose -f docker-compose-langchain.yml up -d
cd ../../
```

> [!NOTE]
> If you modified any files and want that change introduced in this step, add `--build` to the end of the command to build the container image instead of pulling it from dockerhub.
## Ingest data into redis

After every time of redis container is launched, data should be ingested in the container ingestion steps:
Expand Down
55 changes: 21 additions & 34 deletions ChatQnA/langchain/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM langchain/langchain

ARG http_proxy
ARG https_proxy
ENV http_proxy=$http_proxy
ENV https_proxy=$https_proxy

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
libgl1-mesa-glx \
libjemalloc-dev

RUN pip install --upgrade pip \
sentence-transformers \
redis \
unstructured \
unstructured[all-docs] \
langchain-cli \
pydantic==1.10.13 \
langchain==0.1.12 \
poetry \
pymupdf \
easyocr \
langchain_benchmarks \
pyarrow \
jupyter \
intel-extension-for-pytorch \
intel-openmp

ENV PYTHONPATH=/ws:/qna-app/app

COPY qna-app /qna-app
WORKDIR /qna-app
FROM langchain/langchain:latest

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
libgl1-mesa-glx \
libjemalloc-dev

RUN useradd -m -s /bin/bash user && \
mkdir -p /home/user && \
chown -R user /home/user/

USER user

COPY requirements.txt /tmp/requirements.txt

RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /tmp/requirements.txt

ENV PYTHONPATH=/home/user:/home/user/qna-app/app

WORKDIR /home/user/qna-app
COPY qna-app /home/user/qna-app

ENTRYPOINT ["/usr/bin/sleep", "infinity"]
17 changes: 0 additions & 17 deletions ChatQnA/langchain/docker/build_docker.sh

This file was deleted.

9 changes: 8 additions & 1 deletion ChatQnA/langchain/docker/docker-compose-langchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@
version: '3'
services:
qna-rag-redis-server:
image: qna-rag-redis:latest
build:
args:
http_proxy: ${http_proxy}
https_proxy: ${https_proxy}
dockerfile: Dockerfile
image: intel/gen-ai-examples:qna-rag-redis-server
container_name: qna-rag-redis-server
environment:
- http_proxy=${http_proxy}
- https_proxy=${https_proxy}
- "REDIS_PORT=6379"
- "EMBED_MODEL=BAAI/bge-base-en-v1.5"
- "REDIS_SCHEMA=schema_dim_768.yml"
Expand Down
16 changes: 16 additions & 0 deletions ChatQnA/langchain/docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
cryptography==42.0.4
easyocr
intel-extension-for-pytorch
intel-openmp
jupyter
langchain_benchmarks
langchain-cli
langchain==0.1.12
poetry
pyarrow
pydantic==1.10.13
pymupdf
redis
sentence-transformers
unstructured
unstructured[all-docs]
7 changes: 3 additions & 4 deletions CodeGen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ docker pull ghcr.io/huggingface/tgi-gaudi:1.2.1
Alternatively, you can build the Docker image yourself with:

```bash
bash ./serving/tgi_gaudi/build_docker.sh
bash ./tgi_gaudi/build_docker.sh
```

## Launch TGI Gaudi Service
Expand Down Expand Up @@ -43,7 +43,7 @@ export TGI_ENDPOINT="xxx.xxx.xxx.xxx:8080"

## Launch Copilot Docker

### Build Copilot Docker Image
### Build Copilot Docker Image (Optional)

```bash
cd codegen
Expand All @@ -54,10 +54,9 @@ cd ..
### Lanuch Copilot Docker

```bash
docker run -it --net=host --ipc=host -v /var/run/docker.sock:/var/run/docker.sock copilot:latest
docker run -it -e http_proxy=${http_proxy} -e https_proxy=${https_proxy} --net=host --ipc=host -v /var/run/docker.sock:/var/run/docker.sock intel/gen-ai-examples:copilot bash
```


# Start Copilot Server

## Start the Backend Service
Expand Down
33 changes: 22 additions & 11 deletions CodeGen/codegen/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM langchain/langchain
RUN apt-get update && apt-get -y install libgl1-mesa-glx
RUN pip install -U langchain-cli pydantic==1.10.13
RUN pip install langchain==0.1.11
RUN pip install shortuuid
RUN pip install huggingface_hub
RUN mkdir -p /ws
ENV PYTHONPATH=/ws
COPY codegen-app /codegen-app
WORKDIR /codegen-app
CMD ["/bin/bash"]
FROM langchain/langchain:latest

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
libgl1-mesa-glx \
libjemalloc-dev

RUN useradd -m -s /bin/bash user && \
mkdir -p /home/user && \
chown -R user /home/user/

USER user

COPY requirements.txt /tmp/requirements.txt

RUN pip install --no-cache-dir -U -r /tmp/requirements.txt

ENV PYTHONPATH=/home/user:/home/user/codegen-app

WORKDIR /home/user/codegen-app
COPY codegen-app /home/user/codegen-app

SHELL ["/bin/bash", "-c"]
5 changes: 5 additions & 0 deletions CodeGen/codegen/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
huggingface_hub
langchain-cli
langchain==0.1.11
pydantic==1.10.13
shortuuid
4 changes: 2 additions & 2 deletions DocSum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export TGI_ENDPOINT="http://xxx.xxx.xxx.xxx:8080"

## Launch Document Summary Docker

### Build Document Summary Docker Image
### Build Document Summary Docker Image (Optional)

```bash
cd langchain/docker/
Expand All @@ -53,7 +53,7 @@ cd ../../
### Lanuch Document Summary Docker

```bash
docker run -it --net=host --ipc=host -v /var/run/docker.sock:/var/run/docker.sock document-summarize:latest
docker run -it --net=host --ipc=host -e http_proxy=${http_proxy} -e https_proxy=${https_proxy} -v /var/run/docker.sock:/var/run/docker.sock intel/gen-ai-examples:document-summarize bash
```


Expand Down
56 changes: 21 additions & 35 deletions DocSum/langchain/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,24 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM langchain/langchain

ARG http_proxy
ARG https_proxy
ENV http_proxy=$http_proxy
ENV https_proxy=$https_proxy

RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
libgl1-mesa-glx \
libjemalloc-dev

RUN pip install --upgrade pip \
sentence-transformers \
langchain-cli \
pydantic==1.10.13 \
langchain==0.1.12 \
poetry \
langchain_benchmarks \
pyarrow \
jupyter \
docx2txt \
pypdf \
beautifulsoup4 \
python-multipart \
intel-extension-for-pytorch \
intel-openmp

ENV PYTHONPATH=/ws:/summarize-app/app

COPY summarize-app /summarize-app
WORKDIR /summarize-app

CMD ["/bin/bash"]
FROM langchain/langchain:latest

RUN apt-get update -y && apt-get install -y --no-install-recommends --fix-missing \
libgl1-mesa-glx \
libjemalloc-dev

RUN useradd -m -s /bin/bash user && \
mkdir -p /home/user && \
chown -R user /home/user/

USER user

COPY requirements.txt /tmp/requirements.txt

RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /tmp/requirements.txt

ENV PYTHONPATH=/home/user:/home/user/summarize-app/app

WORKDIR /home/user/summarize-app
COPY summarize-app /home/user/summarize-app
14 changes: 14 additions & 0 deletions DocSum/langchain/docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
beautifulsoup4
docx2txt
intel-extension-for-pytorch
intel-openmp
jupyter
langchain_benchmarks
langchain-cli
langchain==0.1.12
poetry
pyarrow
pydantic==1.10.13
pypdf
python-multipart
sentence-transformers
4 changes: 2 additions & 2 deletions VisualQnA/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ This example guides you through how to deploy a [LLaVA](https://llava-vl.github.

```
cd serving/
docker build . --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${http_proxy} -t llava_gaudi:latest
docker build . --build-arg http_proxy=${http_proxy} --build-arg https_proxy=${http_proxy} -t intel/gen-ai-examples:llava-gaudi
```

2. Start the LLaVA service on Intel Gaudi2

```
docker run -d -p 8084:80 -p 8085:8000 -v ./data:/root/.cache/huggingface/hub/ -e http_proxy=$http_proxy -e https_proxy=$http_proxy -v $PWD/llava_server:/llava_server --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host llava_gaudi
docker run -d -p 8084:80 -p 8085:8000 -v ./data:/root/.cache/huggingface/hub/ -e http_proxy=$http_proxy -e https_proxy=$http_proxy -v $PWD/llava_server:/llava_server --runtime=habana -e HABANA_VISIBLE_DEVICES=all -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host intel/gen-ai-examples:llava-gaudi
```

Here are some explanation about the above parameters:
Expand Down
23 changes: 15 additions & 8 deletions VisualQnA/serving/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,29 @@
# limitations under the License.

# HABANA environment
FROM vault.habana.ai/gaudi-docker/1.14.0/ubuntu22.04/habanalabs/pytorch-installer-2.1.1 as hpu
FROM vault.habana.ai/gaudi-docker/1.14.0/ubuntu22.04/habanalabs/pytorch-installer-2.1.1 AS hpu
RUN rm -rf /etc/ssh/ssh_host*

# Set environment variables
ENV LANG=en_US.UTF-8
ENV PYTHONPATH=/root:/usr/lib/habanalabs/:/optimum-habana
ENV PYTHONPATH=/home/user:/usr/lib/habanalabs/:/optimum-habana

# Install required branch
RUN git clone https://github.com/lkk12014402/optimum-habana.git && \
cd optimum-habana && \
git checkout enable_llava_generation
RUN git clone https://github.com/lkk12014402/optimum-habana.git /optimum-habana -b enable_llava_generation

RUN useradd -m -s /bin/bash user && \
mkdir -p /home/user && \
chown -R user /home/user/

USER user

COPY requirements.txt /tmp/requirements.txt

# Install dependency
RUN pip install --upgrade-strategy eager optimum[habana] && \
pip install fastapi uvicorn
RUN pip install --no-cache-dir -U -r /tmp/requirements.txt

# work dir should contains the server
WORKDIR /llava_server
COPY llava_server /llava_server

ENTRYPOINT ["python", "llava_server.py"]
ENTRYPOINT ["python", "llava_server.py"]
4 changes: 4 additions & 0 deletions VisualQnA/serving/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eager
fastapi
optimum[habana]
uvicorn

0 comments on commit b33fea6

Please sign in to comment.