feat(M09): introduce RuntimeContext and attach to processing object
- Add modules/runtime_context.py with RuntimeContext dataclass - Attach p.runtime_context in process_images_inner() after opts_snapshot - Write-only: no migration of shared.* reads yet - Completes Phase II runtime seam preparation Made-with: Cursorpull/17332/head
parent
666b159d0b
commit
372e0673f3
|
|
@ -5,4 +5,8 @@ Implementation toolcalls for Cursor execution.
|
|||
| Timestamp | Tool | Purpose | Files/Target | Status |
|
||||
|-----------|------|---------|--------------|--------|
|
||||
| 2026-03-11 | write | Populate M09_plan.md with full plan | docs/milestones/M09/M09_plan.md | completed |
|
||||
| 2026-03-11 | run | git checkout main, pull, create branch | git | pending |
|
||||
| 2026-03-11 | run | git checkout main, pull, create branch | git | completed |
|
||||
| 2026-03-11 | write | Create modules/runtime_context.py | modules/runtime_context.py | completed |
|
||||
| 2026-03-11 | search_replace | Attach RuntimeContext in process_images_inner | modules/processing.py | completed |
|
||||
| 2026-03-11 | run | pytest test/smoke | test/smoke | pending |
|
||||
| 2026-03-11 | run | pytest test/quality | test/quality | pending |
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import modules.face_restoration
|
|||
import modules.images as images
|
||||
import modules.styles
|
||||
from modules.opts_snapshot import create_opts_snapshot
|
||||
from modules.runtime_context import RuntimeContext
|
||||
import modules.prompt_seed_prep as prompt_seed_prep
|
||||
import modules.runtime_utils as runtime_utils
|
||||
import modules.sd_models as sd_models
|
||||
|
|
@ -893,6 +894,13 @@ def process_images_inner(p: StableDiffusionProcessing) -> Processed:
|
|||
|
||||
prompt_seed_prep.prepare_prompt_seed_state(p)
|
||||
p.opts_snapshot = create_opts_snapshot(shared.opts)
|
||||
p.runtime_context = RuntimeContext(
|
||||
model=shared.sd_model,
|
||||
opts_snapshot=p.opts_snapshot,
|
||||
device=shared.device,
|
||||
state=shared.state,
|
||||
cmd_opts=shared.cmd_opts,
|
||||
)
|
||||
|
||||
if os.path.exists(cmd_opts.embeddings_dir) and not p.do_not_reload_embeddings:
|
||||
model_hijack.embedding_db.load_textual_inversion_embeddings()
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
"""Runtime execution context for generation runs.
|
||||
|
||||
M09: Lightweight context grouping model, opts_snapshot, device, state,
|
||||
cmd_opts. Attached to processing object as p.runtime_context.
|
||||
Write-only in M09; not yet consumed by runtime.
|
||||
"""
|
||||
from dataclasses import dataclass
|
||||
|
||||
|
||||
@dataclass
|
||||
class RuntimeContext:
|
||||
"""Groups runtime dependencies for the generation pipeline."""
|
||||
|
||||
model: object
|
||||
opts_snapshot: object
|
||||
device: object
|
||||
state: object
|
||||
cmd_opts: object
|
||||
Loading…
Reference in New Issue