examples.test_batch_sync¶
Test generate_batch_sync() performance.
View the complete module source at #L1-L105.
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.test_batch_sync
¶
Test generate_batch_sync() performance.
examples.test_batch_sync.main
¶
Source code in examples/test_batch_sync.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.test_batch_sync.main · function
Function main calls print, load, SamplingParams, EngineConfig.
Parameters
This callable has no explicit inputs.
Returns
- Type:
not annotated
Exceptions and behavior
Function main calls print, load, SamplingParams, EngineConfig.
No direct raise statement appears in this definition.
examples.test_batch_sync.main.format_prompt · nested function
Nested Function main.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 main.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.test_batch_sync.main.run_async · nested function
Nested Function main.run_async calls EngineConfig, SchedulerConfig, EngineCore, engine.start; awaits asynchronous work; returns (total_tokens, elapsed).
Parameters
This callable has no explicit inputs.
Returns
- Type:
not annotated - Direct return expressions:
(total_tokens, elapsed)
Exceptions and behavior
Nested Function main.run_async calls EngineConfig, SchedulerConfig, EngineCore, engine.start; awaits asynchronous work; returns (total_tokens, elapsed).
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 |
|---|---|---|---|---|
main |
function | main() -> not annotated |
Function main calls print, load, SamplingParams, EngineConfig. |
#L8-L101 |
main.format_prompt |
nested function | main.format_prompt(p) -> not annotated |
Nested Function main.format_prompt calls tokenizer.apply_chat_template; returns tokenizer.apply_chat_template([{'role': 'user', 'content': p}], tokenize=False, add_generation_prompt=True). |
#L24-L29 |
main.run_async |
nested function | async main.run_async() -> not annotated |
Nested Function main.run_async calls EngineConfig, SchedulerConfig, EngineCore, engine.start; awaits asynchronous work; returns (total_tokens, elapsed). |
#L71-L93 |