Skip to content

Restore temporary parameters when use_params raises - #976

Open
AryanRG wants to merge 1 commit into
explosion:v8.3.xfrom
AryanRG:fix/restore-temporary-params-on-error
Open

AryanRG wants to merge 1 commit into
explosion:v8.3.xfrom
AryanRG:fix/restore-temporary-params-on-error

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 26, 2026

Copy link
Copy Markdown

Description

If an exception leaves Model.use_params(), temporary weights remain installed and later predictions use them. Restore the original parameters in finally, including when setup fails partway through a model chain.

Added regression tests for exceptions in the context body and during parameter setup. The CPU suite passes locally on macOS/Python 3.12; optional integrations are skipped.

Types of change

Bug fix.

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

This branch has not been deployed

No deployments
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.

1 participant