Disable FP16 val on AMP fail and improve AMP checks (#16306)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Ultralytics Assistant <135830346+UltralyticsAssistant@users.noreply.github.com>
This commit is contained in:
Mohammed Yasin 2024-09-18 00:44:56 +08:00 committed by GitHub
parent ba438aea5a
commit 6f2bb65953
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View file

@ -110,7 +110,8 @@ class BaseValidator:
if self.training:
self.device = trainer.device
self.data = trainer.data
self.args.half = self.device.type != "cpu" # force FP16 val during training
# force FP16 val during training
self.args.half = self.device.type != "cpu" and self.args.amp
model = trainer.ema.ema or trainer.model
model = model.half() if self.args.half else model.float()
# self.model = model