π§ͺ Forge Grid: LoRa x Sampler x Scheduler script
νμΌ λ€μ΄λ‘λ (1)
μ΄ λ²μ μ λν΄
βοΈ Core Logic
π Integrated state.interrupt()
Stop button now halts generation predictably in both XY Grid and Batch Grid modes.
Added
if state.interrupted:checks with graceful early exits usingsafe_processed().Handles all nested loops to prevent Forge from hanging during interruption.
π§© Grid Layout Logging
Added console info before generation:
π§© XY Grid layout β rows=..., cols=..., samplers=..., schedulers=..., weights=...Helps visualize grid setup and total iteration count.
βοΈ LoRA Weight Orientation Fix
When LoRA Label Position =
β¬ οΈ Leftorβ‘οΈ Right,
β LoRA weights are now ordered bottom (min) β top (max),
matching intuitive Y-axis behavior.Implemented by reversing the
current_weightslist before XY Grid generation.
π¨ Prompt / LoRA Handling
π§ Rewritten apply_params()
LoRA is skipped entirely when
weight == 0.0.
β No LoRA tag or trigger word is added to the prompt.Prevents duplicate trigger words or
<lora:...>tags.Cleans redundant commas/spaces, keeping prompt formatting consistent.
New prompt assembly order:
[main prompt], <lora:name:weight>, triggerMetadata no longer contains stray β, , , , ,β.
π§© XY Grid
β Improved generation loop
Proper row/column indexing for vertical vs. horizontal orientation.
Ensures every generated cell is saved when
save_cells=True.Compatible with all label positions (
Top,Bottom,Left,Right).
π§Ύ Enhanced logging
Each iteration now prints detailed progress:
π[7/36] Sampler='Euler a', Scheduler='Automatic', LoRA='Apone3d', Weight=0.50, Seed=...Uniform logging style between XY and Batch grids.
π§© Batch Grid
βοΈ Refined control flow
Added
state.interrupt()safety checks to every nested loop.Clean exit with clear logs:
π Generation manually stopped by user.LoRA weight = 0.0 now behaves identically to XY Grid β
no LoRA, no trigger applied.
π§© Grid validation & saving
Improved
validate_cells_for_grid()output:π« Grid validation issues: β Cell [1,2] is None ...Prevents saving empty or invalid grids.
Saved cell filenames now include all relevant parameters:
LoRA_W0.50_S-Euler_SchAutomatic_1_2.webp
π¬ Logging & UX
Consistent emoji-coded messages:
π start β’ π progress β’ πΎ save β’ π interrupt β’ β done β’ β errorAll
print()calls useflush=Trueβ immediate terminal output.Added
gc.collect()after grid creation for better memory cleanup.
π§° Internal Improvements
Removed redundant
build_grid_labels()calls.Simplified nested loop logic and unified naming (
sampler_label,scheduler_label).Standardized
get_cell_indices()parameters andorientationhandling.Minor refactors for clarity and alignment with Forge UI behavior.
π§Ύ Summary
π Stop Handling: Integrated state.interrupt()β Predictable halts
βοΈ Vertical LoRA: Reversed weights β Bottom=min - Top=max
π§ Prompt Logic: Rebuilt apply_params()β Clean, deduplicated prompts
π§© XY Grid: Added layout logging β Clear grid overview
π§± Batch Grid: Unified LoRA & trigger logic β Consistent output
π¬ Logging: Emoji + flush β Readable, real-time feedback
π§Ή Memory: Added gc.collect() β No residual memory buildup






