{"record":{"id":"11897230c23c4e6a","repo":"rohitg00/ai-engineering-from-scratch","slug":"width-and-height-must-be-at-least-3","errorCode":null,"errorMessage":"width and height must be at least 3","messagePattern":"width and height must be at least 3","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"phases/19-capstone-projects/44-cosine-lr-warmup/code/main.py","lineNumber":187,"sourceCode":"            step=self.global_step,\n            lr=rate,\n            grad_l2_norm=grad_norm,\n            loss=float(loss.detach().item()),\n        )\n        self._log.append(record)\n        self.global_step += 1\n        return record\n\n\ndef plot_schedule_ascii(\n    schedule: CosineWithWarmup,\n    width: int = PLOT_WIDTH,\n    height: int = PLOT_HEIGHT,\n) -> str:\n    \"\"\"Return a text plot of the schedule across [0, total_steps].\"\"\"\n\n    if width <= 2 or height <= 2:\n        raise ValueError(\"width and height must be at least 3\")\n    total = schedule.total_steps\n    step_axis = [\n        int(round(i * total / max(1, width - 1))) for i in range(width)\n    ]\n    rates = [schedule.lr(step) for step in step_axis]\n    upper = max(rates)\n    if upper <= 0:\n        upper = 1.0\n\n    grid = [[\" \"] * width for _ in range(height)]\n    for col, rate in enumerate(rates):\n        row = int(round((height - 1) * (1.0 - rate / upper)))\n        row = max(0, min(height - 1, row))\n        grid[row][col] = \"*\"\n\n    rows: list[str] = []\n    for r, row in enumerate(grid):\n        label = upper * (1.0 - r / max(1, height - 1))","sourceCodeStart":169,"sourceCodeEnd":205,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/19-capstone-projects/44-cosine-lr-warmup/code/main.py#L169-L205","documentation":"Error \"width and height must be at least 3\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"Thrown at phases/19-capstone-projects/44-cosine-lr-warmup/code/main.py:187 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}