code: def clear_checkpoints(run_path: Path):
      checkpoints = list(get_checkpoints(run_path))
      if not checkpoints:
          return
  
      checkpoint_steps = sorted([int(c.name) for c in checkpoints])
  
      if len(checkpoint_steps) <= 2:
          return
  
      checkpoint_steps = checkpoint_steps[:-2]
      checkpoints_path = run_path / "checkpoints"
      from labml.internal.util import rm_tree
  
      for c in checkpoint_steps:
          path = checkpoints_path / str(c)
          rm_tree(path)
  
file_path: labml/client/labml/internal/manage/runs.py
imports: from pathlib import Path
  from typing import Optional, Generator
  from labml.logger import inspect
label_desc: Use image node_id 8 for calling a global function with example usage: clear_checkpoints(run_path) without return types