Commit
•
5a151e8
1
Parent(s):
4c6424c
Added some polishing touches
Browse files- 01_1_TGI-launcher.ipynb +51 -51
- 01_2_TGI-benchmark.ipynb +25 -23
01_1_TGI-launcher.ipynb
CHANGED
@@ -9,8 +9,8 @@
|
|
9 |
"\n",
|
10 |
"Here are some of the most important ones:\n",
|
11 |
"- `--model-id`\n",
|
12 |
-
"- `--quantize`
|
13 |
-
"- `--max-input-tokens`
|
14 |
"- `--max-total-tokens` \n",
|
15 |
"- `--max-batch-size` \n",
|
16 |
"- `--max-batch-total-tokens`\n",
|
@@ -54,102 +54,102 @@
|
|
54 |
"text": [
|
55 |
"Text Generation Launcher\n",
|
56 |
"\n",
|
57 |
-
"\
|
58 |
"\n",
|
59 |
-
"\
|
60 |
-
" \
|
61 |
" The name of the model to load. Can be a MODEL_ID as listed on <https://hf.co/models> like `gpt2` or `OpenAssistant/oasst-sft-1-pythia-12b`. Or it can be a local directory containing the necessary files as saved by `save_pretrained(...)` methods of transformers [env: MODEL_ID=] [default: bigscience/bloom-560m]\n",
|
62 |
-
" \
|
63 |
" The actual revision of the model if you're referring to a model on the hub. You can use a specific commit id or a branch like `refs/pr/2` [env: REVISION=]\n",
|
64 |
-
" \
|
65 |
" The number of tokenizer workers used for payload validation and truncation inside the router [env: VALIDATION_WORKERS=] [default: 2]\n",
|
66 |
-
" \
|
67 |
" Whether to shard the model across multiple GPUs By default text-generation-inference will use all available GPUs to run the model. Setting it to `false` deactivates `num_shard` [env: SHARDED=] [possible values: true, false]\n",
|
68 |
-
" \
|
69 |
" The number of shards to use if you don't want to use all GPUs on a given machine. You can use `CUDA_VISIBLE_DEVICES=0,1 text-generation-launcher... --num_shard 2` and `CUDA_VISIBLE_DEVICES=2,3 text-generation-launcher... --num_shard 2` to launch 2 copies with 2 shard each on a given machine with 4 GPUs for instance [env: NUM_SHARD=]\n",
|
70 |
-
" \
|
71 |
" Whether you want the model to be quantized [env: QUANTIZE=] [possible values: awq, eetq, gptq, bitsandbytes, bitsandbytes-nf4, bitsandbytes-fp4, fp8]\n",
|
72 |
-
" \
|
73 |
" The number of input_ids to speculate on If using a medusa model, the heads will be picked up automatically Other wise, it will use n-gram speculation which is relatively free in terms of compute, but the speedup heavily depends on the task [env: SPECULATE=]\n",
|
74 |
-
" \
|
75 |
" The dtype to be forced upon the model. This option cannot be used with `--quantize` [env: DTYPE=] [possible values: float16, bfloat16]\n",
|
76 |
-
" \
|
77 |
" Whether you want to execute hub modelling code. Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision [env: TRUST_REMOTE_CODE=]\n",
|
78 |
-
" \
|
79 |
" The maximum amount of concurrent requests for this particular deployment. Having a low limit will refuse clients requests instead of having them wait for too long and is usually good to handle backpressure correctly [env: MAX_CONCURRENT_REQUESTS=] [default: 128]\n",
|
80 |
-
" \
|
81 |
" This is the maximum allowed value for clients to set `best_of`. Best of makes `n` generations at the same time, and return the best in terms of overall log probability over the entire generated sequence [env: MAX_BEST_OF=] [default: 2]\n",
|
82 |
-
" \
|
83 |
" This is the maximum allowed value for clients to set `stop_sequences`. Stop sequences are used to allow the model to stop on more than just the EOS token, and enable more complex \"prompting\" where users can preprompt the model in a specific way and define their \"own\" stop token aligned with their prompt [env: MAX_STOP_SEQUENCES=] [default: 4]\n",
|
84 |
-
" \
|
85 |
" This is the maximum allowed value for clients to set `top_n_tokens`. `top_n_tokens is used to return information about the the `n` most likely tokens at each generation step, instead of just the sampled token. This information can be used for downstream tasks like for classification or ranking [env: MAX_TOP_N_TOKENS=] [default: 5]\n",
|
86 |
-
" \
|
87 |
" This is the maximum allowed input length (expressed in number of tokens) for users. The larger this value, the longer prompt users can send which can impact the overall memory required to handle the load. Please note that some models have a finite range of sequence they can handle. Default to min(max_position_embeddings - 1, 4095) [env: MAX_INPUT_TOKENS=]\n",
|
88 |
-
" \
|
89 |
" Legacy version of [`Args::max_input_tokens`] [env: MAX_INPUT_LENGTH=]\n",
|
90 |
-
" \
|
91 |
" This is the most important value to set as it defines the \"memory budget\" of running clients requests. Clients will send input sequences and ask to generate `max_new_tokens` on top. with a value of `1512` users can send either a prompt of `1000` and ask for `512` new tokens, or send a prompt of `1` and ask for `1511` max_new_tokens. The larger this value, the larger amount each request will be in your RAM and the less effective batching can be. Default to min(max_position_embeddings, 4096) [env: MAX_TOTAL_TOKENS=]\n",
|
92 |
-
" \
|
93 |
" This represents the ratio of waiting queries vs running queries where you want to start considering pausing the running queries to include the waiting ones into the same batch. `waiting_served_ratio=1.2` Means when 12 queries are waiting and there's only 10 queries left in the current batch we check if we can fit those 12 waiting queries into the batching strategy, and if yes, then batching happens delaying the 10 running queries by a `prefill` run [env: WAITING_SERVED_RATIO=] [default: 1.2]\n",
|
94 |
-
" \
|
95 |
" Limits the number of tokens for the prefill operation. Since this operation take the most memory and is compute bound, it is interesting to limit the number of requests that can be sent. Default to `max_input_tokens + 50` to give a bit of room [env: MAX_BATCH_PREFILL_TOKENS=]\n",
|
96 |
-
" \
|
97 |
" **IMPORTANT** This is one critical control to allow maximum usage of the available hardware [env: MAX_BATCH_TOTAL_TOKENS=]\n",
|
98 |
-
" \
|
99 |
" This setting defines how many tokens can be passed before forcing the waiting queries to be put on the batch (if the size of the batch allows for it). New queries require 1 `prefill` forward, which is different from `decode` and therefore you need to pause the running batch in order to run `prefill` to create the correct values for the waiting queries to be able to join the batch [env: MAX_WAITING_TOKENS=] [default: 20]\n",
|
100 |
-
" \
|
101 |
" Enforce a maximum number of requests per batch Specific flag for hardware targets that do not support unpadded inference [env: MAX_BATCH_SIZE=]\n",
|
102 |
-
" \
|
103 |
" Specify the batch sizes to compute cuda graphs for. Use \"0\" to disable. Default = \"1,2,4,8,16,32\" [env: CUDA_GRAPHS=]\n",
|
104 |
-
" \
|
105 |
" The IP address to listen on [env: HOSTNAME=r-derek-thomas-tgi-benchmark-space-kiwh48a6-ee7f8-q0926] [default: 0.0.0.0]\n",
|
106 |
-
" \
|
107 |
" The port to listen on [env: PORT=80] [default: 3000]\n",
|
108 |
-
" \
|
109 |
" The name of the socket for gRPC communication between the webserver and the shards [env: SHARD_UDS_PATH=] [default: /tmp/text-generation-server]\n",
|
110 |
-
" \
|
111 |
" The address the master shard will listen on. (setting used by torch distributed) [env: MASTER_ADDR=] [default: localhost]\n",
|
112 |
-
" \
|
113 |
" The address the master port will listen on. (setting used by torch distributed) [env: MASTER_PORT=] [default: 29500]\n",
|
114 |
-
" \
|
115 |
" The location of the huggingface hub cache. Used to override the location if you want to provide a mounted disk for instance [env: HUGGINGFACE_HUB_CACHE=/data]\n",
|
116 |
-
" \
|
117 |
" The location of the huggingface hub cache. Used to override the location if you want to provide a mounted disk for instance [env: WEIGHTS_CACHE_OVERRIDE=]\n",
|
118 |
-
" \
|
119 |
" For some models (like bloom), text-generation-inference implemented custom cuda kernels to speed up inference. Those kernels were only tested on A100. Use this flag to disable them if you're running on different hardware and encounter issues [env: DISABLE_CUSTOM_KERNELS=]\n",
|
120 |
-
" \
|
121 |
" Limit the CUDA available memory. The allowed value equals the total visible memory multiplied by cuda-memory-fraction [env: CUDA_MEMORY_FRACTION=] [default: 1.0]\n",
|
122 |
-
" \
|
123 |
" Rope scaling will only be used for RoPE models and allow rescaling the position rotary to accomodate for larger prompts [env: ROPE_SCALING=] [possible values: linear, dynamic]\n",
|
124 |
-
" \
|
125 |
" Rope scaling will only be used for RoPE models See `rope_scaling` [env: ROPE_FACTOR=]\n",
|
126 |
-
" \
|
127 |
" Outputs the logs in JSON format (useful for telemetry) [env: JSON_OUTPUT=]\n",
|
128 |
-
" \
|
129 |
" [env: OTLP_ENDPOINT=]\n",
|
130 |
-
" \
|
131 |
" [env: CORS_ALLOW_ORIGIN=]\n",
|
132 |
-
" \
|
133 |
" [env: WATERMARK_GAMMA=]\n",
|
134 |
-
" \
|
135 |
" [env: WATERMARK_DELTA=]\n",
|
136 |
-
" \
|
137 |
" Enable ngrok tunneling [env: NGROK=]\n",
|
138 |
-
" \
|
139 |
" ngrok authentication token [env: NGROK_AUTHTOKEN=]\n",
|
140 |
-
" \
|
141 |
" ngrok edge [env: NGROK_EDGE=]\n",
|
142 |
-
" \
|
143 |
" The path to the tokenizer config file. This path is used to load the tokenizer configuration which may include a `chat_template`. If not provided, the default config will be used from the model hub [env: TOKENIZER_CONFIG_PATH=]\n",
|
144 |
-
" \
|
145 |
" Disable outlines grammar constrained generation. This is a feature that allows you to generate text that follows a specific grammar [env: DISABLE_GRAMMAR_SUPPORT=]\n",
|
146 |
-
" \
|
147 |
" Display a lot of information about your runtime environment\n",
|
148 |
-
" \
|
149 |
" Control the maximum number of inputs that a client can send in a single request [env: MAX_CLIENT_BATCH_SIZE=] [default: 4]\n",
|
150 |
-
" \
|
151 |
" Print help (see more with '--help')\n",
|
152 |
-
" \
|
153 |
" Print version\n"
|
154 |
]
|
155 |
}
|
|
|
9 |
"\n",
|
10 |
"Here are some of the most important ones:\n",
|
11 |
"- `--model-id`\n",
|
12 |
+
"- `--quantize` Quantization saves memory, but does not always improve speed\n",
|
13 |
+
"- `--max-input-tokens` \n",
|
14 |
"- `--max-total-tokens` \n",
|
15 |
"- `--max-batch-size` \n",
|
16 |
"- `--max-batch-total-tokens`\n",
|
|
|
54 |
"text": [
|
55 |
"Text Generation Launcher\n",
|
56 |
"\n",
|
57 |
+
"\u001B[1m\u001B[4mUsage:\u001B[0m \u001B[1mtext-generation-launcher\u001B[0m [OPTIONS]\n",
|
58 |
"\n",
|
59 |
+
"\u001B[1m\u001B[4mOptions:\u001B[0m\n",
|
60 |
+
" \u001B[1m--model-id\u001B[0m <MODEL_ID>\n",
|
61 |
" The name of the model to load. Can be a MODEL_ID as listed on <https://hf.co/models> like `gpt2` or `OpenAssistant/oasst-sft-1-pythia-12b`. Or it can be a local directory containing the necessary files as saved by `save_pretrained(...)` methods of transformers [env: MODEL_ID=] [default: bigscience/bloom-560m]\n",
|
62 |
+
" \u001B[1m--revision\u001B[0m <REVISION>\n",
|
63 |
" The actual revision of the model if you're referring to a model on the hub. You can use a specific commit id or a branch like `refs/pr/2` [env: REVISION=]\n",
|
64 |
+
" \u001B[1m--validation-workers\u001B[0m <VALIDATION_WORKERS>\n",
|
65 |
" The number of tokenizer workers used for payload validation and truncation inside the router [env: VALIDATION_WORKERS=] [default: 2]\n",
|
66 |
+
" \u001B[1m--sharded\u001B[0m <SHARDED>\n",
|
67 |
" Whether to shard the model across multiple GPUs By default text-generation-inference will use all available GPUs to run the model. Setting it to `false` deactivates `num_shard` [env: SHARDED=] [possible values: true, false]\n",
|
68 |
+
" \u001B[1m--num-shard\u001B[0m <NUM_SHARD>\n",
|
69 |
" The number of shards to use if you don't want to use all GPUs on a given machine. You can use `CUDA_VISIBLE_DEVICES=0,1 text-generation-launcher... --num_shard 2` and `CUDA_VISIBLE_DEVICES=2,3 text-generation-launcher... --num_shard 2` to launch 2 copies with 2 shard each on a given machine with 4 GPUs for instance [env: NUM_SHARD=]\n",
|
70 |
+
" \u001B[1m--quantize\u001B[0m <QUANTIZE>\n",
|
71 |
" Whether you want the model to be quantized [env: QUANTIZE=] [possible values: awq, eetq, gptq, bitsandbytes, bitsandbytes-nf4, bitsandbytes-fp4, fp8]\n",
|
72 |
+
" \u001B[1m--speculate\u001B[0m <SPECULATE>\n",
|
73 |
" The number of input_ids to speculate on If using a medusa model, the heads will be picked up automatically Other wise, it will use n-gram speculation which is relatively free in terms of compute, but the speedup heavily depends on the task [env: SPECULATE=]\n",
|
74 |
+
" \u001B[1m--dtype\u001B[0m <DTYPE>\n",
|
75 |
" The dtype to be forced upon the model. This option cannot be used with `--quantize` [env: DTYPE=] [possible values: float16, bfloat16]\n",
|
76 |
+
" \u001B[1m--trust-remote-code\u001B[0m\n",
|
77 |
" Whether you want to execute hub modelling code. Explicitly passing a `revision` is encouraged when loading a model with custom code to ensure no malicious code has been contributed in a newer revision [env: TRUST_REMOTE_CODE=]\n",
|
78 |
+
" \u001B[1m--max-concurrent-requests\u001B[0m <MAX_CONCURRENT_REQUESTS>\n",
|
79 |
" The maximum amount of concurrent requests for this particular deployment. Having a low limit will refuse clients requests instead of having them wait for too long and is usually good to handle backpressure correctly [env: MAX_CONCURRENT_REQUESTS=] [default: 128]\n",
|
80 |
+
" \u001B[1m--max-best-of\u001B[0m <MAX_BEST_OF>\n",
|
81 |
" This is the maximum allowed value for clients to set `best_of`. Best of makes `n` generations at the same time, and return the best in terms of overall log probability over the entire generated sequence [env: MAX_BEST_OF=] [default: 2]\n",
|
82 |
+
" \u001B[1m--max-stop-sequences\u001B[0m <MAX_STOP_SEQUENCES>\n",
|
83 |
" This is the maximum allowed value for clients to set `stop_sequences`. Stop sequences are used to allow the model to stop on more than just the EOS token, and enable more complex \"prompting\" where users can preprompt the model in a specific way and define their \"own\" stop token aligned with their prompt [env: MAX_STOP_SEQUENCES=] [default: 4]\n",
|
84 |
+
" \u001B[1m--max-top-n-tokens\u001B[0m <MAX_TOP_N_TOKENS>\n",
|
85 |
" This is the maximum allowed value for clients to set `top_n_tokens`. `top_n_tokens is used to return information about the the `n` most likely tokens at each generation step, instead of just the sampled token. This information can be used for downstream tasks like for classification or ranking [env: MAX_TOP_N_TOKENS=] [default: 5]\n",
|
86 |
+
" \u001B[1m--max-input-tokens\u001B[0m <MAX_INPUT_TOKENS>\n",
|
87 |
" This is the maximum allowed input length (expressed in number of tokens) for users. The larger this value, the longer prompt users can send which can impact the overall memory required to handle the load. Please note that some models have a finite range of sequence they can handle. Default to min(max_position_embeddings - 1, 4095) [env: MAX_INPUT_TOKENS=]\n",
|
88 |
+
" \u001B[1m--max-input-length\u001B[0m <MAX_INPUT_LENGTH>\n",
|
89 |
" Legacy version of [`Args::max_input_tokens`] [env: MAX_INPUT_LENGTH=]\n",
|
90 |
+
" \u001B[1m--max-total-tokens\u001B[0m <MAX_TOTAL_TOKENS>\n",
|
91 |
" This is the most important value to set as it defines the \"memory budget\" of running clients requests. Clients will send input sequences and ask to generate `max_new_tokens` on top. with a value of `1512` users can send either a prompt of `1000` and ask for `512` new tokens, or send a prompt of `1` and ask for `1511` max_new_tokens. The larger this value, the larger amount each request will be in your RAM and the less effective batching can be. Default to min(max_position_embeddings, 4096) [env: MAX_TOTAL_TOKENS=]\n",
|
92 |
+
" \u001B[1m--waiting-served-ratio\u001B[0m <WAITING_SERVED_RATIO>\n",
|
93 |
" This represents the ratio of waiting queries vs running queries where you want to start considering pausing the running queries to include the waiting ones into the same batch. `waiting_served_ratio=1.2` Means when 12 queries are waiting and there's only 10 queries left in the current batch we check if we can fit those 12 waiting queries into the batching strategy, and if yes, then batching happens delaying the 10 running queries by a `prefill` run [env: WAITING_SERVED_RATIO=] [default: 1.2]\n",
|
94 |
+
" \u001B[1m--max-batch-prefill-tokens\u001B[0m <MAX_BATCH_PREFILL_TOKENS>\n",
|
95 |
" Limits the number of tokens for the prefill operation. Since this operation take the most memory and is compute bound, it is interesting to limit the number of requests that can be sent. Default to `max_input_tokens + 50` to give a bit of room [env: MAX_BATCH_PREFILL_TOKENS=]\n",
|
96 |
+
" \u001B[1m--max-batch-total-tokens\u001B[0m <MAX_BATCH_TOTAL_TOKENS>\n",
|
97 |
" **IMPORTANT** This is one critical control to allow maximum usage of the available hardware [env: MAX_BATCH_TOTAL_TOKENS=]\n",
|
98 |
+
" \u001B[1m--max-waiting-tokens\u001B[0m <MAX_WAITING_TOKENS>\n",
|
99 |
" This setting defines how many tokens can be passed before forcing the waiting queries to be put on the batch (if the size of the batch allows for it). New queries require 1 `prefill` forward, which is different from `decode` and therefore you need to pause the running batch in order to run `prefill` to create the correct values for the waiting queries to be able to join the batch [env: MAX_WAITING_TOKENS=] [default: 20]\n",
|
100 |
+
" \u001B[1m--max-batch-size\u001B[0m <MAX_BATCH_SIZE>\n",
|
101 |
" Enforce a maximum number of requests per batch Specific flag for hardware targets that do not support unpadded inference [env: MAX_BATCH_SIZE=]\n",
|
102 |
+
" \u001B[1m--cuda-graphs\u001B[0m <CUDA_GRAPHS>\n",
|
103 |
" Specify the batch sizes to compute cuda graphs for. Use \"0\" to disable. Default = \"1,2,4,8,16,32\" [env: CUDA_GRAPHS=]\n",
|
104 |
+
" \u001B[1m--hostname\u001B[0m <HOSTNAME>\n",
|
105 |
" The IP address to listen on [env: HOSTNAME=r-derek-thomas-tgi-benchmark-space-kiwh48a6-ee7f8-q0926] [default: 0.0.0.0]\n",
|
106 |
+
" \u001B[1m-p\u001B[0m, \u001B[1m--port\u001B[0m <PORT>\n",
|
107 |
" The port to listen on [env: PORT=80] [default: 3000]\n",
|
108 |
+
" \u001B[1m--shard-uds-path\u001B[0m <SHARD_UDS_PATH>\n",
|
109 |
" The name of the socket for gRPC communication between the webserver and the shards [env: SHARD_UDS_PATH=] [default: /tmp/text-generation-server]\n",
|
110 |
+
" \u001B[1m--master-addr\u001B[0m <MASTER_ADDR>\n",
|
111 |
" The address the master shard will listen on. (setting used by torch distributed) [env: MASTER_ADDR=] [default: localhost]\n",
|
112 |
+
" \u001B[1m--master-port\u001B[0m <MASTER_PORT>\n",
|
113 |
" The address the master port will listen on. (setting used by torch distributed) [env: MASTER_PORT=] [default: 29500]\n",
|
114 |
+
" \u001B[1m--huggingface-hub-cache\u001B[0m <HUGGINGFACE_HUB_CACHE>\n",
|
115 |
" The location of the huggingface hub cache. Used to override the location if you want to provide a mounted disk for instance [env: HUGGINGFACE_HUB_CACHE=/data]\n",
|
116 |
+
" \u001B[1m--weights-cache-override\u001B[0m <WEIGHTS_CACHE_OVERRIDE>\n",
|
117 |
" The location of the huggingface hub cache. Used to override the location if you want to provide a mounted disk for instance [env: WEIGHTS_CACHE_OVERRIDE=]\n",
|
118 |
+
" \u001B[1m--disable-custom-kernels\u001B[0m\n",
|
119 |
" For some models (like bloom), text-generation-inference implemented custom cuda kernels to speed up inference. Those kernels were only tested on A100. Use this flag to disable them if you're running on different hardware and encounter issues [env: DISABLE_CUSTOM_KERNELS=]\n",
|
120 |
+
" \u001B[1m--cuda-memory-fraction\u001B[0m <CUDA_MEMORY_FRACTION>\n",
|
121 |
" Limit the CUDA available memory. The allowed value equals the total visible memory multiplied by cuda-memory-fraction [env: CUDA_MEMORY_FRACTION=] [default: 1.0]\n",
|
122 |
+
" \u001B[1m--rope-scaling\u001B[0m <ROPE_SCALING>\n",
|
123 |
" Rope scaling will only be used for RoPE models and allow rescaling the position rotary to accomodate for larger prompts [env: ROPE_SCALING=] [possible values: linear, dynamic]\n",
|
124 |
+
" \u001B[1m--rope-factor\u001B[0m <ROPE_FACTOR>\n",
|
125 |
" Rope scaling will only be used for RoPE models See `rope_scaling` [env: ROPE_FACTOR=]\n",
|
126 |
+
" \u001B[1m--json-output\u001B[0m\n",
|
127 |
" Outputs the logs in JSON format (useful for telemetry) [env: JSON_OUTPUT=]\n",
|
128 |
+
" \u001B[1m--otlp-endpoint\u001B[0m <OTLP_ENDPOINT>\n",
|
129 |
" [env: OTLP_ENDPOINT=]\n",
|
130 |
+
" \u001B[1m--cors-allow-origin\u001B[0m <CORS_ALLOW_ORIGIN>\n",
|
131 |
" [env: CORS_ALLOW_ORIGIN=]\n",
|
132 |
+
" \u001B[1m--watermark-gamma\u001B[0m <WATERMARK_GAMMA>\n",
|
133 |
" [env: WATERMARK_GAMMA=]\n",
|
134 |
+
" \u001B[1m--watermark-delta\u001B[0m <WATERMARK_DELTA>\n",
|
135 |
" [env: WATERMARK_DELTA=]\n",
|
136 |
+
" \u001B[1m--ngrok\u001B[0m\n",
|
137 |
" Enable ngrok tunneling [env: NGROK=]\n",
|
138 |
+
" \u001B[1m--ngrok-authtoken\u001B[0m <NGROK_AUTHTOKEN>\n",
|
139 |
" ngrok authentication token [env: NGROK_AUTHTOKEN=]\n",
|
140 |
+
" \u001B[1m--ngrok-edge\u001B[0m <NGROK_EDGE>\n",
|
141 |
" ngrok edge [env: NGROK_EDGE=]\n",
|
142 |
+
" \u001B[1m--tokenizer-config-path\u001B[0m <TOKENIZER_CONFIG_PATH>\n",
|
143 |
" The path to the tokenizer config file. This path is used to load the tokenizer configuration which may include a `chat_template`. If not provided, the default config will be used from the model hub [env: TOKENIZER_CONFIG_PATH=]\n",
|
144 |
+
" \u001B[1m--disable-grammar-support\u001B[0m\n",
|
145 |
" Disable outlines grammar constrained generation. This is a feature that allows you to generate text that follows a specific grammar [env: DISABLE_GRAMMAR_SUPPORT=]\n",
|
146 |
+
" \u001B[1m-e\u001B[0m, \u001B[1m--env\u001B[0m\n",
|
147 |
" Display a lot of information about your runtime environment\n",
|
148 |
+
" \u001B[1m--max-client-batch-size\u001B[0m <MAX_CLIENT_BATCH_SIZE>\n",
|
149 |
" Control the maximum number of inputs that a client can send in a single request [env: MAX_CLIENT_BATCH_SIZE=] [default: 4]\n",
|
150 |
+
" \u001B[1m-h\u001B[0m, \u001B[1m--help\u001B[0m\n",
|
151 |
" Print help (see more with '--help')\n",
|
152 |
+
" \u001B[1m-V\u001B[0m, \u001B[1m--version\u001B[0m\n",
|
153 |
" Print version\n"
|
154 |
]
|
155 |
}
|
01_2_TGI-benchmark.ipynb
CHANGED
@@ -43,46 +43,46 @@
|
|
43 |
"text": [
|
44 |
"Text Generation Benchmarking tool\n",
|
45 |
"\n",
|
46 |
-
"\
|
47 |
"\n",
|
48 |
-
"\
|
49 |
-
" \
|
50 |
" The name of the tokenizer (as in model_id on the huggingface hub, or local path) [env: TOKENIZER_NAME=]\n",
|
51 |
-
" \
|
52 |
" The revision to use for the tokenizer if on the hub [env: REVISION=] [default: main]\n",
|
53 |
-
" \
|
54 |
" The various batch sizes to benchmark for, the idea is to get enough batching to start seeing increased latency, this usually means you're moving from memory bound (usual as BS=1) to compute bound, and this is a sweet spot for the maximum batch size for the model under test\n",
|
55 |
-
" \
|
56 |
" This is the initial prompt sent to the text-generation-server length in token. Longer prompt will slow down the benchmark. Usually the latency grows somewhat linearly with this for the prefill step [env: SEQUENCE_LENGTH=] [default: 10]\n",
|
57 |
-
" \
|
58 |
" This is how many tokens will be generated by the server and averaged out to give the `decode` latency. This is the *critical* number you want to optimize for LLM spend most of their time doing decoding [env: DECODE_LENGTH=] [default: 8]\n",
|
59 |
-
" \
|
60 |
" How many runs should we average from [env: RUNS=] [default: 10]\n",
|
61 |
-
" \
|
62 |
" Number of warmup cycles [env: WARMUPS=] [default: 1]\n",
|
63 |
-
" \
|
64 |
" The location of the grpc socket. This benchmark tool bypasses the router completely and directly talks to the gRPC processes [env: MASTER_SHARD_UDS_PATH=] [default: /tmp/text-generation-server-0]\n",
|
65 |
-
" \
|
66 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: TEMPERATURE=]\n",
|
67 |
-
" \
|
68 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: TOP_K=]\n",
|
69 |
-
" \
|
70 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: TOP_P=]\n",
|
71 |
-
" \
|
72 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: TYPICAL_P=]\n",
|
73 |
-
" \
|
74 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: REPETITION_PENALTY=]\n",
|
75 |
-
" \
|
76 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: FREQUENCY_PENALTY=]\n",
|
77 |
-
" \
|
78 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: WATERMARK=]\n",
|
79 |
-
" \
|
80 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: DO_SAMPLE=]\n",
|
81 |
-
" \
|
82 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: TOP_N_TOKENS=]\n",
|
83 |
-
" \
|
84 |
" Print help (see more with '--help')\n",
|
85 |
-
" \
|
86 |
" Print version\n"
|
87 |
]
|
88 |
}
|
@@ -96,7 +96,7 @@
|
|
96 |
"id": "42d9561b-1aea-4c8c-9fe8-e36af43482fe",
|
97 |
"metadata": {},
|
98 |
"source": [
|
99 |
-
"Here is an example command. Notice that I add the batch sizes of interest repeatedly to make sure all of them are used by the benchmark tool.\n",
|
100 |
"\n",
|
101 |
"<blockquote style=\"border-left: 5px solid #FFAB91; background: #37474F; color: #FFCCBC; padding: 0.5em 1em; margin: 1em 0;\">\n",
|
102 |
" <strong>⚠️ Warning:</strong> Please note that the TGI Benchmark tool is designed to work in a terminal, not a jupyter notebook. This means you will need to copy/paste the command in a jupyter terminal tab. I am putting them here for convenience.\n",
|
@@ -115,7 +115,9 @@
|
|
115 |
"--batch-size 32 \\\n",
|
116 |
"--batch-size 64 \\\n",
|
117 |
"--batch-size 128 \n",
|
118 |
-
"
|
|
|
|
|
119 |
]
|
120 |
},
|
121 |
{
|
|
|
43 |
"text": [
|
44 |
"Text Generation Benchmarking tool\n",
|
45 |
"\n",
|
46 |
+
"\u001B[1m\u001B[4mUsage:\u001B[0m \u001B[1mtext-generation-benchmark\u001B[0m [OPTIONS] \u001B[1m--tokenizer-name\u001B[0m <TOKENIZER_NAME>\n",
|
47 |
"\n",
|
48 |
+
"\u001B[1m\u001B[4mOptions:\u001B[0m\n",
|
49 |
+
" \u001B[1m-t\u001B[0m, \u001B[1m--tokenizer-name\u001B[0m <TOKENIZER_NAME>\n",
|
50 |
" The name of the tokenizer (as in model_id on the huggingface hub, or local path) [env: TOKENIZER_NAME=]\n",
|
51 |
+
" \u001B[1m--revision\u001B[0m <REVISION>\n",
|
52 |
" The revision to use for the tokenizer if on the hub [env: REVISION=] [default: main]\n",
|
53 |
+
" \u001B[1m-b\u001B[0m, \u001B[1m--batch-size\u001B[0m <BATCH_SIZE>\n",
|
54 |
" The various batch sizes to benchmark for, the idea is to get enough batching to start seeing increased latency, this usually means you're moving from memory bound (usual as BS=1) to compute bound, and this is a sweet spot for the maximum batch size for the model under test\n",
|
55 |
+
" \u001B[1m-s\u001B[0m, \u001B[1m--sequence-length\u001B[0m <SEQUENCE_LENGTH>\n",
|
56 |
" This is the initial prompt sent to the text-generation-server length in token. Longer prompt will slow down the benchmark. Usually the latency grows somewhat linearly with this for the prefill step [env: SEQUENCE_LENGTH=] [default: 10]\n",
|
57 |
+
" \u001B[1m-d\u001B[0m, \u001B[1m--decode-length\u001B[0m <DECODE_LENGTH>\n",
|
58 |
" This is how many tokens will be generated by the server and averaged out to give the `decode` latency. This is the *critical* number you want to optimize for LLM spend most of their time doing decoding [env: DECODE_LENGTH=] [default: 8]\n",
|
59 |
+
" \u001B[1m-r\u001B[0m, \u001B[1m--runs\u001B[0m <RUNS>\n",
|
60 |
" How many runs should we average from [env: RUNS=] [default: 10]\n",
|
61 |
+
" \u001B[1m-w\u001B[0m, \u001B[1m--warmups\u001B[0m <WARMUPS>\n",
|
62 |
" Number of warmup cycles [env: WARMUPS=] [default: 1]\n",
|
63 |
+
" \u001B[1m-m\u001B[0m, \u001B[1m--master-shard-uds-path\u001B[0m <MASTER_SHARD_UDS_PATH>\n",
|
64 |
" The location of the grpc socket. This benchmark tool bypasses the router completely and directly talks to the gRPC processes [env: MASTER_SHARD_UDS_PATH=] [default: /tmp/text-generation-server-0]\n",
|
65 |
+
" \u001B[1m--temperature\u001B[0m <TEMPERATURE>\n",
|
66 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: TEMPERATURE=]\n",
|
67 |
+
" \u001B[1m--top-k\u001B[0m <TOP_K>\n",
|
68 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: TOP_K=]\n",
|
69 |
+
" \u001B[1m--top-p\u001B[0m <TOP_P>\n",
|
70 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: TOP_P=]\n",
|
71 |
+
" \u001B[1m--typical-p\u001B[0m <TYPICAL_P>\n",
|
72 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: TYPICAL_P=]\n",
|
73 |
+
" \u001B[1m--repetition-penalty\u001B[0m <REPETITION_PENALTY>\n",
|
74 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: REPETITION_PENALTY=]\n",
|
75 |
+
" \u001B[1m--frequency-penalty\u001B[0m <FREQUENCY_PENALTY>\n",
|
76 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: FREQUENCY_PENALTY=]\n",
|
77 |
+
" \u001B[1m--watermark\u001B[0m\n",
|
78 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: WATERMARK=]\n",
|
79 |
+
" \u001B[1m--do-sample\u001B[0m\n",
|
80 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: DO_SAMPLE=]\n",
|
81 |
+
" \u001B[1m--top-n-tokens\u001B[0m <TOP_N_TOKENS>\n",
|
82 |
" Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the `text-generation-server` [env: TOP_N_TOKENS=]\n",
|
83 |
+
" \u001B[1m-h\u001B[0m, \u001B[1m--help\u001B[0m\n",
|
84 |
" Print help (see more with '--help')\n",
|
85 |
+
" \u001B[1m-V\u001B[0m, \u001B[1m--version\u001B[0m\n",
|
86 |
" Print version\n"
|
87 |
]
|
88 |
}
|
|
|
96 |
"id": "42d9561b-1aea-4c8c-9fe8-e36af43482fe",
|
97 |
"metadata": {},
|
98 |
"source": [
|
99 |
+
"Here is an example command. Notice that I add the batch sizes of interest repeatedly to make sure all of them are used by the benchmark tool. I'm also considering which batch sizes are important based on estimated user activity.\n",
|
100 |
"\n",
|
101 |
"<blockquote style=\"border-left: 5px solid #FFAB91; background: #37474F; color: #FFCCBC; padding: 0.5em 1em; margin: 1em 0;\">\n",
|
102 |
" <strong>⚠️ Warning:</strong> Please note that the TGI Benchmark tool is designed to work in a terminal, not a jupyter notebook. This means you will need to copy/paste the command in a jupyter terminal tab. I am putting them here for convenience.\n",
|
|
|
115 |
"--batch-size 32 \\\n",
|
116 |
"--batch-size 64 \\\n",
|
117 |
"--batch-size 128 \n",
|
118 |
+
"```\n",
|
119 |
+
"\n",
|
120 |
+
"Hit `q` to stop the tool."
|
121 |
]
|
122 |
},
|
123 |
{
|