fix: gate feature-injection kwargs on TensorRT backend in SD1.5/2.1 UNet call#32
Open
forkni wants to merge 1 commit into
Open
Conversation
…Net call (#12) The SD1.5/2.1 branch of unet_step() unconditionally passed kvo_cache/fio_cache/ fi_strength/fi_threshold to self.unet(...). The import-time diffusers patch (_patches/diffusers_kvo_patch.py) adds kvo_cache support to the eager PyTorch UNet, but feature injection is TensorRT-engine-only — the patched forward() has no fio_cache/fi_strength/fi_threshold parameters. Every non-TRT SD1.5/2.1 run (e.g. acceleration: none) crashed on the first call: UNet2DConditionModel.forward() got an unexpected keyword argument 'fio_cache' Mirrors the SDXL branch's existing _check_unet_tensorrt() gate: kvo_cache is always passed (both backends support it), the FI trio only when TRT is active. Adds tests/unit/test_unet_call_backend_gate.py, which reproduces the crash via a real (patched) tiny UNet2DConditionModel at the actual unet_step() call site and locks in that the TensorRT path keeps receiving all four cache kwargs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
StreamDiffusion.unet_step()'s SD1.5/2.1 branch unconditionally passedfio_cache/fi_strength/fi_thresholdtoself.unet(...). Those kwargs are TensorRT-engine-only (feature-injection); on any non-TRT backend (acceleration: none/xformers/sfast) this raisedTypeError: UNet2DConditionModel.forward() got an unexpected keyword argument 'fio_cache'on every frame.self._check_unet_tensorrt(); this fix applies the same gate to the SD1.5/2.1 branch.tests/unit/test_unet_call_backend_gate.py, a regression test that constructsStreamDiffusionvia__new__and drives the real call site with a real (patched) tiny UNet — no model download required.forkni/StreamDiffusion@SDTD_040_beta_release(internal PR feat: TRT 10.16.1.11 + FP8 quantization (V2V/CN/IPA) + CUDA hot-path optimizations #12).Test plan
SDTD_040_beta_releasetip, no conflicts.src/streamdiffusion/pipeline.py, newtests/unit/test_unet_call_backend_gate.py).