batchflow icon indicating copy to clipboard operation
batchflow copied to clipboard

New way of finding optimal batch size

Open BulatVakhitov opened this issue 2 years ago • 0 comments

Now optimal batch_size can be found via running _compute_optimal_batch_size function, which does two steps:

  1. Compute batch_size_estimation. Again It can be done in two ways: 1.1. Via compute_optimal_batch_size function, that solves the system of measured_memory = batch_size * item_size + model_size + eps for item_size and model_size. 1.2. Via _run_power_scaling function, which multiplies start_batch_size with factor until max_memory exceeds or OOM exception.

  2. Compute precise batch_size using _run_binary_scaling, based on batch_size_estimation.

BulatVakhitov avatar Jun 17 '24 14:06 BulatVakhitov