← Back to Pull requests

[DOC] Document checkpoint resuming on lightning 2.6 and use pytorch_forecasting Tuner in examples #2464

Open
unknown opened this pull request with 315 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 13, 2026 16:04 UTC
Author

Fixes #2463. Related: #2000 and #2027.

Change

On Lightning >=2.6 with PyTorch >=2.6, Trainer.fit(..., ckpt_path=...) rejects v1 checkpoints because the default weights-only loader cannot restore the fitted encoders, normalizers, losses and metrics they contain.

  • Add a "Resuming from a checkpoint" section to the Models usage docs: resume with ckpt_path, and pass weights_only=False for trusted checkpoints. The FAQ entry now points there; the stallion tutorial note stays.

  • Switch the README.md, Getting Started and Models examples from lightning.pytorch.tuner.Tuner to pytorch_forecasting.tuning.Tuner. Lightning's Tuner.lr_find has no weights_only argument and fails on these checkpoints; ours patches the loader (#2000). The tutorials already use it.

  • Integration test: train one epoch, save, resume for a second epoch, then validate and test from that checkpoint. An epoch-counting callback verifies that only the second epoch runs after resuming. Skipped on Lightning <2.6, where the keyword is unavailable.
  • Scope

    Documentation, example imports and a test of an existing workaround. Runtime loading behavior is unchanged; default loading still fails without the explicit keyword. The pytorch_forecasting.tuning.Tuner wrapper is still needed: in Lightning 2.6.6, the latest release, Tuner.lr_find has no weights_only argument. v2 uses a separate representation and is out of scope. Only trusted checkpoints should be loaded this way, as unpickling can execute code.

    Validation

    Lightning 2.6.6, PyTorch 2.14.1, Windows CPU:

  • New regression passes (1 passed); skipped on Lightning 2.5.6.

  • TFT, NBeats and DeepAR reproduce the default loading error for fit/validate/test; explicit weights_only=False passes.

  • TFT: Lightning's Tuner.lr_find fails with the same UnpicklingError and pytorch_forecasting.tuning.Tuner.lr_find passes. The LearningRateFinder callback fails even with trainer.fit(..., weights_only=False). A plain LightningModule checkpoint resumes with the default.

  • Pre-commit passes on all changed files. A standalone Sphinx build renders the new section and resolves the FAQ link; the full docs build was not run locally; the PR's Read the Docs build passes.

  • Model suite on the earlier base 0acb5a0: 201 passed and 5 skipped across a parallel run and serial retries of 23 environment failures (Tk backend, memory).
  • Review focus

    Placement of the note in the Models usage section, and whether the Tuner import changes belong in this PR.

    Diff: 315 lines (+236 / -79) across 3 files Reviewer: phoeenniixx Review duration: 26070m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 315 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.344
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #2464"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.5% · Safe to merge
    21.5%