fix: Result.instance falls back to a valid sample; persist samples before materialisation (#1535) - #1536
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A completed fit whose stored maximum-likelihood vector is rejected by the current model (e.g. a gradient lane that settled at
ell_compsoutside the unit disk — finite under JAX tracing,ModelParameterExceptionon the host) used to die insideanalysis.save_resultsand lose itssamples.csvand.completedmarker. Six 2–4 h A100 Phase 8B arms were lost this way (PyAutoLabs/autolens_profiling#182).Two changes:
Result.instancedegrades to the next-valid recovering path that #1486 added onSamples, andSearchUpdater._save_sampleswrites the samples and summary before attempting to materialise the instance, so a rejected best point can never cost a run its data. The reordering is also what lets the weight-threshold prune run (#1487).Closes #1535. Fixes #1487.
API Changes
No public API removed or renamed. Behavioural changes only:
Result.instanceno longer raisesSamplesExceptionwhen the samples-summary vector is rejected; it logs a WARNING and returnsSamples.max_log_likelihood()(highest-likelihood sample the model still accepts), cached on the result. ReturnsNoneonly when no samples are available to fall back on.SamplesSummary.instanceitself still raises (it holds one sample and has nothing to substitute).SearchUpdater._save_samplesnow always writessamples.csv(weight-thresholded) andsamples_summary.json; on a rejected best point it returnsinstance=Noneand the caller skips only latents / visualization / profiling. The 4th return value is now the prunedsamples_save.See full details below.
Test Plan
pytest test_autofit -q— 2251 passed, 3 skippedtest_result.py::TestResultInstanceRejectedBestPoint(4),test_updater.py(3: both writers called withinstance=None; zero-weight row pruned; realDirectoryPathsrun writessamples.csv+samples_summary.json)HPCPullPyAutoon RAL so the pending Phase 8B arms (jobs 341874/341875) write normallyFull API Changes (for automation & release notes)
Removed
Added
AbstractResult._recovered_instance(private cache) — the fallback instance, computed once.Migration
Result.instanceraisingSamplesExceptionfor a rejected best point must now check the WARNING log or callresult.samples_summary.instancedirectly.Generated by the PyAutoLabs agent workflow.