installation.md 2.26 KB
Newer Older
fxmarty's avatar
fxmarty committed
1
# Installation from source
2

fxmarty's avatar
fxmarty committed
3
4
5
6
7
<Tip warning={true}>

Installing TGI from source is not the recommended usage. We strongly recommend to use TGI through Docker, check the [Quick Tour](./quicktour), [Installation for Nvidia GPUs](./installation_nvidia) and [Installation for AMD GPUs](./installation_amd) to learn how to use TGI with Docker.

</Tip>
8
9
10

## Install CLI

OlivierDehaene's avatar
OlivierDehaene committed
11
You can use TGI command-line interface (CLI) to download weights, serve and quantize models, or get information on serving parameters.
12

Merve Noyan's avatar
Merve Noyan committed
13
14
15
16
17
18
19
20
21
22
23
24
To install the CLI, you need to first clone the TGI repository and then run `make`.

```bash
git clone https://github.com/huggingface/text-generation-inference.git && cd text-generation-inference
make install
```

If you would like to serve models with custom kernels, run

```bash
BUILD_EXTENSIONS=True make install
```
25
26
27
28
29

## Local Installation from Source

Before you start, you will need to setup your environment, and install Text Generation Inference. Text Generation Inference is tested on **Python 3.9+**.

OlivierDehaene's avatar
OlivierDehaene committed
30
Text Generation Inference is available on pypi, conda and GitHub.
31
32
33
34

To install and launch locally, first [install Rust](https://rustup.rs/) and create a Python virtual environment with at least
Python 3.9, e.g. using conda:

35
```bash
36
37
38
39
40
41
42
43
44
45
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

conda create -n text-generation-inference python=3.9
conda activate text-generation-inference
```

You may also need to install Protoc.

On Linux:

46
```bash
47
48
49
50
51
52
53
54
55
PROTOC_ZIP=protoc-21.12-linux-x86_64.zip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v21.12/$PROTOC_ZIP
sudo unzip -o $PROTOC_ZIP -d /usr/local bin/protoc
sudo unzip -o $PROTOC_ZIP -d /usr/local 'include/*'
rm -f $PROTOC_ZIP
```

On MacOS, using Homebrew:

56
```bash
57
58
59
60
61
brew install protobuf
```

Then run to install Text Generation Inference:

62
```bash
Merve Noyan's avatar
Merve Noyan committed
63
64
git clone https://github.com/huggingface/text-generation-inference.git && cd text-generation-inference
BUILD_EXTENSIONS=True make install
65
66
67
68
69
70
```

<Tip warning={true}>

On some machines, you may also need the OpenSSL libraries and gcc. On Linux machines, run:

71
```bash
72
73
74
75
76
77
78
sudo apt-get install libssl-dev gcc -y
```

</Tip>

Once installation is done, simply run:

79
```bash
80
81
82
83
make run-falcon-7b-instruct
```

This will serve Falcon 7B Instruct model from the port 8080, which we can query.