aitune.torch.tune_strategy.mixin
aitune.torch.tune_strategy.mixin
TuneStrategy-specific mixins.
Mixins should augment strategy configuration or tune lifecycle hooks instead of implementing _tune method.
Submodules
aitune.torch.tune_strategy.mixin.find_max_batch_size_mixinaitune.torch.tune_strategy.mixin.performance_validation_mixin
Package Contents
Classes
API
Bases: TuneStrategy
TuneStrategy mixin that finds max batch size.
Note: Find-max-batch-size is enabled by default and uses TorchEagerBackend as the neutral profiling backend.
Extends tune method to find max batch size.
Enables or disables find max batch size.
Finds max batch size for the module.
Sets default backend class for find max batch size.
Bases: TuneStrategy
TuneStrategy mixin that validates each backend against a TorchEager throughput baseline.
Unless performance validation is disabled, profiles TorchEager during _pre_tune with the strategy profiling config narrowed to the resolved batch size (from graph_spec.get_max_batch_size()) to establish a baseline. For every candidate backend, profiles with the same task-local profiling config and appends a PerformanceValidationMixinResult. In enabled mode, backends with speedup below the configured threshold are rejected. Diagnostic mode records the same results without affecting backend selection.
Note: min_speedup_threshold_percent defaults to 1.0, requiring a measurable 1% speedup in enabled mode. Performance validation is enabled by default.
Return the configured performance validation mode.
Build, correctness-validate, then profile and check throughput against baseline.
Returns the built backend, or None when correctness fails (raise_on_failure=False) or performance check rejects it (speedup below threshold).
Emit an explicit message when the TorchEager baseline is the selected backend.
Emits a speedup line after tuning completes.
Runs pre-tune setup and profiles TorchEager when performance validation is enabled.
Returns the strategy profiling config narrowed to one validation batch size.
Set how eager-baseline performance data affects backend selection.
Parameters:
PerformanceValidationMode | str | bool — ENABLED applies the eager comparison as a selection gate, DIAGNOSTIC records the
comparison without affecting selection, and DISABLED skips eager-baseline profiling.
For compatibility, True maps to ENABLED and False maps to DISABLED.
Throughput and speedup result for a single backend.