Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
Signed-off-by: letonghan <[email protected]>
  • Loading branch information
letonghan committed Aug 12, 2024
2 parents cc9f09e + 27a01ee commit 2d5647d
Show file tree
Hide file tree
Showing 71 changed files with 594 additions and 393 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
merged_commit=$(git log -1 --format='%H')
changed_files="$(git diff --name-only ${base_commit} ${merged_commit} | \
grep 'comps/' | grep -vE '*.md|*.txt|comps/cores')" || true
grep 'comps/' | grep -vE '*.md|comps/cores')" || true
services=$(printf '%s\n' "${changed_files[@]}" | cut -d'/' -f2 | grep -vE '*.py' | sort -u) || true
run_matrix="{\"include\":["
for service in ${services}; do
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/docker/compose/llms-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: Apache-2.0

# this file should be run in the root of the repo
# images used by GenAIExamples: llm-tgi,llm-ollama,llm-docsum-tgi,llm-faqgen-tgi,llm-vllm,llm-vllm-ray
# images used by GenAIExamples: llm-tgi,llm-ollama,llm-docsum-tgi,llm-faqgen-tgi,llm-vllm,llm-vllm-hpu,llm-vllm-ray,llm-vllm-ray-hpu
services:
llm-tgi:
build:
Expand All @@ -24,7 +24,15 @@ services:
build:
dockerfile: comps/llms/text-generation/vllm/docker/Dockerfile.microservice
image: ${REGISTRY}opea/llm-vllm:${TAG:-latest}
llm-vllm-hpu:
build:
dockerfile: comps/llms/text-generation/vllm/docker/Dockerfile.hpu
image: ${REGISTRY}opea/llm-vllm-hpu:${TAG:-latest}
llm-vllm-ray:
build:
dockerfile: comps/llms/text-generation/vllm-ray/docker/Dockerfile.microservice
image: ${REGISTRY}opea/llm-vllm-ray:${TAG:-latest}
llm-vllm-ray-hpu:
build:
dockerfile: comps/llms/text-generation/vllm-ray/docker/Dockerfile.vllmray
image: ${REGISTRY}opea/llm-vllm-ray-hpu:${TAG:-latest}
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
branches: [main]
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
paths:
- .github/workflows/megaservice-test.yml
- .github/workflows/mix-megaservice-test.yml
- comps/cores/**
- requirements.txt
- setup.py
Expand Down
File renamed without changes.
File renamed without changes.
72 changes: 72 additions & 0 deletions .github/workflows/pr-examples-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

name: Example-test

on:
pull_request_target:
branches: [main]
types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
paths:
- .github/workflows/pr-examples-test.yml
- comps/cores/**
- comps/embeddings/langchain/**
- comps/retrievers/langchain/redis/**
- comps/reranks/tei/**
- comps/llms/text-generation/tgi/**
- comps/dataprep/redis/langchain/**
- requirements.txt

# If there is a new commit, the previous jobs will be canceled
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
example-test:
runs-on: gaudi-01-3
steps:
- name: Clean Up Working Directory
run: |
sudo rm -rf ${{github.workspace}}/* || true
echo y | docker system prune
docker rmi $(docker images --filter reference="*/*:comps" -q) || true
- name: Checkout out Repo
uses: actions/checkout@v4
with:
ref: "refs/pull/${{ github.event.number }}/merge"

