unsubscribe commited on
Commit
24815bc
1 Parent(s): ecfdae4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +98 -0
README.md CHANGED
@@ -1,3 +1,101 @@
1
  ---
2
  license: apache-2.0
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ pipeline_tag: text-generation
4
  ---
5
+
6
+ <div align="center">
7
+ <img src="https://raw.githubusercontent.com/InternLM/lmdeploy/0be9e7ab6fe9a066cfb0a09d0e0c8d2e28435e58/resources/lmdeploy-logo.svg" width="450"/>
8
+ </div>
9
+
10
+ [LMDeploy](https://github.com/InternLM/lmdeploy) supports LLM model inference of 4-bit weight, with the minimum requirement for NVIDIA graphics cards being sm80, such as A10, A100, Geforce 30/40 series.
11
+
12
+ Before proceeding with the inference of `internlm-chat-20b-4bit`, please ensure that lmdeploy is installed.
13
+
14
+ ```shell
15
+ pip install 'lmdeploy>=0.0.9'
16
+ ```
17
+
18
+ ## Inference
19
+
20
+ Please download `internlm-chat-20b-4bit` model as follows,
21
+
22
+ ```shell
23
+ git-lfs install
24
+ git clone https://huggingface.co/internlm/internlm-chat-20b-4bit
25
+ ```
26
+
27
+ As demonstrated in the command below, first convert the model's layout using `turbomind.deploy`, and then you can interact with the AI assistant in the terminal
28
+
29
+ ```shell
30
+
31
+ # Convert the model's layout and store it in the default path, ./workspace.
32
+ python3 -m lmdeploy.serve.turbomind.deploy \
33
+ --model-name internlm-chat-20b \
34
+ --model-path ./internlm-chat-20b \
35
+ --model-format awq \
36
+ --group-size 128
37
+
38
+ # inference
39
+ python3 -m lmdeploy.turbomind.chat ./workspace
40
+ ```
41
+
42
+ ## Serve with gradio
43
+
44
+ If you wish to interact with the model via web UI, please initiate the gradio server as indicated below:
45
+
46
+ ```shell
47
+ python3 -m lmdeploy.serve.turbomind ./workspace --server_name {ip_addr} --server_port {port}
48
+ ```
49
+
50
+ Subsequently, you can open the website `http://{ip_addr}:{port}` in your browser and interact with the model.
51
+
52
+ Besides serving with gradio, there are two more serving methods. One is serving with Triton Inference Server (TIS), and the other is an OpenAI-like server named as `api_server`.
53
+
54
+ Please refer to the [user guide](https://github.com/InternLM/lmdeploy#quick-start) for detailed information if you are interested.
55
+
56
+
57
+ ## Inference Performance
58
+
59
+ LMDeploy provides scripts for benchmarking `token throughput` and `request throughput`.
60
+
61
+ `token throughput` tests the speed of generating new tokens, given a specified number of prompt tokens and completion tokens, while `request throughput` measures the number of requests processed per minute with real dialogue data.
62
+
63
+ We conducted benchmarks on `internlm-chat-20b-4bit`. And `token_throughput` was measured by setting 256 prompt tokens and generating 512 tokens in response on A100-80G.
64
+
65
+ **Note**: The `session_len` in `workspace/triton_models/weights/config.ini` is changed to `2056` in our test.
66
+
67
+
68
+ | batch | tensor parallel | prompt_tokens | completion_tokens | thr_per_proc(token/s) | thr_per_node(token/s) | rpm (req/min) | mem_per_proc(GB) | mem_per_gpu(GB) | mem_per_node(GB) |
69
+ |-------|-----------------|---------------|-------------------|-----------------------|-----------------------|---------------|------------------|-----------------|------------------|
70
+ | 1 | 1 | 256 | 512 | 79.12 | 632.98 | - | 15.67 | 15.67 | 125.35 |
71
+ | 16 | 1 | 256 | 512 | 708.76 | 5670.1 | 220.23 | 51.48 | 51.48 | 411.85 |
72
+
73
+
74
+
75
+ ### token throughput
76
+
77
+ Run the following command,
78
+
79
+ ```shell
80
+ python benchmark/profile_generation.py \
81
+ --model-path ./workspace \
82
+ --concurrency 1 8 16 --prompt-tokens 256 512 512 1024 --completion-tokens 512 512 1024 1024
83
+ --dst-csv ./token_throughput.csv
84
+ ```
85
+ You will find the `token_throughput` metrics in `./token_throughput.csv`
86
+
87
+
88
+ ### request throughput
89
+
90
+ LMDeploy uses ShareGPT dataset to test request throughput. Try the next commands, and you will get the `rpm` (request per minute) metric.
91
+
92
+ ```
93
+ # download the ShareGPT dataset
94
+ wget https://huggingface.co/datasets/anon8231489123/ShareGPT_Vicuna_unfiltered/resolve/main/ShareGPT_V3_unfiltered_cleaned_split.json
95
+
96
+ #
97
+ python profile_throughput.py \
98
+ ShareGPT_V3_unfiltered_cleaned_split.json \
99
+ ./workspace \
100
+ --concurrency 16
101
+ ```