Add AutoBatch from YOLOv5 (#145)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
172cef2d20
commit
99275814f1
5 changed files with 144 additions and 4 deletions
|
|
@ -78,7 +78,7 @@ class BaseValidator:
|
|||
self.device = trainer.device
|
||||
self.data = trainer.data
|
||||
model = trainer.ema.ema or trainer.model
|
||||
self.args.half &= self.device.type != 'cpu'
|
||||
self.args.half = self.device.type != 'cpu' # force FP16 val during training
|
||||
model = model.half() if self.args.half else model.float()
|
||||
self.model = model
|
||||
self.loss = torch.zeros_like(trainer.loss_items, device=trainer.device)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue