mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2026-03-22 22:30:45 -07:00
- Add modules/prompt_seed_prep.py with prepare_prompt_seed_state(p) - Replace inline all_seeds/all_subseeds logic in process_images_inner - Mutate p.seed/p.subseed before call; prepare_prompt_seed_state writes to p - Behavior-preserving: fill_fields_from_opts, setup_prompts unchanged - Phase II runtime seam preparation Made-with: Cursor
30 lines
922 B
Python
30 lines
922 B
Python
"""
|
|
Prompt and seed preparation for Stable Diffusion processing.
|
|
|
|
Extracted from processing.py (M06) to isolate preparation logic from sampling.
|
|
Behavior-preserving: writes directly to p; assumes setup_prompts() already ran.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
def prepare_prompt_seed_state(p):
|
|
"""
|
|
Populate p.all_seeds and p.all_subseeds from p.seed and p.subseed.
|
|
|
|
Assumes:
|
|
- p.seed and p.subseed have already been normalized via get_fixed_seed()
|
|
- p.setup_prompts() has already run (p.all_prompts exists)
|
|
"""
|
|
if isinstance(p.seed, list):
|
|
p.all_seeds = p.seed
|
|
else:
|
|
p.all_seeds = [
|
|
int(p.seed) + (x if p.subseed_strength == 0 else 0)
|
|
for x in range(len(p.all_prompts))
|
|
]
|
|
|
|
if isinstance(p.subseed, list):
|
|
p.all_subseeds = p.subseed
|
|
else:
|
|
p.all_subseeds = [int(p.subseed) + x for x in range(len(p.all_prompts))]
|