• Stefy Lanza (nextime / spora )'s avatar
    images: stop video's flash-attn backend leaking to image models (Z-Image attn_mask crash) · 0043eb2a
    Stefy Lanza (nextime / spora ) authored
    diffusers' Model.set_attention_backend() doesn't just set per-processor backends
    — it ALSO flips a process-wide active backend (attention_dispatch's
    _active_backend). The video path sets that to flash-attn for the Wan transformer;
    image and video share the nvidia-engine process, so the global stayed flash and
    leaked to the next image model. Z-Image's transformer sets no backend of its own
    (passes backend=None → uses the global) and its attention is masked, so it
    crashed with "`attn_mask` is not supported for flash-attn 2" → image/environment
    generation 400. reset_attention_backend() clears per-processor backends but NOT
    the global, so it didn't help.
    
    Fix: restore the diffusers global backend to the env default (native/SDPA)
    (a) before every image generation — bulletproof against a leaked flash backend —
    and (b) in the video pipeline teardown (_free_pipeline_vram), so it can't persist
    after a video pipe is freed. Masked image attention (SDPA) now always works; the
    video transformer keeps its own per-processor backend.
    Co-Authored-By: 's avatarClaude Opus 4.8 <noreply@anthropic.com>
    Claude-Session: https://claude.ai/code/session_01RdMufYvtTbtGDWsiZVoXce
    0043eb2a
Name
Last commit
Last update
codai Loading commit data...
docs Loading commit data...
packaging Loading commit data...
samples Loading commit data...
tests Loading commit data...
tools Loading commit data...
.dockerignore Loading commit data...
.gitignore Loading commit data...
AI.PROMPT Loading commit data...
CODERAI_API_DOCUMENTATION.md Loading commit data...
CoderAI.gif Loading commit data...
DISTRIBUTION.md Loading commit data...
LICENSE.md Loading commit data...
MULTIMODAL_CAPABILITIES.md Loading commit data...
MULTIMODAL_UI_EXAMPLES.md Loading commit data...
README.md Loading commit data...
build-oci.sh Loading commit data...
build.ps1 Loading commit data...
build.sh Loading commit data...
coderai Loading commit data...
coderai-broker-implementation-reference.md Loading commit data...
coderai-integration.md Loading commit data...
commands Loading commit data...
osxbuild.sh Loading commit data...
package-oci.sh Loading commit data...
package-tarball.sh Loading commit data...
requirements-nvidia.txt Loading commit data...
requirements-vulkan.txt Loading commit data...
requirements.txt Loading commit data...
run-oci.sh Loading commit data...
smoke-test-oci.sh Loading commit data...
todo.md Loading commit data...
video_editor.config.json Loading commit data...