Skip to content

validate_workflow accepts cache type 'faster' on FluxPipeline (FLUX.1-dev); run fails in diffusers faster_cache with IndexError #895

Closed

Description

@dkackman

Tool: validate_workflow / run_workflow. Found while verifying #886 (C-F444) on the mini-ai server (mps on mini-ai.lan), develop @ e37f2fb. Tester: claude-opus-5-5 / anthropic.

Repro:

{"id": "flux-fc", "seed": 42, "steps": [{"name": "main", "pipeline": {"configuration": {"component_type": "FluxPipeline", "cache": {"type": "faster"}}, "from_pretrained_arguments": {"model_name": "black-forest-labs/FLUX.1-dev", "torch_dtype": "torch.bfloat16"}, "arguments": {"prompt": "an apple on a table", "num_inference_steps": 20, "width": 512, "height": 512, "guidance_scale": 3.5}}, "result": {"content_type": "image/jpeg", "subfolder": "final"}}]}
  1. validate_workflow(workflow=<above>) returns valid: true with no errors and no warnings.
  2. run_workflow(inline_workflow=<above>, acknowledged_cost=true, wait_seconds=400) gives job f49a2e7b2957, status: failed, error: "Workflow execution error: tuple index out of range". The traceback ends inside diffusers:
diffusers/hooks/faster_cache.py", line 470, in new_forward
    out = out.chunk(2, dim=0)[1]
IndexError: tuple index out of range

(called from the attention module of transformer_flux.py block 459, via faster_cache.py:293).

Expected: validate_workflow refuses faster (or at least warns) on a pipeline that doesn't batch cond/uncond in one forward. FLUX.1-dev is guidance-distilled: guidance_scale is an embedding, not CFG, so the transformer sees batch 1. diffusers' FasterCache attention hook assumes a CFG batch of 2. Alternatively, the run could drop the cache with a "not applied" warning, the way SD 1.5 already gets FasterCacheConfig was not applied: the pipeline has no transformer.

Actual: validate passes it, and the run fails at the first denoise step.

Not #886's counter: no dw frame below pipeline.py:_call_pipeline appears in the trace, and faster is type-only in #886 (text_kv and taylorseer on the same base ran clean). The same base with first_block/mag/text_kv/taylorseer succeeds.

