Unverified 提交 3c64d891 authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

AutoBatch protect from extreme batch sizes (#9209)

If < 1 or > 1024 set output to default batch size 16. May partially address https://github.com/ultralytics/yolov5/issues/9156Signed-off-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com> Signed-off-by: 's avatarGlenn Jocher <glenn.jocher@ultralytics.com>
上级 da22e01a
...@@ -60,8 +60,8 @@ def autobatch(model, imgsz=640, fraction=0.9, batch_size=16): ...@@ -60,8 +60,8 @@ def autobatch(model, imgsz=640, fraction=0.9, batch_size=16):
i = results.index(None) # first fail index i = results.index(None) # first fail index
if b >= batch_sizes[i]: # y intercept above failure point if b >= batch_sizes[i]: # y intercept above failure point
b = batch_sizes[max(i - 1, 0)] # select prior safe point b = batch_sizes[max(i - 1, 0)] # select prior safe point
if b < 1: # zero or negative batch size if b < 1 or b > 1024: # b outside of safe range
b = 16 b = batch_size
LOGGER.warning(f'{prefix}WARNING: ⚠️ CUDA anomaly detected, recommend restart environment and retry command.') LOGGER.warning(f'{prefix}WARNING: ⚠️ CUDA anomaly detected, recommend restart environment and retry command.')
fraction = np.polyval(p, b) / t # actual fraction predicted fraction = np.polyval(p, b) / t # actual fraction predicted
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论