Skip to content

Fix LayerSkipConfig shorthand crash in SkipLayerGuidance and AutoGuidance#10

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-4dc0
Draft

Fix LayerSkipConfig shorthand crash in SkipLayerGuidance and AutoGuidance#10
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-4dc0

Conversation

@cursor

@cursor cursor Bot commented Jun 23, 2026

Copy link
Copy Markdown

Summary

Fixes a crash when using the documented skip_layer_guidance_layers / auto_guidance_layers shorthand on SkipLayerGuidance and AutoGuidance.

Bug and impact

Using the shorthand layer list (e.g. skip_layer_guidance_layers=[7, 8, 9] for SD3.5-style Skip Layer Guidance) crashes during hook installation with TypeError: object of type 'int' has no len(). Skip Layer Guidance and AutoGuidance are completely broken for the primary documented API path.

Root cause

LayerSkipConfig(layer, fqn="auto") passes the layer index as the first positional argument, which maps to indices — but indices must be list[int]. The bare int breaks membership checks and len() calls inside _apply_layer_skip_hook.

Fix

Pass indices=[layer] when building configs from shorthand in both guiders. Added regression tests in tests/guiders/test_skip_layer_guidance.py.

Validation

  • pytest tests/guiders/test_skip_layer_guidance.py — 2 passed
  • Reproduced pre-fix crash on pass 3 of SkipLayerGuidance.prepare_models() with shorthand layers

Notes

  • Minor check_copies.py change: invoke ruff via python -m ruff so copy checking works when ruff is not on PATH.
Open in Web View Automation 

When SkipLayerGuidance or AutoGuidance build LayerSkipConfig from layer
index shorthand, pass indices=[layer] instead of a bare int. The int was
stored in indices and crashed hook installation with TypeError.

Also invoke ruff via python -m in check_copies so the copy checker runs
when ruff is not on PATH.

Co-authored-by: Simon Lynch <srlynch1@users.noreply.github.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