Activity

  1. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    triage: work — dw/pipeline_processors/config_objects.py builds FasterCacheConfig() with no arguments. diffusers' FasterCacheConfig has is_guidance_distilled for exactly this case: its hook stops assuming a CFG batch of 2. Proposed scope: forward that one key from cache, like the mag/taylorseer keys (schema and docs included), set it in the catalog/plugin for distilled families such as FLUX.1-dev (model knowledge stays out of the engine), and turn the IndexError into an error that names the key. Engine code can't tell a distilled pipeline from a CFG one, so a validate-time refusal is out of scope. If the fix grows to forward more FasterCacheConfig parameters, escalate that instead. Triage: claude-opus-5-5 / anthropic.

  2. added a commit that references this issue on Oct 14, 2026
  3. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Fixed on develop @ 0dcf45a (not yet deployed — the driver deploys to mini-ai after this session).

    What changed:

    • cache.is_guidance_distilled (boolean) is now forwarded to diffusers' FasterCacheConfig; declared in dw/workflow_schema.json, documented in ACCELERATION.md (FasterCache) and WORKFLOW_GUIDE.md.
    • If a faster cache without that key fails with an IndexError whose traceback goes through diffusers' faster_cache, the step now raises a ValueError naming cache.is_guidance_distilled: true instead of tuple index out of range.
    • Not done, per triage: validate-time refusal (the engine can't tell a distilled model from a CFG one), and no catalog edit (workflows/models/flux-dev.json sets no cache; the docs name FLUX.1-dev/Krea as the case).

    Tests: new unit tests in tests/test_config_objects.py (key is forwarded, default stays false, schema/diffusers field agreement). The IndexError→ValueError wrapper has no unit test; it needs a real run. Full suite: 17 failures, all Kandinsky6 templates/skill tests (the local diffusers lacks Kandinsky6TI2VAPipeline) — unrelated to this change.

    To verify: re-run the repro with "cache": {"type": "faster", "is_guidance_distilled": true} — it should run. Without the key, the error should now name is_guidance_distilled. Can only be checked on MPS here; the FLUX.1-dev run is slow.

    — claude-sonnet-5-5 / anthropic

  4. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Architecture review queued by the loop driver: this hand-off changed dw/ or dw_mcp/ on develop (789c4e11dc..0dcf45ad89: dw/pipeline_processors/config_objects.py dw/pipeline_processors/pipeline.py dw/workflow_schema.json). The reviewer checks it against docs/ARCHITECTURE.md before the tester verifies.

  5. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Architecture review: pass. I read git diff 789c4e11..0dcf45ad under dw/ and dw_mcp/. Only commit 0dcf45a belongs to #895. I checked it against docs/ARCHITECTURE.md and stage-c-guardrails item 3.

    • Second owner: none. is_guidance_distilled reaches diffusers through get_cache_configuration (dw/pipeline_processors/config_objects.py) via a new _FASTER_CACHE_KEYS. That matches how _MAG_CACHE_KEYS/_TAYLORSEER_CACHE_KEYS already work, so the cache config is still built in one place. The IndexError→ValueError wrapper in Pipeline (pipeline.py) is in the module the Pipeline loading row names, around the pipeline call it already owns. No row gives failure-message rewriting to another module: API errors (dw_mcp/client.py) covers HTTP failures, and Failed-run reporting and Failure path redaction (dw/worker.py, dw/path_redaction.py) aren't affected. The Step-cache skip counts row says faster reports type only, and this change leaves that alone (timing.py _CONFIG_KEYS).
    • Build vs. buy: none. The fix uses diffusers' own FasterCacheConfig.is_guidance_distilled and doesn't reimplement it. traceback is stdlib.
    • Map: no new owner and no rule moving between modules, so no row is needed.
    • Context: no CLAUDE.md change. The schema description carries the rationale.

    Not something for this review to rule on: the wrapper picks a faster failure out by searching the formatted traceback for "faster_cache". That's fragile if diffusers renames the module, and it has no unit test (the implementer said so). The tester's run on mini-ai checks both behaviours.

    — reviewer: claude-opus-5-5 / anthropic

  6. dkackman commented on Oct 14, 2026

    @dkackman
    OwnerAuthor

    Verified on the mini-ai server (mps on mini-ai.lan, Apple M5 Pro), develop @ 0e73254. Tester: claude-opus-5-5 / anthropic.

    What I ran:

    1. validate_workflow on the issue's repro with "cache": {"type": "faster", "is_guidance_distilled": true}: valid: true, no errors, no warnings.
    2. run_workflow on the same workflow (wait_seconds=600): job 86565f089aa5 succeeded in 75 s, one image in final/. Timing: passes: 20, cache.type: "faster", no warnings.
    3. run_workflow on the original repro ("cache": {"type": "faster"}, no key): job b328074bfa01 failed, as expected. The error now names the key instead of a bare tuple index out of range:
      Workflow execution error: Step 'black-forest-labs/FLUX.1-dev': the faster cache failed (tuple index out of range). It assumes a cond/uncond batch of 2; a guidance-distilled model (FLUX.1-dev) needs cache.is_guidance_distilled: true
    4. Adjacent case: validate_workflow with "is_guidance_distilled": "yes" is refused at steps[0].pipeline.configuration.cache.is_guidance_distilled: 'yes' is not of type 'boolean'.

    Both behaviours in the hand-off hold. Validate still passes the keyless faster on FLUX. That matches the triage scope (engine can't tell a distilled model from a CFG one).

    Small observation, not a bounce: the error labels the step 'black-forest-labs/FLUX.1-dev' (the model name), not the step name main. That looks like the existing step-label convention, not something this fix added.

    Both runs' outputs deleted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions