Skip to content

Commit

Permalink
add dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Wenxin Zhang <[email protected]>
  • Loading branch information
VincyZhang committed May 17, 2024
1 parent 89084f5 commit 8fcd338
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 13 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/docker/hpu.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM vault.habana.ai/gaudi-docker/1.13.0/ubuntu22.04/habanalabs/pytorch-installer-2.1.0:latest as hpu

ENV LANG=en_US.UTF-8
ENV PYTHONPATH=/root:/usr/lib/habanalabs/
ARG REPO=https://github.com/intel/genaieval.git
ARG REPO_PATH=""
ARG BRANCH=main

RUN apt-get update && \
apt-get install git-lfs && \
git-lfs install

# Download code
SHELL ["/bin/bash", "--login", "-c"]
RUN mkdir -p /genaieval
COPY ${REPO_PATH} /genaieval
RUN if [ "$REPO_PATH" == "" ]; then rm -rf /genaieval/* && rm -rf /genaieval/.* ; git clone --single-branch --branch=${BRANCH} ${REPO} /genaieval ; fi

# Build From Source
RUN cd /genaieval && \
python setup.py install && \
pip install --upgrade-strategy eager optimum[habana] && \
pip list

WORKDIR /genaieval/
12 changes: 2 additions & 10 deletions .github/workflows/model_test_hpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,15 @@ jobs:
# We need this because GitHub needs to clone the branch to pipeline
- name: Docker Build
run: |
docker build -f ${{ github.workspace }}/.github/workflows/docker/common.dockerfile --build-arg http_proxy="${{ env.HTTP_PROXY_IMAGE_BUILD }}" --build-arg https_proxy="${{ env.HTTPS_PROXY_IMAGE_BUILD }}" -t ${{ env.DOCKER_NAME }}:${{ env.DOCKER_TAG }} .
docker build --target hpu --build-arg REPO_PATH="." -f ${{ github.workspace }}/Docker/hpu.dockerfile -t ${{ env.DOCKER_NAME }}:${{ env.DOCKER_TAG }} .
- name: Docker Run
run: |
if [[ $(docker ps -a | grep -i '${{ env.CONTAINER_NAME }}'$) ]]; then
docker stop ${{ env.CONTAINER_NAME }}
docker rm -vf ${{ env.CONTAINER_NAME }} || true
fi
docker run -dit --disable-content-trust --privileged --name=${{ env.CONTAINER_NAME }} -v /dev/shm:/dev/shm \
-v ${{ github.workspace }}:/GenAIEval \
-e http_proxy="${{ env.HTTP_PROXY_IMAGE_BUILD }}" -e https_proxy="${{ env.HTTPS_PROXY_IMAGE_BUILD }}" \
${{ env.DOCKER_NAME }}:${{ env.DOCKER_TAG }}
- name: Binary build
run: |
docker exec ${{ env.CONTAINER_NAME }} \
bash -c "cd /GenAIEval && pip install -r requirements.txt && python setup.py install"
docker run -tid --runtime=habana --name=${{ env.CONTAINER_NAME }} -v ${{ github.workspace }}:/GenAIEval -v /dev/shm:/dev/shm ${{ env.DOCKER_NAME }}:${{ env.DOCKER_TAG }}
- name: Evaluation
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scripts/models/generate_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function generate_results {
<th>Tasks</th>
<th>Model</th>
<th>Datasets</th>
<th>VS</th>
<th>Accuracy</th>
</tr>
eof
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/scripts/models/model_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ function prepare() {
else
echo "Not found requirements.txt file."
fi
if [[ ${device} == "hpu" ]]; then
pip install --upgrade-strategy eager optimum[habana]
fi
}

function run_benchmark() {
Expand Down
25 changes: 25 additions & 0 deletions Docker/hpu.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM vault.habana.ai/gaudi-docker/1.13.0/ubuntu22.04/habanalabs/pytorch-installer-2.1.0:latest as hpu

ENV LANG=en_US.UTF-8
ENV PYTHONPATH=/root:/usr/lib/habanalabs/
ARG REPO=https://github.com/opea-project/GenAIEval.git
ARG REPO_PATH=""
ARG BRANCH=main

RUN apt-get update && \
apt-get install git-lfs && \
git-lfs install

# Download code
SHELL ["/bin/bash", "--login", "-c"]
RUN mkdir -p /GenAIEval
COPY ${REPO_PATH} /GenAIEval
RUN if [ "$REPO_PATH" == "" ]; then rm -rf /GenAIEval/* && rm -rf /GenAIEval/.* ; git clone --single-branch --branch=${BRANCH} ${REPO} /GenAIEval ; fi

# Build From Source
RUN cd /GenAIEval && \
python setup.py install && \
pip install --upgrade-strategy eager optimum[habana] && \
pip list

WORKDIR /GenAIEval/

0 comments on commit 8fcd338

Please sign in to comment.