From daed942fe9d832eb32c7fbf6e28c9ddc4d39d135 Mon Sep 17 00:00:00 2001 From: Wing Lian Date: Tue, 25 Jul 2023 10:29:49 -0400 Subject: [PATCH] fix rounding of len of batches to int --- src/axolotl/utils/dataloader.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/axolotl/utils/dataloader.py b/src/axolotl/utils/dataloader.py index f1ba51bb7..eb2fb8df8 100644 --- a/src/axolotl/utils/dataloader.py +++ b/src/axolotl/utils/dataloader.py @@ -1,5 +1,5 @@ # pylint: skip-file - +import math from typing import Any, Callable, List, Union import numba @@ -193,13 +193,12 @@ class MultipackDistributedDataloader: def __len__(self): batches, _ = self.generate_batches() - return ( - len(batches) * 0.99 - ) # shave off 1% for dealing with variance in packing and dataset length + # shave off 1% for dealing with variance in packing and dataset length + return math.floor(len(batches) * 0.99) def num_batches(self): batches, _ = self.generate_batches() - return len(batches) * 0.99 + return math.floor(len(batches) * 0.99) def efficiency(self): return self.eff_total_used / self.eff_total_slots