import{s as ht,n as pt,o as ct}from"../chunks/scheduler.1f027d5a.js";import{S as dt,i as ft,e as i,s as o,c as m,h as _t,a as r,d as n,b as s,f as mt,g as u,j as l,k as ut,q as g,l as gt,m as a,n as h,t as p,o as c,p as d}from"../chunks/index.5cb6ce42.js";import{C as bt}from"../chunks/CopyLLMTxtMenu.c64d5249.js";import{D as vt,C as Y}from"../chunks/DocNotebookDropdown.adbd98a5.js";import{H as ze,E as wt}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.903c2670.js";function kt(Ge){let b,te,K,ne,v,ae,w,oe,k,se,T,je='The purpose of this cookbook is to show you how to properly benchmark TGI. For more background details and explanation, please check out this <a href="https://huggingface.co/blog/tgi-benchmarking" rel="nofollow">popular blog</a> first.',ie,y,re,x,De='Make sure you have an environment with TGI installed; docker is a great choice.The commands here can be easily copied/pasted into a terminal, which might be even easier. Don’t feel compelled to use Jupyter. If you just want to test this out, you can duplicate and use <a href="https://huggingface.co/spaces/derek-thomas/tgi-benchmark-space" rel="nofollow">derek-thomas/tgi-benchmark-space</a>.',le,E,me,C,ue,N,He=`text-generation-launcher 2.2.1-dev0
`,he,M,Be=`Below we can see the different settings for TGI. Be sure to read through them and decide which settings are most
important for your use-case.`,pe,A,Fe="Here are some of the most important ones:",ce,$,Qe="<li><code>--model-id</code></li> <li><code>--quantize</code> Quantization saves memory, but does not always improve speed</li> <li><code>--max-input-tokens</code> This allows TGI to optimize the prefilling operation</li> <li><code>--max-total-tokens</code> In combination with the above TGI now knows what the max input and output tokens are</li> <li><code>--max-batch-size</code> This lets TGI know how many requests it can process at once.</li>",de,I,We="The last 3 together provide the necessary restrictions to optimize for your use-case. You can find a lot of performance improvements by setting these as appropriately as possible.",fe,S,_e,U,Ze=`Text Generation Launcher

