aitune.torch.task.find_max_batch_size
aitune.torch.task.find_max_batch_size
Find max batch size for a model.
Module Contents
Functions
Data
API
Finds max batch size for Torch Compile as a baseline.
Uses profiling with max throughput strategy to find max batch size.
Note: This function expects user to set profiling_config.max_batch_size to the highest batch size they want to profile.
Parameters:
Model to find max batch size for.
Name of the model.
Graph spec of the model.
Data to profile.
Profiling configuration.
Backend to use for the find max batch size. If not provided, Torch Eager backend will be used.
Device to use for the calculation.
Cache directory to store the backend artifacts.
Profiles a backend to find the batch size that achieves maximum throughput.
Parameters:
Model to calculate maximum throughput for.
Name of the model.
Graph spec of the model.
Data to profile.
Profiling configuration.
Backend to use for the calculation.
Device to use for the calculation.
Returns: tuple[int, float, ProfilingResults]
Tuple containing:
- Batch size with maximum throughput.
- Throughput for the batch size.
- Backend used for the calculation.
- Profiling results.
Gets throughput per batch size.