Skip to content

Commit 3ef5ffb

Browse files
v1.0.0 (#727)
1 parent bde25e6 commit 3ef5ffb

File tree

7 files changed

+33
-30
lines changed

7 files changed

+33
-30
lines changed

Cargo.lock

Lines changed: 4 additions & 4 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
@@ -8,7 +8,7 @@ members = [
88
]
99

1010
[workspace.package]
11-
version = "0.9.4"
11+
version = "1.0.0"
1212
edition = "2021"
1313
authors = ["Olivier Dehaene"]
1414
homepage = "https://github.com/huggingface/text-generation-inference"

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,14 @@
77
<a href="https://github.com/huggingface/text-generation-inference">
88
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/huggingface/text-generation-inference?style=social">
99
</a>
10-
<a href="https://github.com/huggingface/text-generation-inference/blob/main/LICENSE">
11-
<img alt="License" src="https://img.shields.io/github/license/huggingface/text-generation-inference">
12-
</a>
1310
<a href="https://huggingface.github.io/text-generation-inference">
1411
<img alt="Swagger API documentation" src="https://img.shields.io/badge/API-Swagger-informational">
1512
</a>
16-
</div>
1713

1814
A Rust, Python and gRPC server for text generation inference. Used in production at [HuggingFace](https://huggingface.co)
19-
to power LLMs api-inference widgets.
15+
to power Hugging Chat, the Inference API and Inference Endpoint.
16+
17+
</div>
2018

2119
## Table of contents
2220

@@ -85,7 +83,7 @@ The easiest way of getting started is using the official Docker container:
8583
model=tiiuae/falcon-7b-instruct
8684
volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
8785

88-
docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:0.9.4 --model-id $model
86+
docker run --gpus all --shm-size 1g -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:1.0.0 --model-id $model
8987
```
9088
**Note:** To use 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 11.8 or higher.
9189

@@ -152,7 +150,7 @@ model=meta-llama/Llama-2-7b-chat-hf
152150
volume=$PWD/data # share a volume with the Docker container to avoid downloading weights every run
153151
token=<your cli READ token>
154152

155-
docker run --gpus all --shm-size 1g -e HUGGING_FACE_HUB_TOKEN=$token -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:0.9.3 --model-id $model
153+
docker run --gpus all --shm-size 1g -e HUGGING_FACE_HUB_TOKEN=$token -p 8080:80 -v $volume:/data ghcr.io/huggingface/text-generation-inference:1.0.0 --model-id $model
156154
```
157155

158156
### A note on Shared Memory (shm)

docs/openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"name": "Apache 2.0",
1111
"url": "https://www.apache.org/licenses/LICENSE-2.0"
1212
},
13-
"version": "0.9.4"
13+
"version": "1.0.0"
1414
},
1515
"paths": {
1616
"/": {

server/Makefile-vllm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
vllm_commit := 084ca75d4271f8f67be731bc58e0d41d8e0afd3a
1+
vllm_commit := d284b831c17f42a8ea63369a06138325f73c4cf9
22

33
vllm:
44
# Clone vllm

server/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "text-generation-server"
3-
version = "0.9.4"
3+
version = "1.0.0"
44
description = "Text Generation Inference Python gRPC Server"
55
authors = ["Olivier Dehaene <olivier@huggingface.co>"]
66

server/text_generation_server/utils/layers.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -219,31 +219,36 @@ def load(config, prefix: str, weights):
219219
)
220220

221221
def forward(self, input: torch.Tensor) -> torch.Tensor:
222+
if not self.should_gather:
223+
return super().forward(input)
224+
222225
world_size = self.process_group.size()
223-
# Fast branch for single requests
224-
if (
225-
self.should_gather
226-
and len(input.shape) == 2
227-
and isinstance(self.linear, FastLinear)
228-
and input.shape[0] == 1
229-
):
226+
if len(input.shape) == 2 and isinstance(self.linear, FastLinear):
230227
out_dim = self.linear.weight.shape[0]
231228

232-
world_out = input.new_empty(1, out_dim * world_size)
233-
local_out = input.new_empty(1, out_dim)
229+
if input.shape[0] == 1:
230+
world_out = input.new_empty(1, out_dim * world_size)
231+
local_out = input.new_empty(1, out_dim)
232+
gather_input = local_out
233+
else:
234+
world_out = input.new_empty(out_dim * world_size, input.shape[0])
235+
gather_input = input.new_empty(out_dim, input.shape[0])
236+
local_out = gather_input.T
234237

235238
torch.mm(input, self.linear.weight.T, out=local_out)
236239

237240
torch.distributed.all_gather_into_tensor(
238-
world_out, local_out, group=self.process_group
241+
world_out, gather_input, group=self.process_group
239242
)
240-
return world_out
241243

242-
output = super().forward(input)
243-
if not self.should_gather:
244-
return output
244+
if input.shape[0] == 1:
245+
return world_out
246+
return world_out.T
245247

246-
world_output = [torch.empty_like(output) for _ in range(world_size)]
248+
output = super().forward(input)
249+
world_output = [
250+
torch.empty_like(output) for _ in range(self.process_group.size())
251+
]
247252
torch.distributed.all_gather(world_output, output, group=self.process_group)
248253
world_output = torch.cat(world_output, dim=-1)
249254
return world_output

0 commit comments

Comments
 (0)