examples.benchmark_all_models¶
Benchmark all text models for README.
View the complete module source at #L1-L148.
API details¶
Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.
examples.benchmark_all_models
¶
Benchmark all text models for README.
examples.benchmark_all_models.benchmark_model
¶
Benchmark a single model and return results.
Source code in examples/benchmark_all_models.py
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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
examples.benchmark_all_models.main
¶
Source code in examples/benchmark_all_models.py
Complete contract reference¶
Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.
examples.benchmark_all_models.benchmark_model · function
Benchmark a single model and return results.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
model_name |
str |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
not annotated - Direct return expressions:
{'model': model_name.split('/')[-1], 'single_tps': single_tps, 'batch_tps': batch_tps, 'speedup': speedup, 'ttft_ms': t…
Exceptions and behavior
Function benchmark_model calls SamplingParams, print, load, format_prompt; returns {'model': model_name.split('/')[-1], 'single_tps': single_tps, 'batch_tps': batch_tps, 'speedup': speedup, 'ttft_ms': t….
No direct raise statement appears in this definition.
examples.benchmark_all_models.benchmark_model.format_prompt · nested function
Nested Function benchmark_model.format_prompt calls tokenizer.apply_chat_template; returns tokenizer.apply_chat_template([{'role': 'user', 'content': p}], tokenize=False, add_generation_prompt=True).
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
p |
not annotated |
yes |
none |
Required positional or keyword input. |
Returns
- Type:
not annotated - Direct return expressions:
tokenizer.apply_chat_template([{'role': 'user', 'content': p}], tokenize=False, add_generation_prompt=True)
Exceptions and behavior
Nested Function benchmark_model.format_prompt calls tokenizer.apply_chat_template; returns tokenizer.apply_chat_template([{'role': 'user', 'content': p}], tokenize=False, add_generation_prompt=True).
No direct raise statement appears in this definition.
examples.benchmark_all_models.main · function
Function main calls benchmark_model, results.append, print, traceback.print_exc.
Parameters
This callable has no explicit inputs.
Returns
- Type:
not annotated
Exceptions and behavior
Function main calls benchmark_model, results.append, print, traceback.print_exc.
No direct raise statement appears in this definition.
Complete symbol map¶
This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.
| Symbol | Kind | Signature and inputs | What it does | Source |
|---|---|---|---|---|
benchmark_model |
function | benchmark_model(model_name: str) -> not annotated |
Benchmark a single model and return results. | #L7-L107 |
benchmark_model.format_prompt |
nested function | benchmark_model.format_prompt(p) -> not annotated |
Nested Function benchmark_model.format_prompt calls tokenizer.apply_chat_template; returns tokenizer.apply_chat_template([{'role': 'user', 'content': p}], tokenize=False, add_generation_prompt=True). |
#L29-L34 |
main |
function | main() -> not annotated |
Function main calls benchmark_model, results.append, print, traceback.print_exc. |
#L110-L144 |