| from ultralytics import YOLO | |
| from pathlib import Path | |
| if __name__ == '__main__': | |
| # Existing checkpoint | |
| checkpoint = Path( | |
| "/media/rtx5090/Scripts/runs/detect/training_stats/1700_train/hp-z4-g5-workstation-1/run_1/weights/last.pt" | |
| ) | |
| # Check that it exists | |
| if not checkpoint.exists(): | |
| raise FileNotFoundError(f"Checkpoint not found: {checkpoint}") | |
| # Load the interrupted training state | |
| model = YOLO(str(checkpoint)) | |
| # Resume training | |
| model.train( | |
| resume=True, | |
| device=0 | |
| ) | |