Skip to content

fix(run): key the resume cache on steps + guidance - #147

Open
pedropaf wants to merge 1 commit into
mainfrom
fix/resume-cache-key
Open

pedropaf wants to merge 1 commit into
mainfrom
fix/resume-cache-key

Conversation

@pedropaf

Copy link
Copy Markdown
Collaborator

Problem

modl run skips sub-jobs whose output is already on disk, but the completion key was only (prompt, seed, model). Re-running the same prompt/seed at a different guidance or step count matched the old key, so the run skipped generation and handed back the stale image — while printing ✓ complete and exiting 0.

Any guidance/steps sweep was silently corrupted. Same failure class as the silently-dropped configs in #145: it looks accepted, nothing errors, and the run is quietly not what was asked for.

Found the hard way: a guidance 3.0 → 2.5 re-run returned the 3.0 images and reported success. Only caught by diffing the output-image count.

Fix

  • Completion key is now (prompt, seed, base_model, steps, guidance).
  • The generate spec is built before the skip check, so the resolved steps/guidance (after fast/lightning/default precedence) go into the key — then reused for execution, no double build.
  • guidance is f32 (neither Eq nor Hash), so it is quantized to an integer (×1000, rounded) via quantize_guidance, stable across the YAML-sidecar round-trip.
  • Edit steps have no skip path — no change there.

Tests

  • completion_index_keys_on_steps_and_guidance — distinct settings → distinct keys; unseen settings miss.
  • quantize_guidance_is_stable_and_distinct.
  • Verified end-to-end with SD-1.5: identical guidance skips, changed guidance regenerates (sidecar confirms the new value).

🤖 Generated with Claude Code

`modl run` skips sub-jobs whose work is already on disk, but the completion
key was only (prompt, seed, model). Re-running the same prompt/seed at a
different guidance or step count matched the old key, so the run skipped
generation and handed back the STALE image while printing `✓ complete` and
exiting 0. Any guidance/steps sweep was silently corrupted — the same
failure class as the silently-dropped configs (#145): it looks accepted,
nothing errors, and the run is quietly not what was asked for.

The completion key is now (prompt, seed, base_model, steps, guidance). The
generate spec is built before the skip check so the resolved steps/guidance
(after fast/lightning/default precedence) go into the key, then reused for
execution — no double build. Guidance is an f32 (neither Eq nor Hash), so it
is quantized to an integer (×1000, rounded) that round-trips stably through
the YAML sidecar. Edit steps have no skip path, so no change there.

Tests: completion_index_keys_on_steps_and_guidance (distinct settings are
distinct keys; unseen settings miss) and quantize_guidance_is_stable_and_distinct.
Verified end-to-end with SD-1.5: identical guidance skips, changed guidance
regenerates.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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