Skip to content

Commit f5e949e

Browse files
committed
update
1 parent 7c72ae0 commit f5e949e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/lightning/pytorch/tuner/batch_size_scaling.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ def _run_power_scaling(
192192
# reset after each try
193193
_reset_progress(trainer)
194194

195+
if max_val is not None and new_size >= max_val:
196+
rank_zero_info(f"Reached the maximum batch size limit of {max_val}. Stopping search.")
197+
break
198+
195199
try:
196200
_try_loop_run(trainer, params)
197201
last_successful_size = new_size # Store the current size before doubling
@@ -248,6 +252,10 @@ def _run_binsearch_scaling(
248252
# reset after each try
249253
_reset_progress(trainer)
250254

255+
if max_val is not None and new_size >= max_val:
256+
rank_zero_info(f"Reached the maximum batch size limit of {max_val}. Stopping search.")
257+
break
258+
251259
try:
252260
# run loop
253261
_try_loop_run(trainer, params)

0 commit comments

Comments
 (0)