Skip to content

Commit 50b032e

Browse files
committed
foix
Signed-off-by: Alexandros Koumparoulis <[email protected]>
1 parent c1382c0 commit 50b032e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

nemo/lightning/pytorch/callbacks/layer_freezer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ def make_start_end(name: str, spec: Union[int, list[int]]):
4646
Returns:
4747
tuple(int, int): returns start/end
4848
"""
49-
start, end = 0, 0
5049
# Normalize to (start, end) where end==inf means “forever”
5150
if isinstance(spec, int):
5251
if spec == -1: # forever
@@ -55,8 +54,8 @@ def make_start_end(name: str, spec: Union[int, list[int]]):
5554
start, end = 0, spec - 1
5655
elif isinstance(spec, (list, tuple)) and len(spec) == 2:
5756
start, end = spec
58-
start = 0 if start == -1 else start
59-
end = math.inf if end == -1 else end
57+
start = max(start, 0)
58+
end = max(end, math.inf)
6059
else:
6160
raise ValueError(f"Invalid schedule for '{name}': {spec}")
6261
return start, end

0 commit comments

Comments
 (0)