Skip to content

Commit

Permalink
Set lower validation batch size for yolov8 (#1629)
Browse files Browse the repository at this point in the history
* Reducing validation batch size

* updating validator

* set minimum to 1

* style changes

---------

Co-authored-by: Alexandre Marques <alexandre@neuralmagic.com>
  • Loading branch information
abhinavnmagic and anmarques committed Jun 20, 2023
1 parent 30726cc commit a6fdb7f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sparseml/yolov8/trainers.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,15 @@ def _setup_train(self, rank, world_size):
super()._setup_train(rank, world_size)
# NOTE: self.resume_training() was called in ^

if rank in {0, -1}:
self.test_loader = self.get_dataloader(
self.testset,
batch_size=max(1, self.train_loader.batch_size // 4),
rank=-1,
mode="val",
)
self.validator = self.get_validator()

if rank in {0, -1}:
config = dict(self.args)
if self.manager is not None:
Expand Down

0 comments on commit a6fdb7f

Please sign in to comment.