ultralytics 8.2.29 new fractional AutoBatch feature (#13446)

Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
Co-authored-by: Burhan <62214284+Burhan-Q@users.noreply.github.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
Glenn Jocher 2024-06-09 00:28:11 +02:00 committed by GitHub
parent 2fe0946376
commit 6a234f3639
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 92 additions and 49 deletions

View file

@ -269,8 +269,13 @@ class BaseTrainer:
self.stride = gs # for multiscale training
# Batch size
if self.batch_size == -1 and RANK == -1: # single-GPU only, estimate best batch size
self.args.batch = self.batch_size = check_train_batch_size(self.model, self.args.imgsz, self.amp)
if self.batch_size < 1 and RANK == -1: # single-GPU only, estimate best batch size
self.args.batch = self.batch_size = check_train_batch_size(
model=self.model,
imgsz=self.args.imgsz,
amp=self.amp,
batch=self.batch_size,
)
# Dataloaders
batch_size = self.batch_size // max(world_size, 1)