← Back to Pull requests

Fix .pkl config path in Base_pkg._load_config; remove debug print #2222

Closed
unknown closed this pull request without merging on Mar 24, 2026 12:46 UTC
View on GitHub
unknown unknown commented on Mar 22, 2026 12:55 UTC
Author

Reference Issues/PRs


Fixes #2221

What does this implement/fix? Explain your changes.


_load_config() in Base_pkg documented .pkl as a supported config format in three places (class docstring, method docstring, and the ValueError message itself), but the implementation only handled .pkl during ckpt_path auto-discovery. Passing a .pkl path directly as config raised ValueError.

Changes:

  • Added explicit .pkl branch to the config path in _load_config(), opening the file in binary mode and returning pickle.load()

  • Removed print(suffix) debug statement left in the method body

  • Updated the unsupported-format error message to say "Supported formats: .yaml, .yml, .pkl"
  • What should a reviewer concentrate their feedback on?


  • Correctness of the .pkl branch placement relative to the existing auto-discovery path

  • Whether the # noqa: S301 on pickle.load() is consistent with the project's existing usage of the same pattern elsewhere in the file
  • Did you add any tests for the change?


    Yes. Two new tests added in pytorch_forecasting/tests/test_all_v2/test_all_estimators_v2.py:

  • test_load_config_pkl_explicit — creates a small pickle config file and asserts _load_config() returns the correct dict when a .pkl path is passed directly as config

  • test_load_config_unsupported_format_raises — writes a .json file and asserts _load_config() raises ValueError with the expected message
  • Both tests verified locally:

    python -m pytest -o addopts='' pytorch_forecasting/tests/test_all_v2/ -k "test_load_config" -v
    2 passed, 85 deselected
    

    Note: -o addopts='' was required to override a broken --cov-config=.coveragerc reference in pyproject.toml (.coveragerc does not exist in the repo). A separate bug has been filed for this.

    Any other comments?


    None.

    PR checklist


  • The PR title starts with [BUG]

  • Added/modified tests

  • Used pre-commit hooks when committing to ensure that code is compliant with hooks. Install hooks with pre-commit install. To run hooks independent of commit, execute pre-commit run --all-files
  • Diff: 270 lines (+202 / -68) across 3 files Reviewer: fnhirwa Review duration: 2871m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.63) × (1 − Review Confidence (0.58)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.63 · 270 lines diff across 3 files
    0.63
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    57%
    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.335
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.063
    Real PR Conversation Timeline
    1 comments
    "Review active on #2222"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 58.0% reviewed sensitive_module
    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: 62.6% (MEDIUM) · Higher = larger blast radius
    62.6%
    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: 58.0% · Lower = rushed or shallow review
    58.0%
    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: 26.3% · Safe to merge
    26.3%