\x1B[1m\x1B[4mUsage:\x1B[0m \x1B[1mtext-generation-launcher\x1B[0m [OPTIONS]

\x1B[1m\x1B[4mOptions:\x1B[0m
      \x1B[1m--model-id\x1B[0m <model_id>
          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]
      \x1B[1m--revision\x1B[0m <revision>
          The actual revision of the model if you&#39;re referring to a model on the hub. You can use a specific commit id or a branch like \`refs/pr/2\` [env: REVISION=]
      \x1B[1m--validation-workers\x1B[0m <validation_workers>
          The number of tokenizer workers used for payload validation and truncation inside the router [env: VALIDATION_WORKERS=] [default: 2]
      \x1B[1m--sharded\x1B[0m <sharded>
          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]
      \x1B[1m--num-shard\x1B[0m <num_shard>
          The number of shards to use if you don&#39;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=]
      \x1B[1m--quantize\x1B[0m <quantize>
          Whether you want the model to be quantized [env: QUANTIZE=] [possible values: awq, eetq, exl2, gptq, marlin, bitsandbytes, bitsandbytes-nf4, bitsandbytes-fp4, fp8]
      \x1B[1m--speculate\x1B[0m <speculate>
          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=]
      \x1B[1m--dtype\x1B[0m <dtype>
          The dtype to be forced upon the model. This option cannot be used with \`--quantize\` [env: DTYPE=] [possible values: float16, bfloat16]
      \x1B[1m--trust-remote-code\x1B[0m
          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=]
      \x1B[1m--max-concurrent-requests\x1B[0m <max_concurrent_requests>
          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]
      \x1B[1m--max-best-of\x1B[0m <max_best_of>
          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]
      \x1B[1m--max-stop-sequences\x1B[0m <max_stop_sequences>
          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 &quot;prompting&quot; where users can preprompt the model in a specific way and define their &quot;own&quot; stop token aligned with their prompt [env: MAX_STOP_SEQUENCES=] [default: 4]
      \x1B[1m--max-top-n-tokens\x1B[0m <max_top_n_tokens>
          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]
      \x1B[1m--max-input-tokens\x1B[0m <max_input_tokens>
          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=]
      \x1B[1m--max-input-length\x1B[0m <max_input_length>
          Legacy version of [\`Args::max_input_tokens\`] [env: MAX_INPUT_LENGTH=]
      \x1B[1m--max-total-tokens\x1B[0m <max_total_tokens>
          This is the most important value to set as it defines the &quot;memory budget&quot; 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=]
      \x1B[1m--waiting-served-ratio\x1B[0m <waiting_served_ratio>
          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&#39;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: 0.3]
      \x1B[1m--max-batch-prefill-tokens\x1B[0m <max_batch_prefill_tokens>
          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=]
      \x1B[1m--max-batch-total-tokens\x1B[0m <max_batch_total_tokens>
          **IMPORTANT** This is one critical control to allow maximum usage of the available hardware [env: MAX_BATCH_TOTAL_TOKENS=]
      \x1B[1m--max-waiting-tokens\x1B[0m <max_waiting_tokens>
          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]
      \x1B[1m--max-batch-size\x1B[0m <max_batch_size>
          Enforce a maximum number of requests per batch Specific flag for hardware targets that do not support unpadded inference [env: MAX_BATCH_SIZE=]
      \x1B[1m--cuda-graphs\x1B[0m <cuda_graphs>
          Specify the batch sizes to compute cuda graphs for. Use &quot;0&quot; to disable. Default = &quot;1,2,4,8,16,32&quot; [env: CUDA_GRAPHS=]
      \x1B[1m--hostname\x1B[0m <hostname>
          The IP address to listen on [env: HOSTNAME=r-derek-thomas-tgi-benchmark-space-geij6846-b385a-lont4] [default: 0.0.0.0]
  \x1B[1m-p\x1B[0m, \x1B[1m--port\x1B[0m <port>
          The port to listen on [env: PORT=80] [default: 3000]
      \x1B[1m--shard-uds-path\x1B[0m <shard_uds_path>
          The name of the socket for gRPC communication between the webserver and the shards [env: SHARD_UDS_PATH=] [default: /tmp/text-generation-server]
      \x1B[1m--master-addr\x1B[0m <master_addr>
          The address the master shard will listen on. (setting used by torch distributed) [env: MASTER_ADDR=] [default: localhost]
      \x1B[1m--master-port\x1B[0m <master_port>
          The address the master port will listen on. (setting used by torch distributed) [env: MASTER_PORT=] [default: 29500]
      \x1B[1m--huggingface-hub-cache\x1B[0m <huggingface_hub_cache>
          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=]
      \x1B[1m--weights-cache-override\x1B[0m <weights_cache_override>
          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=]
      \x1B[1m--disable-custom-kernels\x1B[0m
          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&#39;re running on different hardware and encounter issues [env: DISABLE_CUSTOM_KERNELS=]
      \x1B[1m--cuda-memory-fraction\x1B[0m <cuda_memory_fraction>
          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]
      \x1B[1m--rope-scaling\x1B[0m <rope_scaling>
          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]
      \x1B[1m--rope-factor\x1B[0m <rope_factor>
          Rope scaling will only be used for RoPE models See \`rope_scaling\` [env: ROPE_FACTOR=]
      \x1B[1m--json-output\x1B[0m
          Outputs the logs in JSON format (useful for telemetry) [env: JSON_OUTPUT=]
      \x1B[1m--otlp-endpoint\x1B[0m <otlp_endpoint>
          [env: OTLP_ENDPOINT=]
      \x1B[1m--otlp-service-name\x1B[0m <otlp_service_name>
          [env: OTLP_SERVICE_NAME=] [default: text-generation-inference.router]
      \x1B[1m--cors-allow-origin\x1B[0m <cors_allow_origin>
          [env: CORS_ALLOW_ORIGIN=]
      \x1B[1m--api-key\x1B[0m <api_key>
          [env: API_KEY=]
      \x1B[1m--watermark-gamma\x1B[0m <watermark_gamma>
          [env: WATERMARK_GAMMA=]
      \x1B[1m--watermark-delta\x1B[0m <watermark_delta>
          [env: WATERMARK_DELTA=]
      \x1B[1m--ngrok\x1B[0m
          Enable ngrok tunneling [env: NGROK=]
      \x1B[1m--ngrok-authtoken\x1B[0m <ngrok_authtoken>
          ngrok authentication token [env: NGROK_AUTHTOKEN=]
      \x1B[1m--ngrok-edge\x1B[0m <ngrok_edge>
          ngrok edge [env: NGROK_EDGE=]
      \x1B[1m--tokenizer-config-path\x1B[0m <tokenizer_config_path>
          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=]
      \x1B[1m--disable-grammar-support\x1B[0m
          Disable outlines grammar constrained generation. This is a feature that allows you to generate text that follows a specific grammar [env: DISABLE_GRAMMAR_SUPPORT=]
  \x1B[1m-e\x1B[0m, \x1B[1m--env\x1B[0m
          Display a lot of information about your runtime environment
      \x1B[1m--max-client-batch-size\x1B[0m <max_client_batch_size>
          Control the maximum number of inputs that a client can send in a single request [env: MAX_CLIENT_BATCH_SIZE=] [default: 4]
      \x1B[1m--lora-adapters\x1B[0m <lora_adapters>
          Lora Adapters a list of adapter ids i.e. \`repo/adapter1,repo/adapter2\` to load during startup that will be available to callers via the \`adapter_id\` field in a request [env: LORA_ADAPTERS=]
      \x1B[1m--usage-stats\x1B[0m <usage_stats>
          Control if anonymous usage stats are collected. Options are &quot;on&quot;, &quot;off&quot; and &quot;no-stack&quot; Defaul is on [env: USAGE_STATS=] [default: on] [possible values: on, off, no-stack]
  \x1B[1m-h\x1B[0m, \x1B[1m--help\x1B[0m
          Print help (see more with &#39;--help&#39;)
  \x1B[1m-V\x1B[0m, \x1B[1m--version\x1B[0m
          Print version
</usage_stats></lora_adapters></max_client_batch_size></tokenizer_config_path></ngrok_edge></ngrok_authtoken></watermark_delta></watermark_gamma></api_key></cors_allow_origin></otlp_service_name></otlp_endpoint></rope_factor></rope_scaling></cuda_memory_fraction></weights_cache_override></huggingface_hub_cache></master_port></master_addr></shard_uds_path></port></hostname></cuda_graphs></max_batch_size></max_waiting_tokens></max_batch_total_tokens></max_batch_prefill_tokens></waiting_served_ratio></max_total_tokens></max_input_length></max_input_tokens></max_top_n_tokens></max_stop_sequences></max_best_of></max_concurrent_requests></dtype></speculate></quantize></num_shard></sharded></validation_workers></revision></https:></model_id>`,ge,R,Xe="We can launch directly from the cookbook since we dont need the command to be interactive.",be,O,Ve="We will just be using defaults in this cookbook as the intent is to understand the benchmark tool.",ve,L,Je="These parameters were changed if you’re running on a Space because we don’t want to conflict with the Spaces server:",we,q,Ye="<li><code>--hostname</code></li> <li><code>--port</code></li>",ke,P,Ke="Feel free to change or remove them based on your requirements.",Te,z,ye,G,et=`\x1B[2m2024-08-16T12:07:56.411768Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[2mtext_generation_launcher\x1B[0m\x1B[2m:\x1B[0m Args &#123;
    model_id: "astronomer/Llama-3-8B-Instruct-GPTQ-8-Bit",
    revision: None,
    validation_workers: 2,
    sharded: None,
    num_shard: None,
    quantize: Some(
        Gptq,
    ),
    speculate: None,
    dtype: None,
    trust_remote_code: false,
    max_concurrent_requests: 128,
    max_best_of: 2,
    max_stop_sequences: 4,
    max_top_n_tokens: 5,
    max_input_tokens: None,
    max_input_length: None,
    max_total_tokens: None,
    waiting_served_ratio: 0.3,
    max_batch_prefill_tokens: None,
    max_batch_total_tokens: None,
    max_waiting_tokens: 20,
    max_batch_size: None,
    cuda_graphs: None,
    hostname: "0.0.0.0",
    port: 1337,
    shard_uds_path: "/tmp/text-generation-server",
    master_addr: "localhost",
    master_port: 29500,
    huggingface_hub_cache: None,
    weights_cache_override: None,
    disable_custom_kernels: false,
    cuda_memory_fraction: 1.0,
    rope_scaling: None,
    rope_factor: None,
    json_output: false,
    otlp_endpoint: None,
    otlp_service_name: "text-generation-inference.router",
    cors_allow_origin: [],
    api_key: None,
    watermark_gamma: None,
    watermark_delta: None,
    ngrok: false,
    ngrok_authtoken: None,
    ngrok_edge: None,
    tokenizer_config_path: None,
    disable_grammar_support: false,
    env: false,
    max_client_batch_size: 4,
    lora_adapters: None,
    usage_stats: On,
}
\x1B[2m2024-08-16T12:07:56.411941Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[2mhf_hub\x1B[0m\x1B[2m:\x1B[0m Token file not found "/data/token"    
\x1B[2Kconfig.json [00:00:00] [████████████████████████] 1021 B/1021 B 50.70 KiB/s (0s)\x1B[2m2024-08-16T12:07:56.458451Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[2mtext_generation_launcher\x1B[0m\x1B[2m:\x1B[0m Model supports up to 8192 but tgi will now set its default to 4096 instead. This is to save VRAM by refusing large prompts in order to allow more users on the same hardware. You can increase that size using \`--max-batch-prefill-tokens=8242 --max-total-tokens=8192 --max-input-tokens=8191\`.
\x1B[2m2024-08-16T12:07:56.458473Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[2mtext_generation_launcher\x1B[0m\x1B[2m:\x1B[0m Default \`max_input_tokens\` to 4095
\x1B[2m2024-08-16T12:07:56.458480Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[2mtext_generation_launcher\x1B[0m\x1B[2m:\x1B[0m Default \`max_total_tokens\` to 4096
\x1B[2m2024-08-16T12:07:56.458487Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[2mtext_generation_launcher\x1B[0m\x1B[2m:\x1B[0m Default \`max_batch_prefill_tokens\` to 4145
\x1B[2m2024-08-16T12:07:56.458494Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[2mtext_generation_launcher\x1B[0m\x1B[2m:\x1B[0m Using default cuda graphs [1, 2, 4, 8, 16, 32]
\x1B[2m2024-08-16T12:07:56.458606Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[1mdownload\x1B[0m: \x1B[2mtext_generation_launcher\x1B[0m\x1B[2m:\x1B[0m Starting check and download process for astronomer/Llama-3-8B-Instruct-GPTQ-8-Bit
\x1B[2m2024-08-16T12:07:59.750101Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[2mtext_generation_launcher\x1B[0m\x1B[2m:\x1B[0m Download file: model.safetensors
^C
\x1B[2m2024-08-16T12:08:09.101893Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[1mdownload\x1B[0m: \x1B[2mtext_generation_launcher\x1B[0m\x1B[2m:\x1B[0m Terminating download
\x1B[2m2024-08-16T12:08:09.102368Z\x1B[0m \x1B[32m INFO\x1B[0m \x1B[1mdownload\x1B[0m: \x1B[2mtext_generation_launcher\x1B[0m\x1B[2m:\x1B[0m Waiting for download to gracefully shutdown
`,xe,j,Ee,D,tt="Now lets learn how to launch the benchmark tool!",Ce,H,nt="Here we can see the different settings for TGI Benchmark.",Ne,B,at="Here are some of the more important TGI Benchmark settings:",Me,F,ot="<li><code>--tokenizer-name</code> This is required so the tool knows what tokenizer to use</li> <li><code>--batch-size</code> This is important for load testing. We should use enough values to see what happens to throughput and latency. Do note that batch-size in the context of the benchmarking tool is number of virtual users.</li> <li><code>--sequence-length</code> AKA input tokens, it is important to match your use-case needs</li> <li><code>--decode-length</code> AKA output tokens, it is important to match your use-case needs</li> <li><code>--runs</code> 10 is the default</li>",Ae,f,st='<strong>💡 Tip:</strong> Use a low number for <code style="background: #37474F; color: #FFFFFF; padding: 2px 4px; border-radius: 4px;">--runs</code> when you are exploring but a higher number as you finalize to get more precise statistics',$e,Q,Ie,W,it=`Text Generation Benchmarking tool

\x1B[1m\x1B[4mUsage:\x1B[0m \x1B[1mtext-generation-benchmark\x1B[0m [OPTIONS] \x1B[1m--tokenizer-name\x1B[0m <tokenizer_name>

\x1B[1m\x1B[4mOptions:\x1B[0m
  \x1B[1m-t\x1B[0m, \x1B[1m--tokenizer-name\x1B[0m <tokenizer_name>
          The name of the tokenizer (as in model_id on the huggingface hub, or local path) [env: TOKENIZER_NAME=]
      \x1B[1m--revision\x1B[0m <revision>
          The revision to use for the tokenizer if on the hub [env: REVISION=] [default: main]
  \x1B[1m-b\x1B[0m, \x1B[1m--batch-size\x1B[0m <batch_size>
          The various batch sizes to benchmark for, the idea is to get enough batching to start seeing increased latency, this usually means you&#39;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
  \x1B[1m-s\x1B[0m, \x1B[1m--sequence-length\x1B[0m <sequence_length>
          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]
  \x1B[1m-d\x1B[0m, \x1B[1m--decode-length\x1B[0m <decode_length>
          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]
  \x1B[1m-r\x1B[0m, \x1B[1m--runs\x1B[0m <runs>
          How many runs should we average from [env: RUNS=] [default: 10]
  \x1B[1m-w\x1B[0m, \x1B[1m--warmups\x1B[0m <warmups>
          Number of warmup cycles [env: WARMUPS=] [default: 1]
  \x1B[1m-m\x1B[0m, \x1B[1m--master-shard-uds-path\x1B[0m <master_shard_uds_path>
          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]
      \x1B[1m--temperature\x1B[0m <temperature>
          Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the \`text-generation-server\` [env: TEMPERATURE=]
      \x1B[1m--top-k\x1B[0m <top_k>
          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=]
      \x1B[1m--top-p\x1B[0m <top_p>
          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=]
      \x1B[1m--typical-p\x1B[0m <typical_p>
          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=]
      \x1B[1m--repetition-penalty\x1B[0m <repetition_penalty>
          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=]
      \x1B[1m--frequency-penalty\x1B[0m <frequency_penalty>
          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=]
      \x1B[1m--watermark\x1B[0m
          Generation parameter in case you want to specifically test/debug particular decoding strategies, for full doc refer to the \`text-generation-server\` [env: WATERMARK=]
      \x1B[1m--do-sample\x1B[0m
          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=]
      \x1B[1m--top-n-tokens\x1B[0m <top_n_tokens>
          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=]
  \x1B[1m-h\x1B[0m, \x1B[1m--help\x1B[0m
          Print help (see more with &#39;--help&#39;)
  \x1B[1m-V\x1B[0m, \x1B[1m--version\x1B[0m
          Print version
</top_n_tokens></frequency_penalty></repetition_penalty></typical_p></top_p></top_k></temperature></master_shard_uds_path></warmups></runs></decode_length></sequence_length></batch_size></revision></tokenizer_name></tokenizer_name>`,Se,Z,rt=`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.`,Ue,_,lt="<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 it here for convenience.",Re,X,Oe,V,Le,J,qe,ee,Pe;return v=new vt({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/cookbook/blob/main/notebooks/en/benchmarking_tgi.ipynb"}]}}),w=new bt({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),k=new ze({props:{title:"Introduction",local:"introduction",headingTag:"h1"}}),y=new ze({props:{title:"Setup",local:"setup",headingTag:"h2"}}),E=new ze({props:{title:"TGI Launcher",local:"tgi-launcher",headingTag:"h1"}}),C=new Y({props:{code:"IXRleHQtZ2VuZXJhdGlvbi1sYXVuY2hlciUyMC0tdmVyc2lvbg==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>!text-generation-launcher --version',wrap:!1}}),S=new Y({props:{code:"IXRleHQtZ2VuZXJhdGlvbi1sYXVuY2hlciUyMC1o",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>!text-generation-launcher -h',wrap:!1}}),z=new Y({props:{code:"IVJVU1RfQkFDS1RSQUNFJTNEMSUyMCU1QyUwQXRleHQtZ2VuZXJhdGlvbi1sYXVuY2hlciUyMCU1QyUwQS0tbW9kZWwtaWQlMjBhc3Ryb25vbWVyJTJGTGxhbWEtMy04Qi1JbnN0cnVjdC1HUFRRLTgtQml0JTIwJTVDJTBBLS1xdWFudGl6ZSUyMGdwdHElMjAlNUMlMEEtLWhvc3RuYW1lJTIwMC4wLjAuMCUyMCU1QyUwQS0tcG9ydCUyMDEzMzc=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>!RUST_BACKTRACE=<span class="hljs-number">1</span> \\
<span class="hljs-meta">&gt;&gt;&gt; </span>text-generation-launcher \\
<span class="hljs-meta">&gt;&gt;&gt; </span>--model-<span class="hljs-built_in">id</span> astronomer/Llama-<span class="hljs-number">3</span>-8B-Instruct-GPTQ-<span class="hljs-number">8</span>-Bit \\
<span class="hljs-meta">&gt;&gt;&gt; </span>--quantize gptq \\
<span class="hljs-meta">&gt;&gt;&gt; </span>--hostname <span class="hljs-number">0.0</span><span class="hljs-number">.0</span><span class="hljs-number">.0</span> \\
<span class="hljs-meta">&gt;&gt;&gt; </span>--port <span class="hljs-number">1337</span>`,wrap:!1}}),j=new ze({props:{title:"TGI Benchmark",local:"tgi-benchmark",headingTag:"h1"}}),Q=new Y({props:{code:"IXRleHQtZ2VuZXJhdGlvbi1iZW5jaG1hcmslMjAtaA==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>!text-generation-benchmark -h',wrap:!1}}),X=new Y({props:{code:"IXRleHQtZ2VuZXJhdGlvbi1iZW5jaG1hcmslMjAlNUMlMEEtLXRva2VuaXplci1uYW1lJTIwYXN0cm9ub21lciUyRkxsYW1hLTMtOEItSW5zdHJ1Y3QtR1BUUS04LUJpdCUyMCU1QyUwQS0tc2VxdWVuY2UtbGVuZ3RoJTIwNzAlMjAlNUMlMEEtLWRlY29kZS1sZW5ndGglMjA1MCUyMCU1QyUwQS0tYmF0Y2gtc2l6ZSUyMDElMjAlNUMlMEEtLWJhdGNoLXNpemUlMjAyJTIwJTVDJTBBLS1iYXRjaC1zaXplJTIwNCUyMCU1QyUwQS0tYmF0Y2gtc2l6ZSUyMDglMjAlNUMlMEEtLWJhdGNoLXNpemUlMjAxNiUyMCU1QyUwQS0tYmF0Y2gtc2l6ZSUyMDMyJTIwJTVDJTBBLS1iYXRjaC1zaXplJTIwNjQlMjAlNUMlMEEtLWJhdGNoLXNpemUlMjAxMjg=",highlighted:`!text-generation-benchmark \\
--tokenizer-name astronomer/Llama-<span class="hljs-number">3</span>-8B-Instruct-GPTQ-<span class="hljs-number">8</span>-Bit \\
--sequence-length <span class="hljs-number">70</span> \\
--decode-length <span class="hljs-number">50</span> \\
--batch-size <span class="hljs-number">1</span> \\
--batch-size <span class="hljs-number">2</span> \\
--batch-size <span class="hljs-number">4</span> \\
--batch-size <span class="hljs-number">8</span> \\
--batch-size <span class="hljs-number">16</span> \\
--batch-size <span class="hljs-number">32</span> \\
--batch-size <span class="hljs-number">64</span> \\
--batch-size <span class="hljs-number">128</span>`,wrap:!1}}),V=new Y({props:{code:"",highlighted:"",wrap:!1}}),J=new wt({props:{source:"https://github.com/huggingface/cookbook/blob/main/notebooks/en/benchmarking_tgi.md"}}),{c(){b=i("meta"),te=o(),K=i("p"),ne=o(),m(v.$$.fragment),ae=o(),m(w.$$.fragment),oe=o(),m(k.$$.fragment),se=o(),T=i("p"),T.innerHTML=je,ie=o(),m(y.$$.fragment),re=o(),x=i("p"),x.innerHTML=De,le=o(),m(E.$$.fragment),me=o(),m(C.$$.fragment),ue=o(),N=i("pre"),N.textContent=He,he=o(),M=i("p"),M.textContent=Be,pe=o(),A=i("p"),A.textContent=Fe,ce=o(),$=i("ul"),$.innerHTML=Qe,de=o(),I=i("p"),I.textContent=We,fe=o(),m(S.$$.fragment),_e=o(),U=i("pre"),U.innerHTML=Ze,ge=o(),R=i("p"),R.textContent=Xe,be=o(),O=i("p"),O.textContent=Ve,ve=o(),L=i("p"),L.textContent=Je,we=o(),q=i("ul"),q.innerHTML=Ye,ke=o(),P=i("p"),P.textContent=Ke,Te=o(),m(z.$$.fragment),ye=o(),G=i("pre"),G.textContent=et,xe=o(),m(j.$$.fragment),Ee=o(),D=i("p"),D.textContent=tt,Ce=o(),H=i("p"),H.textContent=nt,Ne=o(),B=i("p"),B.textContent=at,Me=o(),F=i("ul"),F.innerHTML=ot,Ae=o(),f=i("blockquote"),f.innerHTML=st,$e=o(),m(Q.$$.fragment),Ie=o(),W=i("pre"),W.innerHTML=it,Se=o(),Z=i("p"),Z.textContent=rt,Ue=o(),_=i("blockquote"),_.innerHTML=lt,Re=o(),m(X.$$.fragment),Oe=o(),m(V.$$.fragment),Le=o(),m(J.$$.fragment),qe=o(),ee=i("p"),this.h()},l(e){const t=_t("svelte-u9bgzb",document.head);b=r(t,"META",{name:!0,content:!0}),t.forEach(n),te=s(e),K=r(e,"P",{}),mt(K).forEach(n),ne=s(e),u(v.$$.fragment,e),ae=s(e),u(w.$$.fragment,e),oe=s(e),u(k.$$.fragment,e),se=s(e),T=r(e,"P",{"data-svelte-h":!0}),l(T)!=="svelte-nucsba"&&(T.innerHTML=je),ie=s(e),u(y.$$.fragment,e),re=s(e),x=r(e,"P",{"data-svelte-h":!0}),l(x)!=="svelte-nftsjc"&&(x.innerHTML=De),le=s(e),u(E.$$.fragment,e),me=s(e),u(C.$$.fragment,e),ue=s(e),N=r(e,"PRE",{"data-svelte-h":!0}),l(N)!=="svelte-5uago"&&(N.textContent=He),he=s(e),M=r(e,"P",{"data-svelte-h":!0}),l(M)!=="svelte-jmdefs"&&(M.textContent=Be),pe=s(e),A=r(e,"P",{"data-svelte-h":!0}),l(A)!=="svelte-1cwpzmi"&&(A.textContent=Fe),ce=s(e),$=r(e,"UL",{"data-svelte-h":!0}),l($)!=="svelte-7i4ofj"&&($.innerHTML=Qe),de=s(e),I=r(e,"P",{"data-svelte-h":!0}),l(I)!=="svelte-8xql59"&&(I.textContent=We),fe=s(e),u(S.$$.fragment,e),_e=s(e),U=r(e,"PRE",{"data-svelte-h":!0}),l(U)!=="svelte-1sc2cl"&&(U.innerHTML=Ze),ge=s(e),R=r(e,"P",{"data-svelte-h":!0}),l(R)!=="svelte-1mkybh2"&&(R.textContent=Xe),be=s(e),O=r(e,"P",{"data-svelte-h":!0}),l(O)!=="svelte-3z4i6r"&&(O.textContent=Ve),ve=s(e),L=r(e,"P",{"data-svelte-h":!0}),l(L)!=="svelte-1eo01oh"&&(L.textContent=Je),we=s(e),q=r(e,"UL",{"data-svelte-h":!0}),l(q)!=="svelte-1ko3p04"&&(q.innerHTML=Ye),ke=s(e),P=r(e,"P",{"data-svelte-h":!0}),l(P)!=="svelte-pyza93"&&(P.textContent=Ke),Te=s(e),u(z.$$.fragment,e),ye=s(e),G=r(e,"PRE",{"data-svelte-h":!0}),l(G)!=="svelte-50c5je"&&(G.textContent=et),xe=s(e),u(j.$$.fragment,e),Ee=s(e),D=r(e,"P",{"data-svelte-h":!0}),l(D)!=="svelte-wheavt"&&(D.textContent=tt),Ce=s(e),H=r(e,"P",{"data-svelte-h":!0}),l(H)!=="svelte-1s51ipk"&&(H.textContent=nt),Ne=s(e),B=r(e,"P",{"data-svelte-h":!0}),l(B)!=="svelte-1k0og9v"&&(B.textContent=at),Me=s(e),F=r(e,"UL",{"data-svelte-h":!0}),l(F)!=="svelte-2ravvu"&&(F.innerHTML=ot),Ae=s(e),f=r(e,"BLOCKQUOTE",{style:!0,"data-svelte-h":!0}),l(f)!=="svelte-d9qhv8"&&(f.innerHTML=st),$e=s(e),u(Q.$$.fragment,e),Ie=s(e),W=r(e,"PRE",{"data-svelte-h":!0}),l(W)!=="svelte-1nepnpv"&&(W.innerHTML=it),Se=s(e),Z=r(e,"P",{"data-svelte-h":!0}),l(Z)!=="svelte-1i0gw82"&&(Z.textContent=rt),Ue=s(e),_=r(e,"BLOCKQUOTE",{style:!0,"data-svelte-h":!0}),l(_)!=="svelte-1pfuh6s"&&(_.innerHTML=lt),Re=s(e),u(X.$$.fragment,e),Oe=s(e),u(V.$$.fragment,e),Le=s(e),u(J.$$.fragment,e),qe=s(e),ee=r(e,"P",{}),mt(ee).forEach(n),this.h()},h(){ut(b,"name","hf:doc:metadata"),ut(b,"content",Tt),g(f,"border-left","5px solid #80CBC4"),g(f,"background","#263238"),g(f,"color","#CFD8DC"),g(f,"padding","0.5em 1em"),g(f,"margin","1em 0"),g(_,"border-left","5px solid #FFAB91"),g(_,"background","#37474F"),g(_,"color","#FFCCBC"),g(_,"padding","0.5em 1em"),g(_,"margin","1em 0")},m(e,t){gt(document.head,b),a(e,te,t),a(e,K,t),a(e,ne,t),h(v,e,t),a(e,ae,t),h(w,e,t),a(e,oe,t),h(k,e,t),a(e,se,t),a(e,T,t),a(e,ie,t),h(y,e,t),a(e,re,t),a(e,x,t),a(e,le,t),h(E,e,t),a(e,me,t),h(C,e,t),a(e,ue,t),a(e,N,t),a(e,he,t),a(e,M,t),a(e,pe,t),a(e,A,t),a(e,ce,t),a(e,$,t),a(e,de,t),a(e,I,t),a(e,fe,t),h(S,e,t),a(e,_e,t),a(e,U,t),a(e,ge,t),a(e,R,t),a(e,be,t),a(e,O,t),a(e,ve,t),a(e,L,t),a(e,we,t),a(e,q,t),a(e,ke,t),a(e,P,t),a(e,Te,t),h(z,e,t),a(e,ye,t),a(e,G,t),a(e,xe,t),h(j,e,t),a(e,Ee,t),a(e,D,t),a(e,Ce,t),a(e,H,t),a(e,Ne,t),a(e,B,t),a(e,Me,t),a(e,F,t),a(e,Ae,t),a(e,f,t),a(e,$e,t),h(Q,e,t),a(e,Ie,t),a(e,W,t),a(e,Se,t),a(e,Z,t),a(e,Ue,t),a(e,_,t),a(e,Re,t),h(X,e,t),a(e,Oe,t),h(V,e,t),a(e,Le,t),h(J,e,t),a(e,qe,t),a(e,ee,t),Pe=!0},p:pt,i(e){Pe||(p(v.$$.fragment,e),p(w.$$.fragment,e),p(k.$$.fragment,e),p(y.$$.fragment,e),p(E.$$.fragment,e),p(C.$$.fragment,e),p(S.$$.fragment,e),p(z.$$.fragment,e),p(j.$$.fragment,e),p(Q.$$.fragment,e),p(X.$$.fragment,e),p(V.$$.fragment,e),p(J.$$.fragment,e),Pe=!0)},o(e){c(v.$$.fragment,e),c(w.$$.fragment,e),c(k.$$.fragment,e),c(y.$$.fragment,e),c(E.$$.fragment,e),c(C.$$.fragment,e),c(S.$$.fragment,e),c(z.$$.fragment,e),c(j.$$.fragment,e),c(Q.$$.fragment,e),c(X.$$.fragment,e),c(V.$$.fragment,e),c(J.$$.fragment,e),Pe=!1},d(e){e&&(n(te),n(K),n(ne),n(ae),n(oe),n(se),n(T),n(ie),n(re),n(x),n(le),n(me),n(ue),n(N),n(he),n(M),n(pe),n(A),n(ce),n($),n(de),n(I),n(fe),n(_e),n(U),n(ge),n(R),n(be),n(O),n(ve),n(L),n(we),n(q),n(ke),n(P),n(Te),n(ye),n(G),n(xe),n(Ee),n(D),n(Ce),n(H),n(Ne),n(B),n(Me),n(F),n(Ae),n(f),n($e),n(Ie),n(W),n(Se),n(Z),n(Ue),n(_),n(Re),n(Oe),n(Le),n(qe),n(ee)),n(b),d(v,e),d(w,e),d(k,e),d(y,e),d(E,e),d(C,e),d(S,e),d(z,e),d(j,e),d(Q,e),d(X,e),d(V,e),d(J,e)}}}const Tt='{"title":"Introduction","local":"introduction","sections":[{"title":"Setup","local":"setup","sections":[],"depth":2}],"depth":1}';function yt(Ge){return ct(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class At extends dt{constructor(b){super(),ft(this,b,yt,kt,ht,{})}}export{At as component};
