Skip to content

Commit e4d7a67

Browse files
authored
Merge branch 'main' into feature/get-trace-id-from-req-headers
2 parents ba72c18 + bf59118 commit e4d7a67

File tree

191 files changed

+2814
-75673
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

191 files changed

+2814
-75673
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ jobs:
137137
uses: docker/[email protected]
138138
with:
139139
flavor: |
140-
latest=auto
140+
latest=false
141141
images: |
142142
registry.internal.huggingface.tech/api-inference/community/text-generation-inference
143143
ghcr.io/huggingface/text-generation-inference

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ repos:
44
hooks:
55
- id: check-yaml
66
- id: end-of-file-fixer
7+
exclude: crate-hashes.json
78
- id: trailing-whitespace
89
exclude: docs/source/reference/launcher.md
910
- repo: https://github.com/psf/black

Cargo.lock

Lines changed: 31 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ default-members = [
2020
resolver = "2"
2121

2222
[workspace.package]
23-
version = "2.4.2-dev0"
23+
version = "3.0.2-dev0"
2424
edition = "2021"
2525
authors = ["Olivier Dehaene"]
2626
homepage = "https://github.com/huggingface/text-generation-inference"

Dockerfile_intel

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ RUN cargo build --profile release-opt --frozen
4545

4646
# Text Generation Inference base image for Intel
4747

48-
FROM intel/intel-extension-for-pytorch:2.3.110-xpu AS xpu
48+
FROM intel/oneapi-basekit:2024.2.1-0-devel-ubuntu22.04 AS xpu
4949

5050
USER root
5151

@@ -87,7 +87,7 @@ RUN echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https:/
8787

8888
RUN mv /tmp/intel-for-pytorch-gpu-dev.list /etc/apt/sources.list.d
8989

90-
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt install -y intel-basekit=2024.2.1-98 xpu-smi cmake ninja-build pciutils intel-pti-dev-0.9
90+
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt install -y xpu-smi cmake ninja-build pciutils intel-pti-dev-0.9
9191

9292
# Text Generation Inference base env
9393
ENV HF_HOME=/data \
@@ -114,15 +114,8 @@ RUN cd server && \
114114
pip install -r requirements_intel.txt && \
115115
pip install ".[accelerate, compressed-tensors, peft, outlines]" --no-cache-dir
116116

117-
ENV CCL_ROOT=/opt/intel/oneapi/ccl/latest
118-
ENV I_MPI_ROOT=/opt/intel/oneapi/mpi/latest
119-
ENV FI_PROVIDER_PATH=/opt/intel/oneapi/mpi/latest/opt/mpi/libfabric/lib/prov:/usr/lib/x86_64-linux-gnu/libfabric
120-
ENV LIBRARY_PATH=/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/ccl/latest/lib/:/opt/intel/oneapi/mkl/latest/lib/:/opt/intel/oneapi/compiler/latest/lib
121-
ENV LD_LIBRARY_PATH=/opt/intel/oneapi/ccl/latest/lib/:/opt/intel/oneapi/mpi/latest/opt/mpi/libfabric/lib:/opt/intel/oneapi/mpi/latest/lib:/opt/intel/oneapi/mkl/latest/lib:/opt/intel/oneapi/compiler/latest/opt/compiler/lib:/opt/intel/oneapi/compiler/latest/lib:/opt/intel/oneapi/lib:/opt/intel/oneapi/lib/intel64:/opt/intel/oneapi/pti/0.9/lib:/opt/conda/lib
122-
ENV PATH=/opt/conda/bin:/opt/intel/oneapi/mpi/latest/opt/mpi/libfabric/bin:/opt/intel/oneapi/mpi/latest/bin:/opt/intel/oneapi/mpi/latest/opt/mpi/libfabric/bin:/opt/intel/oneapi/mkl/latest/bin/:/opt/intel/oneapi/compiler/latest/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
117+
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/oneapi/pti/0.9/lib:/opt/conda/lib
123118
ENV CCL_ZE_IPC_EXCHANGE=sockets
124-
ENV CMAKE_PREFIX_PATH=/opt/intel/oneapi/mkl/latest/lib/cmake:/opt/intel/oneapi/compiler/latest
125-
ENV CPATH=/opt/intel/oneapi/mpi/latest/include:/opt/intel/oneapi/ccl/latest/include:/opt/intel/oneapi/mkl/latest/include
126119
#ENV TORCH_LLM_ALLREDUCE=1
127120
#ENV CCL_TOPO_FABRIC_VERTEX_CONNECTION_CHECK=0
128121

@@ -197,9 +190,10 @@ RUN pip install triton py-libnuma
197190

198191
WORKDIR /usr/src
199192

200-
RUN git clone https://github.com/intel/intel-extension-for-pytorch && cd intel-extension-for-pytorch && git checkout 2e1c98f74ec1b35ad8dd1ebe7dd4b25470f2fd41
193+
RUN git clone https://github.com/intel/intel-extension-for-pytorch && cd intel-extension-for-pytorch && git checkout b7b552baf64283b594665b8687430fe92990e497
201194
RUN git clone https://github.com/intel/torch-ccl.git && cd torch-ccl && git checkout v2.4.0+cpu+rc0
202195

196+
RUN sed -i 's/VERSION_MINOR 6/VERSION_MINOR 5/' intel-extension-for-pytorch/version.txt
203197
RUN cd intel-extension-for-pytorch && git submodule sync && git submodule update --init --recursive && python setup.py install
204198

205199
RUN cd torch-ccl && git submodule sync && git submodule update --init --recursive && pip install .

README.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ model=HuggingFaceH4/zephyr-7b-beta
8484
volume=$PWD/data
8585

8686
docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data \
87-
ghcr.io/huggingface/text-generation-inference:2.4.1 --model-id $model
87+
3.0.0 ghcr.io/huggingface/text-generation-inference:3.0.0 --model-id $model
8888
```
8989

9090
And then you can make requests like
@@ -121,7 +121,7 @@ curl localhost:8080/v1/chat/completions \
121121

122122
**Note:** To use NVIDIA GPUs, you need to install the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html). We also recommend using NVIDIA drivers with CUDA version 12.2 or higher. For running the Docker container on a machine with no GPUs or CUDA support, it is enough to remove the `--gpus all` flag and add `--disable-custom-kernels`, please note CPU is not the intended platform for this project, so performance might be subpar.
123123

124-
**Note:** TGI supports AMD Instinct MI210 and MI250 GPUs. Details can be found in the [Supported Hardware documentation](https://huggingface.co/docs/text-generation-inference/supported_models#supported-hardware). To use AMD GPUs, please use `docker run --device /dev/kfd --device /dev/dri --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.4.1-rocm --model-id $model` instead of the command above.
124+
**Note:** TGI supports AMD Instinct MI210 and MI250 GPUs. Details can be found in the [Supported Hardware documentation](https://huggingface.co/docs/text-generation-inference/installation_amd#using-tgi-with-amd-gpus). To use AMD GPUs, please use `docker run --device /dev/kfd --device /dev/dri --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:3.0.0-rocm --model-id $model` instead of the command above.
125125

126126
To see all options to serve your models (in the [code](https://github.com/huggingface/text-generation-inference/blob/main/launcher/src/main.rs) or in the cli):
127127
```
@@ -151,7 +151,7 @@ model=meta-llama/Meta-Llama-3.1-8B-Instruct
151151
volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
152152
token=<your cli READ token>
153153

154-
docker run --gpus all --shm-size 1g -e HF_TOKEN=$token -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:2.4.1 --model-id $model
154+
docker run --gpus all --shm-size 1g -e HF_TOKEN=$token -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:3.0.0 --model-id $model
155155
```
156156

157157
### A note on Shared Memory (shm)
@@ -196,14 +196,26 @@ Detailed blogpost by Adyen on TGI inner workings: [LLM inference at scale with T
196196

197197
You can also opt to install `text-generation-inference` locally.
198198

199-
First [install Rust](https://rustup.rs/) and create a Python virtual environment with at least
200-
Python 3.9, e.g. using `conda`:
199+
First clone the repository and change directoy into it:
200+
201+
```shell
202+
git clone https://github.com/huggingface/text-generation-inference
203+
cd text-generation-inference
204+
```
205+
206+
Then [install Rust](https://rustup.rs/) and create a Python virtual environment with at least
207+
Python 3.9, e.g. using `conda` or `python venv`:
201208

202209
```shell
203210
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
204211
212+
#using conda
205213
conda create -n text-generation-inference python=3.11
206214
conda activate text-generation-inference
215+
216+
#using pyton venv
217+
python3 -m venv .venv
218+
source .venv/bin/activate
207219
```
208220

209221
You may also need to install Protoc.

assets/v3_benchmarks.png

209 KB
Loading

backends/v2/src/backend.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ impl Backend for BackendV2 {
104104
}
105105
.is_ok()
106106
}
107+
108+
fn start_health(&self) -> bool {
109+
true
110+
}
107111
}
108112

109113
/// Batching logic

backends/v2/src/queue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,7 @@ mod tests {
436436
stopping_parameters: ValidStoppingParameters {
437437
ignore_eos_token: false,
438438
max_new_tokens: 1,
439+
max_total_new_tokens: 1024,
439440
stop_sequences: vec![],
440441
},
441442
top_n_tokens: 0,

backends/v3/src/backend.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ impl Backend for BackendV3 {
111111
}
112112
.is_ok()
113113
}
114+
115+
fn start_health(&self) -> bool {
116+
true
117+
}
114118
}
115119

116120
/// Batching logic

0 commit comments

Comments
 (0)