guidellm.benchmark.entrypoints
Primary interface for executing and re-importing generative text benchmarks.
This module orchestrates comprehensive benchmarking workflows by coordinating backend initialization, data loading, profile configuration, and output generation. It provides two main entry points: benchmark_generative_text for executing new benchmarks and reimport_benchmarks_report for re-exporting existing results. The resolution functions convert user-provided arguments into fully configured components, handling backend validation, data preprocessing, profile constraints, and output format specifications.
benchmark_generative_text(args, progress=None, console=None, **constraints) async
Execute a comprehensive generative text benchmarking workflow.
Orchestrates the full benchmarking pipeline by resolving all components from provided arguments, executing benchmark runs across configured profiles, and finalizing results in specified output formats. Components include backend initialization, data loading, profile configuration, and output generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args | BenchmarkScenario | Scenario configuration for the benchmark execution | required |
progress | GenerativeConsoleBenchmarkerProgress | None | Progress tracker for benchmark execution, or None for no tracking | None |
console | Console | None | Console instance for status reporting, or None for silent operation | None |
constraints | str | ConstraintInitializer | Any | Additional constraint initializers for benchmark limits | {} |
Returns:
| Type | Description |
|---|---|
tuple[GenerativeBenchmarksReport, list[tuple[str, Any]]] | Tuple of GenerativeBenchmarksReport and dictionary of output format results |
Source code in src/guidellm/benchmark/entrypoints.py
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 | |
reimport_benchmarks_report(file, outputs) async
Load and re-export an existing benchmarks report in specified output formats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file | Path | Path to the existing benchmark report file to load | required |
outputs | tuple[BenchmarkOutputArgs, ...] | list[dict[str, Any]] | Output format kind strings to resolve and finalize | required |
Returns:
| Type | Description |
|---|---|
tuple[GenerativeBenchmarksReport, list[tuple[str, Any]]] | Tuple of loaded GenerativeBenchmarksReport and dictionary of output results |
Source code in src/guidellm/benchmark/entrypoints.py
resolve_backend(backend_args, console=None) async
Initialize and validate a backend instance for benchmarking execution.
Handles backend creation from type identifiers or pre-configured instances, performs startup validation, and resolves the default model if not specified. The backend is shut down after validation to ensure clean state for subsequent benchmark execution.
All backend-specific options (target, model, request_format, etc.) are passed through backend_kwargs. Options with a None value are filtered out so that backends which do not accept a given parameter are not sent unexpected keyword arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
backend | Backend type identifier or pre-configured Backend instance | required | |
console | Console | None | Console instance for progress reporting, or None | None |
backend_kwargs | Keyword arguments passed to backend initialization (e.g. target, model, request_format) | required |
Returns:
| Type | Description |
|---|---|
tuple[Backend, str] | Tuple of initialized Backend instance and resolved model identifier |
Source code in src/guidellm/benchmark/entrypoints.py
resolve_constraints(args, **extra_constraints)
Resolve all constraint sources into a unified constraints dictionary.
Resolves the explicit constraints list from args into a single dict keyed by constraint registry names. Also merges any programmatically provided extra constraints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args | BenchmarkArgs | Benchmark configuration containing constraint fields | required |
extra_constraints | ConstraintInitializer | Any | Additional constraint initializers passed programmatically | {} |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dictionary mapping constraint keys to initializers or raw values |
Source code in src/guidellm/benchmark/entrypoints.py
resolve_item_from_registry(base_type, registry, item, extras=None)
Resolve an item from a registry, instantiating it if necessary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_type | type[BaseTypeT] | The expected base type of the item | required |
item | Any | The item to resolve, either an instance or a string identifier | required |
registry | type[RegistryMixin] | The registry to use for resolving string identifiers | required |
extras | dict[str, Any] | None | Additional keyword arguments to pass during instantiation | None |
Returns:
| Type | Description |
|---|---|
BaseTypeT | The resolved item as an instance of the base type |
Raises:
| Type | Description |
|---|---|
ValueError | If the item cannot be resolved from the registry |
TypeError | If the resolved item is not of the expected base type |
Source code in src/guidellm/benchmark/entrypoints.py
resolve_output_formats(outputs, console=None) async
Resolve output format specifications into configured output handler instances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
outputs | list[BenchmarkOutputArgs] | List of BenchmarkOutputArgs specifying output kind and path | required |
console | Console | None | Console instance for progress reporting, or None | None |
Returns:
| Type | Description |
|---|---|
list[GenerativeBenchmarkerOutput] | Ordered list of configured output handler instances, one per input specification (repeated kinds are preserved as separate entries) |
Source code in src/guidellm/benchmark/entrypoints.py
resolve_profile(profile, constraints, console=None, random_seed=42, **profile_kwargs) async
Resolve and configure a benchmark profile with rate and constraint settings.
Constructs a Profile instance from type identifiers or validates pre-configured profiles.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile | ProfileArgs | Profile | Profile type identifier or pre-configured Profile instance | required |
constraints | dict[str, Any] | None | Pre-resolved constraints dictionary for benchmark limits | required |
console | Console | None | Console instance for progress reporting, or None | None |
random_seed | int | Seed for reproducible random operations in profile strategies | 42 |
profile_kwargs | Any | Additional profile-specific arguments such as data and data_samples, used by some profiles and ignored by others. | {} |
Returns:
| Type | Description |
|---|---|
Profile | Configured Profile instance ready for benchmarking |
Raises:
| Type | Description |
|---|---|
ValueError | If constraints are provided with a pre-configured Profile |
Source code in src/guidellm/benchmark/entrypoints.py
resolve_to_single_benchmark(benchmarks)
Collapse multiple benchmark argument sets into a single instance.
NOTE: This is a temporary workaround to support the new config format with the existing initization flow. This method will be removed once we support arbitrarily overriding any fields in spec (or at least handle supported overrides better).
Temporary adapter that bridges the new multi-benchmark configuration format to the old single-benchmark internal pipeline. All fields must be equal across the provided benchmarks except for recognised list-capable fields (see _PROFILE_RATE_FIELDS and _CONSTRAINT_LIST_FIELDS), which are flattened into a single list.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
benchmarks | list[BenchmarkArgs] | One or more benchmark argument instances to merge | required |
Returns:
| Type | Description |
|---|---|
BenchmarkArgs | A single, merged |
Raises:
| Type | Description |
|---|---|
NotImplementedError | If any non-mergeable field differs across benchmarks |
Source code in src/guidellm/benchmark/entrypoints.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
resolve_tokenizer(args, model, console=None) async
Resolve the tokenization processor, defaulting to model if not provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args | BenchmarkArgs | BenchmarkArgs containing tokenizer configuration | required |
model | str | None | Resolved model identifier from the backend, used as default if tokenizer model is not specified | required |
console | Console | None | Console instance for progress reporting, or None | None |
Returns:
| Type | Description |
|---|---|
None | None (the tokenizer model is set in-place on args.tokenizer) |