serving.md 3.01 KB
Newer Older
lvhan028's avatar
lvhan028 committed
1
2
# Serving a model

3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Serving [LLaMA-2](https://github.com/facebookresearch/llama)

You can download [llama-2 models from huggingface](https://huggingface.co/meta-llama) and serve them like below:

<details open>
<summary><b>7B</b></summary>

```shell
python3 -m lmdeploy.serve.turbomind.deploy llama2 /path/to/llama-2-7b-chat-hf
bash workspace/service_docker_up.sh
```

</details>

<details open>
<summary><b>13B</b></summary>

```shell
python3 -m lmdeploy.serve.turbomind.deploy llama2 /path/to/llama-2-13b-chat-hf --tp 2
bash workspace/service_docker_up.sh
```

</details>

<details open>
<summary><b>70B</b></summary>

```shell
python3 -m lmdeploy.serve.turbomind.deploy llama2 /path/to/llama-2-70b-chat-hf --tp 8
32
33
34
35
36
37
38
39
40
41
42
43
44
bash workspace/service_docker_up.sh
```

</details>

<details open>
<summary><b>7B with INT4 weight only quantization</b></summary>

```shell
python3 -m lmdeploy.serve.turbomind.deploy llama2 /path/to/llama-2-7b-chat-hf \
    --model_format awq \
    --group_size 128 \
    --quant_path /path/to/awq-quant-weight.pt
45
46
47
48
49
bash workspace/service_docker_up.sh
```

</details>

lvhan028's avatar
lvhan028 committed
50
51
## Serving [LLaMA](https://github.com/facebookresearch/llama)

q.yao's avatar
q.yao committed
52
Weights for the LLaMA models can be obtained from by filling out [this form](https://docs.google.com/forms/d/e/1FAIpQLSfqNECQnMkycAp2jP4Z9TFX0cGR4uf7b_fBxjY_OjhJILlKGA/viewform)
lvhan028's avatar
lvhan028 committed
53
54
55
56
57

<details open>
<summary><b>7B</b></summary>

```shell
58
python3 -m lmdeploy.serve.turbomind.deploy llama /path/to/llama-7b llama \
lvhan028's avatar
lvhan028 committed
59
60
61
62
63
64
65
66
67
68
    --tokenizer_path /path/to/tokenizer/model
bash workspace/service_docker_up.sh
```

</details>

<details open>
<summary><b>13B</b></summary>

```shell
69
python3 -m lmdeploy.serve.turbomind.deploy llama /path/to/llama-13b llama \
lvhan028's avatar
lvhan028 committed
70
71
72
73
74
75
76
77
78
79
    --tokenizer_path /path/to/tokenizer/model --tp 2
bash workspace/service_docker_up.sh
```

</details>

<details open>
<summary><b>30B</b></summary>

```shell
80
python3 -m lmdeploy.serve.turbomind.deploy llama /path/to/llama-30b llama \
lvhan028's avatar
lvhan028 committed
81
82
83
84
85
86
87
88
89
90
    --tokenizer_path /path/to/tokenizer/model --tp 4
bash workspace/service_docker_up.sh
```

</details>

<details open>
<summary><b>65B</b></summary>

```shell
91
python3 -m lmdeploy.serve.turbomind.deploy llama /path/to/llama-65b llama \
lvhan028's avatar
lvhan028 committed
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
    --tokenizer_path /path/to/tokenizer/model --tp 8
bash workspace/service_docker_up.sh
```

</details>

### Serving [Vicuna](https://lmsys.org/blog/2023-03-30-vicuna/)

<details open>
<summary><b>7B</b></summary>

```shell
python3 -m pip install fschat
python3 -m fastchat.model.apply_delta \
  --base-model-path /path/to/llama-7b \
  --target-model-path /path/to/vicuna-7b \
  --delta-path lmsys/vicuna-7b-delta-v1.1

110
python3 -m lmdeploy.serve.turbomind.deploy vicuna /path/to/vicuna-7b
lvhan028's avatar
lvhan028 committed
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
bash workspace/service_docker_up.sh
```

</details>

<details open>
<summary><b>13B</b></summary>

```shell
python3 -m pip install fschat
python3 -m fastchat.model.apply_delta \
  --base-model-path /path/to/llama-13b \
  --target-model-path /path/to/vicuna-13b \
  --delta-path lmsys/vicuna-13b-delta-v1.1

126
python3 -m lmdeploy.serve.turbomind.deploy vicuna /path/to/vicuna-13b
lvhan028's avatar
lvhan028 committed
127
128
129
130
bash workspace/service_docker_up.sh
```

</details>