Skip to content

Commit 3748a06

Browse files
authored
Fix compilation inside tgi (#700)
* refactor(tgi): do not require TGI_VERSION Since bumping the TGI version always require adapting the Dockerfile it is useless to have it defined outside of the Dockerfile. * fix(tgi): silent build warnings * fix(tgi): add missing libxml2 package This package is required by the neuronx compiler, but not pulled automatically.
1 parent 8445656 commit 3748a06

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,15 @@ PACKAGE_FILES = $(PACKAGE_PYTHON_FILES) \
4040
$(PACKAGE_DIST) $(PACKAGE_WHEEL): $(PACKAGE_FILES)
4141
python -m build
4242

43-
TGI_VERSION ?= 2.1.1
44-
4543
neuronx-tgi: $(PACKAGE_DIST)
4644
docker build --rm -f text-generation-inference/Dockerfile \
4745
--build-arg VERSION=$(VERSION) \
48-
--build-arg TGI_VERSION=$(TGI_VERSION) \
4946
-t neuronx-tgi:$(VERSION) .
5047
docker tag neuronx-tgi:$(VERSION) neuronx-tgi:latest
5148

5249
neuronx-tgi-sagemaker: $(PACKAGE_DIST)
5350
docker build --rm -f text-generation-inference/Dockerfile \
5451
--build-arg VERSION=$(VERSION) \
55-
--build-arg TGI_VERSION=$(TGI_VERSION) \
5652
--target sagemaker \
5753
-t neuronx-tgi:$(VERSION) .
5854

@@ -90,7 +86,7 @@ test_installs:
9086
tgi_server:
9187
python -m pip install -r text-generation-inference/server/build-requirements.txt
9288
make -C text-generation-inference/server clean
93-
VERSION=${VERSION} TGI_VERSION=${TGI_VERSION} make -C text-generation-inference/server gen-server
89+
VERSION=${VERSION} make -C text-generation-inference/server gen-server
9490

9591
tgi_test: tgi_server
9692
python -m pip install .[neuronx]

text-generation-inference/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
# Fetch and extract the TGI sources (TGI_VERSION is mandatory)
1+
# Fetch and extract the TGI sources
22
FROM alpine AS tgi
3-
ARG TGI_VERSION
4-
RUN test -n ${TGI_VERSION:?}
3+
ARG TGI_VERSION=2.1.1
54
RUN mkdir -p /tgi
65
ADD https://github.com/huggingface/text-generation-inference/archive/refs/tags/v${TGI_VERSION}.tar.gz /tgi/sources.tar.gz
76
RUN tar -C /tgi -xf /tgi/sources.tar.gz --strip-components=1
@@ -13,7 +12,7 @@ WORKDIR /usr/src
1312

1413
ARG CARGO_REGISTRIES_CRATES_IO_PROTOCOL=sparse
1514

16-
FROM chef as planner
15+
FROM chef AS planner
1716
COPY --from=tgi /tgi/Cargo.lock Cargo.lock
1817
COPY --from=tgi /tgi/Cargo.toml Cargo.toml
1918
COPY --from=tgi /tgi/rust-toolchain.toml rust-toolchain.toml
@@ -100,6 +99,7 @@ RUN apt-get update -y \
10099
aws-neuronx-collectives=2.22.26.0-17a033bc8 \
101100
aws-neuronx-runtime-lib=2.22.14.0-6e27b8d5b \
102101
aws-neuronx-tools=2.19.0.0 \
102+
libxml2 \
103103
&& rm -rf /var/lib/apt/lists/* \
104104
&& apt-get clean
105105

@@ -117,7 +117,7 @@ RUN pip3 install \
117117
hf_transfer huggingface_hub
118118

119119
# Install optimum-neuron
120-
COPY dist/optimum_neuron-${VERSION}.tar.gz optimum-neuron.tar.gz
120+
COPY ./dist/optimum_neuron-${VERSION}.tar.gz optimum-neuron.tar.gz
121121
RUN pip3 install optimum-neuron.tar.gz
122122

123123
# TGI base env
@@ -134,7 +134,7 @@ COPY --from=pyserver /pyserver/build/dist dist
134134
RUN pip install dist/text_generation_server*.tar.gz
135135

136136
# AWS Sagemaker compatible image
137-
FROM neuron as sagemaker
137+
FROM neuron AS sagemaker
138138

139139
COPY text-generation-inference/sagemaker-entrypoint.sh entrypoint.sh
140140
RUN chmod +x entrypoint.sh

text-generation-inference/server/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pkg_name := text_generation_server
33
BUILDDIR ?= $(CURDIR)/build
44
VERSION ?= 0.0.1
5-
TGI_VERSION ?= 2.0.2
5+
TGI_VERSION ?= 2.1.1
66
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
77
mkfile_dir := $(dir $(mkfile_path))
88
pkg_dir := $(BUILDDIR)/$(pkg_name)

0 commit comments

Comments
 (0)