Refactor new model.warmup() method (#5810)

* Refactor new `model.warmup()` method

* Add half
This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-11-27 12:29:45 +01:00
1 parent 7c6bae0ae6
commit fcd180d336
3 files changed
+9 -4

No files matched your search

+1 -2
View File
@@ -149,8 +149,7 @@ def run(data,
# Dataloader
if not training:
if pt and device.type != 'cpu':
model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.model.parameters()))) # warmup
model.warmup(imgsz=(1, 3, imgsz, imgsz), half=half) # warmup
pad = 0.0 if task == 'speed' else 0.5
task = task if task in ('train', 'val', 'test') else 'val' # path to train/val/test images
dataloader = create_dataloader(data[task], imgsz, batch_size, stride, single_cls, pad=pad, rect=pt,