- name: Run ChatQnA
env:
HUGGINGFACEHUB_API_TOKEN: ${{ secrets.HUGGINGFACEHUB_API_TOKEN }}
run: |
git clone https://github.com/opea-project/GenAIExamples.git
cd ${{ github.workspace }}/GenAIExamples/ChatQnA/docker/gaudi
sed -i "s#:latest#:comps#g" compose.yaml
cat compose.yaml
cd ${{ github.workspace }}/GenAIExamples/ChatQnA/tests
GenAIComps_dir=${{github.workspace}}
sed -i '/GenAIComps.git/d' test_chatqna_on_gaudi.sh
sed -i "s#cd GenAIComps#cd ${GenAIComps_dir}#g" test_chatqna_on_gaudi.sh
sed -i "s#docker build -t#docker build --no-cache -q -t#g" test_chatqna_on_gaudi.sh
sed -i "s#:latest#:comps#g" test_chatqna_on_gaudi.sh
cat test_chatqna_on_gaudi.sh
echo "Run test..."
timeout 50m bash test_chatqna_on_gaudi.sh
- name: Clean up container
if: cancelled() || failure()
run: |
cd ${{ github.workspace }}/GenAIExamples/ChatQnA/docker/gaudi
docker compose stop && docker compose rm -f
docker system prune -f
- name: Publish pipeline artifact
if: ${{ !cancelled() }}
uses: actions/upload-artifact@v4
with:
name: "Examples-Test-Logs"
path: ${{ github.workspace }}/GenAIExamples/ChatQnA/tests/*.log
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ on:
- comps/**
- tests/**
- "!**.md"
- "!**.txt"
- .github/workflows/microservice-test.yml
- .github/workflows/pr-microservice-test.yml

# If there is a new commit, the previous jobs will be canceled
concurrency:
Expand All @@ -21,7 +20,7 @@ concurrency:

jobs:
job1:
uses: ./.github/workflows/reuse-get-test-matrix.yml
uses: ./.github/workflows/_get-test-matrix.yml

Microservice-test:
needs: job1
Expand All @@ -31,7 +30,9 @@ jobs:
continue-on-error: true
steps:
- name: Clean Up Working Directory
run: sudo rm -rf ${{github.workspace}}/*
run: |
sudo rm -rf ${{github.workspace}}/*
docker system prune -f
- name: Checkout out Repo
uses: actions/checkout@v4
Expand All @@ -43,6 +44,7 @@ jobs:
HF_TOKEN: ${{ secrets.HF_TOKEN }}
GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GOOGLE_CSE_ID: ${{ secrets.GOOGLE_CSE_ID }}
PINECONE_KEY: ${{ secrets.PINECONE_KEY }}
service_path: ${{ matrix.service }}
hardware: ${{ matrix.hardware }}
run: |
Expand All @@ -56,7 +58,7 @@ jobs:
run: |
cid=$(docker ps -aq --filter "name=test-comps-*")
if [[ ! -z "$cid" ]]; then docker stop $cid && docker rm $cid && sleep 1s; fi
echo y | docker system prune --all
docker system prune -f
- name: Publish pipeline artifact
if: ${{ !cancelled() }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- comps/**
- "!**.md"
- "!**.txt"
- .github/workflows/image-build-on-push.yml
- .github/workflows/push-image-build.yml

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-on-push
Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/reuse-image-build.yml

This file was deleted.

File renamed without changes.
77 changes: 0 additions & 77 deletions .github/workflows/scripts/docker_images_build_push.sh

This file was deleted.

1 change: 1 addition & 0 deletions comps/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
SearchQnAGateway,
AudioQnAGateway,
FaqGenGateway,
VisualQnAGateway,
)

# Telemetry
Expand Down
13 changes: 9 additions & 4 deletions comps/asr/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@

FROM python:3.11-slim

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

ENV LANG=C.UTF-8

COPY comps /home/comps
COPY comps /home/user/comps

RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /home/comps/asr/requirements.txt
pip install --no-cache-dir -r /home/user/comps/asr/requirements.txt

ENV PYTHONPATH=$PYTHONPATH:/home
ENV PYTHONPATH=$PYTHONPATH:/home/user

WORKDIR /home/comps/asr
WORKDIR /home/user/comps/asr

ENTRYPOINT ["python", "asr.py"]
17 changes: 12 additions & 5 deletions comps/asr/whisper/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,28 @@

FROM python:3.11-slim


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

# Set environment variables
ENV LANG=en_US.UTF-8
ENV PYTHONPATH=/home/user

# Install system dependencies
RUN apt-get update \
&& apt-get install -y ffmpeg

COPY comps /home/comps
COPY --chown=user:user comps /home/user/comps

USER user

RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /home/comps/asr/requirements.txt
pip install --no-cache-dir -r /home/user/comps/asr/requirements.txt && \
pip list

ENV PYTHONPATH=$PYTHONPATH:/home
ENV PYTHONPATH=$PYTHONPATH:/home/user

WORKDIR /home/comps/asr/whisper
WORKDIR /home/user/comps/asr/whisper

ENTRYPOINT ["python", "whisper_server.py", "--device", "cpu"]
14 changes: 10 additions & 4 deletions comps/asr/whisper/Dockerfile_hpu
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
# HABANA environment
FROM vault.habana.ai/gaudi-docker/1.16.1/ubuntu22.04/habanalabs/pytorch-installer-2.2.2:latest AS hpu

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

# Set environment variables
ENV LANG=en_US.UTF-8
ENV PYTHONPATH=/home/user:/usr/lib/habanalabs/:/optimum-habana
Expand All @@ -12,15 +16,17 @@ ENV PYTHONPATH=/home/user:/usr/lib/habanalabs/:/optimum-habana
RUN apt-get update \
&& apt-get install -y ffmpeg

COPY comps /home/comps
COPY --chown=user:user comps /home/user/comps

USER user

# Install requirements and optimum habana
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir -r /home/comps/asr/requirements.txt && \
pip install --no-cache-dir -r /home/user/comps/asr/requirements.txt && \
pip install optimum[habana]

ENV PYTHONPATH=$PYTHONPATH:/home
ENV PYTHONPATH=$PYTHONPATH:/home/user

WORKDIR /home/comps/asr/whisper
WORKDIR /home/user/comps/asr/whisper

ENTRYPOINT ["python", "whisper_server.py", "--device", "hpu"]
Loading

0 comments on commit 2d5647d

Please sign in to comment.