Skip to content

feat: estimate_runtime setup/cores auto, no-cell estimate, reworded setup guard - #892

Merged
Jammy2211 merged 2 commits into
mainfrom
feature/likelihood-lifecycle-p5-setup-fixes
Nov 25, 2026
Merged

Jammy2211 merged 2 commits into
mainfrom
feature/likelihood-lifecycle-p5-setup-fixes

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Part of PyAutoLabs/PyAutoGalaxy#756 (likelihood-lifecycle pre-release setup fixes). Merge order: PyAutoFit → PyAutoGalaxy → PyAutoLens (same branch name in all three).

  • al.estimate_runtime accepts setup="auto" and number_of_cores="auto". The setup resolves via aa.Setup.auto with the same rule key the analyses use (PYAUTO_SETUP honoured); the cores resolve via PyAutoFit's resolve_number_of_cores (1 for JAX, else detected cores capped by the matched row's resources).
  • No profiling cell → an estimate, not None. line() reads Estimate: no estimate for <setup_id> (no profiling cell). The fit-time Estimate: line stays silent in that case, as before.
  • JAX fallback is not priced by JAX rows. A JAX setup running on numpy (PYAUTO_DISABLE_JAX=1 / JAX not installed) returns Estimate: no estimate for <setup_id> (designated JAX; JAX disabled, the numpy fallback has no profiling cell) and is silent at fit time; its explicit number_of_cores is kept and resources_per_eval() returns None, so the JAX rows no longer cap the numpy fit's "auto" cores.
  • Unresolved-setup error reworded. SetupException now says the likelihood was evaluated before the setup resolved (at fit start, or on pre-fit calls given a model) and points to analysis.prepare_for_model(model); the stale "not supported inside factor graphs / planned 5D" text is removed from the message and docstrings.

API Changes

estimate_runtime gains setup="auto", number_of_cores="auto" and a no-cell estimate; new resolve_setup_from; RuntimeEstimate gains has_profiling_cell, fallback_reason and RuntimeEstimate.no_profiling_cell(...).
See full details below.

Test Plan

  • test_autolens full suite passes (1169 passed, 1 xfailed)
  • test_runtime_estimate.py: auto setup matches the analysis, PYAUTO_SETUP override, point dataset needs likelihood=, auto cores (JAX → 1; numba matches resolve_number_of_cores), no-cell line, fit-time silence, JAX-disabled fallback
  • Setup-guard tests updated for the reworded message
  • Heart dev-ship readiness: GREEN (non-blocking reasons listed on the PyAutoFit PR).
Full API Changes (for automation & release notes)

Added

  • al.estimate_runtime(..., setup="auto", number_of_cores="auto").
  • autolens.analysis.runtime_estimate.resolve_setup_from(dataset, model, setup, likelihood=None).
  • RuntimeEstimate.no_profiling_cell(setup_id, backend, number_of_cores, search=None, fallback_reason=None); fields has_profiling_cell, fallback_reason.

Changed

  • estimate_runtime returns a no-cell estimate instead of None when the setup has no profiling row (setup=None still returns None).
  • SETUP_UNRESOLVED_MESSAGE / exc.SetupException wording.

Migration

  • Before: al.estimate_runtime(dataset, model, search, setup="numba_cpu_sparse_fp64", number_of_cores=16)
  • After (also valid): al.estimate_runtime(dataset, model, search, setup="auto", number_of_cores="auto")

Generated by the PyAutoLabs agent workflow.

🤖 Generated with Claude Code

…back estimates

Part of PyAutoLabs/PyAutoGalaxy#756.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ests

The no-JAX CI leg has no JAX, so every JAX setup hit the numpy-fallback path and
was not priced by the JAX rows. Pin find_spec('jax') in the module and add an
explicit JAX-not-installed fallback test.

Part of PyAutoLabs/PyAutoGalaxy#756.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Jammy2211
Jammy2211 merged commit f222efd into main Nov 25, 2026
5 checks passed
@Jammy2211
Jammy2211 deleted the feature/likelihood-lifecycle-p5-setup-fixes branch November 25, 2026 16:44
@pyautolabs-bot pyautolabs-bot Bot removed the pending-release PR queued for the next release build label Nov 25, 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.

1 participant