chore(mlx-lm): fix the number of validation batches configuration. (#752)

* chore: fix number of validation batches

* clean up

* address comment
This commit is contained in:
Anchen
2024-05-04 23:52:42 +10:00
committed by GitHub
parent 2bf11c4633
commit f30413b63c
2 changed files with 85 additions and 2 deletions

View File

@@ -137,8 +137,11 @@ def evaluate(
):
all_losses = []
ntokens = 0
for it, batch in zip(
range(num_batches),
index_iterator = iter(range(num_batches)) if num_batches != -1 else iter(int, 1)
for _, batch in zip(
index_iterator,
iterate_batches(
dataset=dataset,
tokenizer=tokenizer,