Skip to content

Commit

Permalink
add docker for code-generation (#444)
Browse files Browse the repository at this point in the history
Signed-off-by: changwangss <chang1.wang@intel.com>
Signed-off-by: Wenxin Zhang <wenxin.zhang@intel.com>
Co-authored-by: Wenxin Zhang <wenxin.zhang@intel.com>
  • Loading branch information
changwangss and VincyZhang committed Oct 12, 2023
1 parent 01a809d commit dd38290
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 4 deletions.
68 changes: 68 additions & 0 deletions docker/Dockerfile_code_gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Copyright (C) 2023 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause

ARG IMAGE_NAME=ubuntu
ARG IMAGE_TAG=22.04
FROM ${IMAGE_NAME}:${IMAGE_TAG} as base

FROM base as itrex-base

ARG PYTHON=python3.10

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
libgl1-mesa-glx \
libglib2.0-0 \
${PYTHON} \
python3-pip && \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

RUN ln -sf $(which ${PYTHON}) /usr/bin/python

RUN ${PYTHON} -m pip install -U pip

FROM itrex-base as devel

ENV DEBIAN_FRONTEND=noninteractive

ENV LANG C.UTF-8
ARG PYTHON=python3.10

RUN mkdir -p /app/intel-extension-for-transformers
WORKDIR /app/intel-extension-for-transformers

RUN apt-get update && apt-get install -y --no-install-recommends --fix-missing \
autoconf \
build-essential \
ca-certificates \
cmake \
git \
${PYTHON}-dev && \
apt-get clean autoclean && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*

COPY . /app/intel-extension-for-transformers

RUN ${PYTHON} -m pip install -r requirements.txt --no-cache-dir -f https://download.pytorch.org/whl/cpu/torch_stable.html

RUN ${PYTHON} -m pip install torch==2.1.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html

RUN ${PYTHON} -m pip install -r examples/huggingface/pytorch/code-generation/quantization/requirements.txt --no-cache-dir

RUN ${PYTHON} -m pip install /app/intel-extension-for-transformers/intel_extension_for_pytorch-2.1.0-cp310-cp310-manylinux2014_x86_64.whl

RUN ${PYTHON} -m pip install intel_extension_for_transformers
FROM itrex-base as prod

ARG PYTHON=python3.10

COPY --from=devel /usr/local/lib/${PYTHON}/dist-packages /usr/local/lib/${PYTHON}/dist-packages
COPY --from=devel /usr/local/bin /usr/local/bin
COPY --from=devel /usr/bin /usr/bin
COPY --from=devel /app/intel-extension-for-transformers/examples/huggingface/pytorch/code-generation/quantization /app/intel-extension-for-transformers/examples/huggingface/pytorch/code-generation/quantization

WORKDIR /app/intel-extension-for-transformers/examples/huggingface/pytorch/code-generation/quantization
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
IMAGE_TAG: 22.04
PYTHON: python3.10
context: ../
dockerfile: ./docker/Dockerfile
dockerfile: ./docker/Dockerfile_code_gen
target: devel
command: python tests/test_config.py
environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ protobuf
sentencepiece != 0.1.92
torch >= 1.10.0
transformers
intel_extension_for_pytorch
neural-compressor
git+https://github.com/huggingface/optimum.git
git+https://github.com/huggingface/optimum-intel.git@1f57059e9bd65380f93c8951f16da58d56ad0859
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ py-cpuinfo
setuptools>=61
setuptools_scm[toml]>=6.2
--extra-index-url https://download.pytorch.org/whl/cpu
torch==2.0.1
torch==2.0.1+cpu
accelerate
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sacremoses
neural-compressor
onnx>=1.10
onnxruntime
--find-links https://download.pytorch.org/whl/torch_stable.html
--find-links https://download.pytorch.org/cpu/whl/torch_stable.html
torch==2.0.1+cpu
transformers
intel-tensorflow==2.12.0
Expand Down

0 comments on commit dd38290

Please sign in to comment.