Skip to content

Suppress chained fallback exceptions for RFDETR patch-size - #975

Merged
Borda merged 8 commits into
developfrom
copilot/add-visualization-feature
Apr 21, 2026
Merged

Borda merged 8 commits into
developfrom
copilot/add-visualization-feature

Conversation

Copilot AI commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

When RFDETRLarge initialization hits a patch-size compatibility error and the deprecated-config retry also fails, users currently see two conflicting ValueErrors (patch_size=14 and patch_size=16) in one traceback. This obscures the actionable root cause from the initial load attempt.

  • Problem surfaced

    • Deprecated fallback retry preserved exception context, so the secondary retry failure was shown as a chained exception after the primary compatibility error.
  • Behavior change in fallback re-raise

    • Updated RFDETRLarge fallback path to re-raise the original initialization error without chained context:
    except Exception:
        raise self.init_error from None
    • Result: users see a single, deterministic compatibility error from the original attempt.
  • Regression coverage

    • Added a fallback-specific regression test that simulates:
      1. first init failing with patch_size=14 -> 12,
      2. retry failing with patch_size=16 -> 12,
      3. raised exception remains the first one, with context suppressed.

@codecov

codecov Bot commented Apr 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80%. Comparing base (24d188c) to head (9365e0c).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@          Coverage Diff           @@
##           develop   #975   +/-   ##
======================================
  Coverage       80%    80%           
======================================
  Files          100    100           
  Lines         8342   8343    +1     
======================================
+ Hits          6632   6636    +4     
+ Misses        1710   1707    -3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Alarmod

Alarmod commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

The AI ​​somehow rigidly tied everything to RFDETRLarge and specific parameters... It probably shows up everywhere, and it shouldn't depend so much on constants.

@Borda
Borda marked this pull request as ready for review April 16, 2026 23:28
@Borda
Borda self-requested a review as a code owner April 16, 2026 23:28
Copilot AI review requested due to automatic review settings April 16, 2026 23:28
@Borda Borda changed the title Suppress chained fallback exceptions for RFDETRLarge patch-size compatibility failures Suppress chained fallback exceptions for RFDETR patch-size compatibility failures Apr 16, 2026
@Borda Borda changed the title Suppress chained fallback exceptions for RFDETR patch-size compatibility failures Suppress chained fallback exceptions for RFDETR patch-size Apr 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the error surfaced by RFDETRLarge when its deprecated-config fallback retry also fails, ensuring users see a single deterministic “first attempt” compatibility error (without a chained secondary exception).

Changes:

  • Suppress exception chaining when the deprecated-config retry fails by re-raising the original initialization error with from None.
  • Add a regression test covering the “both attempts fail” scenario to ensure the first error is re-raised and context is suppressed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/rfdetr/variants.py Suppresses chained exceptions when the deprecated-config retry fails by re-raising the original init error with from None.
tests/training/test_detr_shim.py Adds a regression test asserting only the first patch-size mismatch error is raised and exception context is suppressed.

Comment thread src/rfdetr/variants.py Outdated
Borda and others added 2 commits April 20, 2026 11:30
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Borda
Borda merged commit 058c2ff into develop Apr 21, 2026
24 checks passed
@Borda
Borda deleted the copilot/add-visualization-feature branch April 21, 2026 11:52
@Borda Borda mentioned this pull request Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants