Skip to content

Skip parameters the loss cannot reach - #88

Merged
jessegrabowski merged 2 commits into
pymc-devs:mainfrom
jessegrabowski:skip-unreachable-parameters
Aug 12, 2026
Merged

Skip parameters the loss cannot reach#88
jessegrabowski merged 2 commits into
pymc-devs:mainfrom
jessegrabowski:skip-unreachable-parameters

Conversation

@jessegrabowski

@jessegrabowski jessegrabowski commented Aug 12, 2026

Copy link
Copy Markdown
Member

A parameter can be an ancestor of the loss as written and gone once the loss differentiates — an additive output bias under a second derivative. compile_train raised on it, so the only way through was to enumerate every other parameter by hand. The collected set now leaves it out; naming it in parameters= still raises, since that asserts it should train.

The stop-gradient marker walk has to stay alongside the connection-pattern check. zero_grad yields a gradient that's connected and zero, so the pattern reports it as present — swapping one for the other puts frozen parameters back in the optimizer's set, where weight decay moves them.

An additive constant is an ancestor of the loss as written and gone once the loss differentiates, so a physics-informed loss could only be trained by enumerating every other parameter by hand. Naming one explicitly still raises, since that asserts it should train.
@codecov-commenter

codecov-commenter commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.69%. Comparing base (e9809ff) to head (da0a497).

Files with missing lines Patch % Lines
pytensor_ml/pytensorf/collect.py 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #88      +/-   ##
==========================================
- Coverage   96.73%   96.69%   -0.05%     
==========================================
  Files          45       45              
  Lines        1807     1814       +7     
==========================================
+ Hits         1748     1754       +6     
- Misses         59       60       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jessegrabowski jessegrabowski added the bug Something isn't working label Aug 12, 2026
@jessegrabowski
jessegrabowski merged commit 8025e65 into pymc-devs:main Aug 12, 2026
7 checks passed
@jessegrabowski
jessegrabowski deleted the skip-unreachable-parameters branch August 12, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants