rohitg00/ai-engineering-from-scratch · error · ValueError
width and height must be at least 3
Error message
width and height must be at least 3
What it means
Error "width and height must be at least 3" thrown in rohitg00/ai-engineering-from-scratch.
Source
Thrown at phases/19-capstone-projects/44-cosine-lr-warmup/code/main.py:187
step=self.global_step,
lr=rate,
grad_l2_norm=grad_norm,
loss=float(loss.detach().item()),
)
self._log.append(record)
self.global_step += 1
return record
def plot_schedule_ascii(
schedule: CosineWithWarmup,
width: int = PLOT_WIDTH,
height: int = PLOT_HEIGHT,
) -> str:
"""Return a text plot of the schedule across [0, total_steps]."""
if width <= 2 or height <= 2:
raise ValueError("width and height must be at least 3")
total = schedule.total_steps
step_axis = [
int(round(i * total / max(1, width - 1))) for i in range(width)
]
rates = [schedule.lr(step) for step in step_axis]
upper = max(rates)
if upper <= 0:
upper = 1.0
grid = [[" "] * width for _ in range(height)]
for col, rate in enumerate(rates):
row = int(round((height - 1) * (1.0 - rate / upper)))
row = max(0, min(height - 1, row))
grid[row][col] = "*"
rows: list[str] = []
for r, row in enumerate(grid):
label = upper * (1.0 - r / max(1, height - 1))View on GitHub (pinned to 39ea8a1c6d)
When it happens
Trigger: Thrown at phases/19-capstone-projects/44-cosine-lr-warmup/code/main.py:187 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26).
Data as JSON: /api/errors/11897230c23c4e6a.
Report an issue: GitHub.