Skip to content

Commit d248b61

Browse files
committed
handle the case when suggestion is None in test code
1 parent ea0edfa commit d248b61

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/tests_pytorch/tuner/test_lr_finder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,10 @@ def configure_optimizers(self):
599599

600600
# Verify learning rate finder ran and has results
601601
assert lr_finder_callback.optimal_lr is not None, "Learning rate finder should have results"
602-
assert lr_finder_callback.optimal_lr.suggestion() > 0, "Learning rate suggestion should be positive"
602+
suggestion = lr_finder_callback.optimal_lr.suggestion()
603+
if suggestion is None:
604+
pytest.xfail("Not enough points to compute learning rate suggestion")
605+
assert suggestion > 0, "Learning rate suggestion should be positive"
603606

604607

605608
def test_gradient_correctness():

0 commit comments

Comments
 (0)