Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(ltx2): size the LoRA reservation from the patches, not a per-LoRA constant
Lincoln Stein48e4e8812f90
diff --git a/invokeai/app/invocations/ltx2/ltx2_denoise.py b/invokeai/app/invocations/ltx2/ltx2_denoise.pyindex ecf44c8861..d41c3be666 100644--- a/invokeai/app/invocations/ltx2/ltx2_denoise.py+++ b/invokeai/app/invocations/ltx2/ltx2_denoise.py@@ -1,5 +1,6 @@"""LTX-2 denoise: joint video and audio sampling from one transformer."""+from contextlib import nullcontextfrom typing import Literalimport torch@@ -229,7 +230,7 @@ class LTX2DenoiseInvocation(BaseInvocation):return patch_specs@staticmethod- def _estimate_working_memory(video_rows: int, audio_rows: int, num_loras: int = 0) -> int:+ def _estimate_working_memory(video_rows: int, audio_rows: int, patch_bytes: int = 0) -> int:"""Estimate peak transformer activation bytes so the model cache reserves enough headroom.The 22B transformer is partially loaded on any card this runs on, and without a hint the@@ -258,18 +259,30 @@ class LTX2DenoiseInvocation(BaseInvocation):"""MiB = 1024**2estimated = video_rows * int(MiB // 4.5) + audio_rows * (MiB // 10) + 1024**3- if num_loras > 0:- # A sidecar-patched layer (which is every layer on a quantized base) transiently holds- # the dequantized weight AND a second output for the low-rank residual, on top of the- # patch tensors themselves resident on device. The distilled accelerator is rank 450- # over 1660 layers, which is ~8.3 GiB of patch in bf16 -- far the largest term, and the- # one the cache would otherwise not know about at all.- estimated += 2 * 1024**3 + num_loras * 9 * 1024**3+ if patch_bytes > 0:+ # `patch_bytes` is what the patches actually weigh, and is passed as zero unless they+ # will be sidecar-patched: the direct path returns each patch to the CPU as it goes, so+ # nothing of it stays resident. The extra gibibyte covers the transient a sidecar layer+ # holds while it computes the low-rank residual -- a second copy of that layer's output,+ # alongside the dequantized weight the term above already accounts for.+ estimated += patch_bytes + 1024**3return estimated- def _resolve_distilled(self) -> bool:+ def _resolve_distilled(self, context: InvocationContext) -> bool:if self.schedule != "auto":return self.schedule == "distilled"+ if self.transformer.loras:+ # `auto` follows the transformer's *variant*, which names the checkpoint -- and a LoRA+ # does not change it. A step-distillation LoRA on a Dev checkpoint therefore resolves to+ # the guided ~30-step schedule and samples the LoRA's 8 steps on it, which produces a+ # broken clip and looks like a broken model rather than a wiring mistake. The panel sets+ # `schedule` explicitly for this reason; a hand-built graph has to be told.+ context.logger.warning(+ "LTX-2 schedule is Auto with %d LoRA(s) applied. Auto follows the checkpoint, which a LoRA "+ "does not change -- if one of these is a step-distillation LoRA, set Schedule to 'Distilled' "+ "or the run will sample its step count on the guided schedule.",+ len(self.transformer.loras),+ )if self.transformer.variant is None:raise ValueError("The schedule is set to Auto but the transformer carries no variant, so there is nothing to "@@ -442,7 +455,7 @@ class LTX2DenoiseInvocation(BaseInvocation):{"fps": (self.full_video_conditioning.fps, self.fps)},)- distilled = self._resolve_distilled()+ distilled = self._resolve_distilled(context)guidance = self._resolve_guidance(context, distilled)if distilled and self.steps != LTX2_DISTILLED_STEPS:context.logger.info(@@ -518,41 +531,61 @@ class LTX2DenoiseInvocation(BaseInvocation):device = TorchDevice.choose_torch_device()inference_dtype = TorchDevice.choose_bfloat16_safe_dtype(device)+ transformer_info = context.models.load(self.transformer.transformer)+ transformer_config = context.models.get_config(self.transformer.transformer)++ # Materialized before the model lock: loading a LoRA takes the cache's own lock, and doing+ # that while holding this one is the deadlock `apply_smart_model_patches` documents. It also+ # has to happen before the reservation below, which is sized from these patches.+ lora_patch_specs = self._materialize_lora_patches(context)+ # Resolved from the unlocked model, like the dequant transient below: only a build whose+ # weights are buffers rather than parameters takes the sidecar path, and only that path+ # leaves patch tensors on the device.+ # Walks the whole 22B module tree, so it is only asked when there is something to patch.+ force_sidecar = bool(lora_patch_specs) and requires_sidecar_patching(+ transformer_info.model, transformer_config.format+ )+estimated_working_memory = self._estimate_working_memory(# The sequence as built, not the grid: a held keyframe rides on the end of it and is# attended over in every forward -- 858 rows on top of 13728 at 1248x704 x121 -- and the# fit is tightest exactly where running out is most expensive.state.video_latents.shape[1],state.audio_latents_count,- len(self.transformer.loras),+ # The patches' own byte count, not a per-LoRA guess. This reservation is subtracted from+ # VRAM *before* any weight streams in, so over-reserving is not free -- it directly buys+ # fewer resident transformer weights, and a blind constant large enough for the rank-450+ # distilled accelerator (8.3 GiB) would cost a rank-16 style LoRA the same.+ sum(spec[0].calc_size() for spec in lora_patch_specs) if force_sidecar else 0,)-- transformer_info = context.models.load(self.transformer.transformer)# An int8-convrot build materializes each linear's dequantized weight inside the forward,# which the model's resident size does not account for. Read from the unlocked model, before# the VRAM lock the reservation applies to; zero on a bf16 build.estimated_working_memory += peak_dequant_transient_bytes(transformer_info.model, inference_dtype)- # Materialized before the model lock: loading a LoRA takes the cache's own lock, and doing- # that while holding this one is the deadlock `apply_smart_model_patches` documents.- lora_patch_specs = self._materialize_lora_patches(context)- transformer_config = context.models.get_config(self.transformer.transformer)-with (transformer_info.model_on_device(working_mem_bytes=estimated_working_memory) as (cached_weights,transformer,),- LayerPatcher.apply_smart_model_patches(- model=transformer,- patches=lora_patch_specs,- prefix=LTX2_LORA_TRANSFORMER_PREFIX,- dtype=inference_dtype,- cached_weights=cached_weights,- # An int8-convrot / nvfp4 build keeps its weights as buffers rather than parameters,- # so the patcher's own fp8 and CPU fallbacks would answer "not quantized" and merge- # the delta into a weight that is never read. This is the only reliable signal.- force_sidecar_patching=requires_sidecar_patching(transformer, transformer_config.format),+ # Skipped entirely when there is nothing to patch: entering it takes the loader lock+ # and copies the cached-weight mapping, neither of which an unaccelerated run should+ # pay for. Same guard MiniMax H3 uses.+ (+ LayerPatcher.apply_smart_model_patches(+ model=transformer,+ patches=lora_patch_specs,+ prefix=LTX2_LORA_TRANSFORMER_PREFIX,+ dtype=inference_dtype,+ cached_weights=cached_weights,+ # An int8-convrot / nvfp4 build keeps its weights as buffers rather than+ # parameters, so the patcher's own fp8 and CPU fallbacks would answer "not+ # quantized" and merge the delta into a weight that is never read. This is the+ # only reliable signal.+ force_sidecar_patching=force_sidecar,+ )+ if lora_patch_specs+ else nullcontext()),):require_patch_geometry(transformer.config)diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.tsindex 870c0c0c7b..7c1f026dd4 100644--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.test.ts@@ -460,30 +460,105 @@ describe('LTX-2 distilled accelerator', () => {);});- it('brings the negative prompt back if a scale is raised with the toggle still on', () => {- // Off-recipe but legal. What must not happen is the field staying hidden while the prompt- // silently counts again -- the graph wires it whenever a scale is above 1, toggle or no toggle.+ it('stops offering every control the distilled path would ignore', () => {+ // The graph sends `schedule: 'distilled'` whenever the accelerator is on, and the backend then+ // DISCARDS the guidance scales and the step count (`_resolve_guidance` and the step clamp both+ // log that they are ignoring what was asked). Leaving those scrubbers editable would let a user+ // set a value, see it accepted, and get a run that silently used something else.const model = ltx2('ltx2_dev');- const raisedVideoCfg = getVideoPromptPolicy(model, {+ const guided = getVideoModelPolicy(model, getDefaultVideoSettings(model, []));+ const accelerated = getVideoModelPolicy(model, {+ ...getDefaultVideoSettings(model, []),acceleratorEnabled: true,- audioCfgScale: 1,+ });++ expect(guided.ui).toMatchObject({+ audioCfgVisible: true,+ cfgVisible: true,+ modalityVisible: true,+ stepsEditable: true,+ stgVisible: true,+ });+ expect(accelerated.ui).toMatchObject({+ audioCfgVisible: false,+ cfgVisible: false,+ modalityVisible: false,+ stepsEditable: false,+ stgVisible: false,+ });+ // Same presentation the distilled checkpoint gives, which is the model this now is.+ const checkpoint = getVideoModelPolicy(ltx2('ltx2_distilled'), getDefaultVideoSettings(ltx2('ltx2_distilled')));++ expect(accelerated.ui.stepsEditable).toBe(checkpoint.ui.stepsEditable);+ expect(accelerated.ui.cfgVisible).toBe(checkpoint.ui.cfgVisible);+ expect(accelerated.prompt.negativeVisible).toBe(checkpoint.prompt.negativeVisible);+ });++ it('restores the whole recipe when the accelerator LoRA is disabled, not just steps and CFG', () => {+ // Turning the accelerator off by unticking its LoRA in Concepts goes through a different path+ // than the toggle. If that path restores only steps and CFG, the run is the undistilled Dev+ // model with audio CFG, modality and STG still pinned at the accelerator's identity values --+ // guided sampling with three quarters of its guidance off, and nothing says so.+ const model = ltx2('ltx2_dev');+ const on = getAcceleratorToggleResult(getDefaultVideoSettings(model, []), model, [DISTILLED], true).settings;+ const disabled = on.loras.map((entry) => ({ ...entry, isEnabled: false }));+ const result = getAcceleratorLoraChangeResult({ ...on, loras: disabled }, model, [DISTILLED], disabled);++ expect(result.outcome).toBe('disabled');+ expect(result.settings).toMatchObject({+ acceleratorEnabled: false,+ audioCfgScale: 7,cfgScale: 3,- cfgScaleLowNoise: null,- negativePromptEnabled: true,- wanLowNoiseModel: null,+ modalityScale: 3,+ steps: 30,+ stgScale: 1,});- // LTX-2's audio stream is guided on its own scale, so it alone is enough.- const raisedAudioCfg = getVideoPromptPolicy(model, {+ });++ it('treats the negative prompt as unused even if a stale scale says otherwise', () => {+ // The panel cannot produce this, but recall can: metadata carrying a guided CFG alongside the+ // accelerator's LoRA set. The graph still sends `schedule: 'distilled'` whenever the toggle is+ // on, and the backend discards the scale -- so the answer must follow the accelerator, not the+ // stale number, or the panel claims a prompt is in use that the run throws away.+ const policy = getVideoPromptPolicy(ltx2('ltx2_dev'), {acceleratorEnabled: true,audioCfgScale: 7,- cfgScale: 1,+ cfgScale: 3,cfgScaleLowNoise: null,negativePromptEnabled: true,wanLowNoiseModel: null,});- expect(raisedVideoCfg).toMatchObject({ negativeUsedInGraph: true, negativeVisible: true });- expect(raisedAudioCfg).toMatchObject({ negativeUsedInGraph: true, negativeVisible: true });+ expect(policy).toMatchObject({ negativeUsedInGraph: false, negativeVisible: false });+ });++ it('writes the guidance recipe when the accelerator LoRA is swapped for another', () => {+ // The recorded LoRA is gone and a replacement is found, so the accelerator stays on under a+ // different file. That path has to write the same recipe the toggle does, or the swap silently+ // leaves guidance wherever it happened to be.+ const model = ltx2('ltx2_dev');+ const settings = {+ ...getDefaultVideoSettings(model, []),+ acceleratorEnabled: true,+ acceleratorLoraKeys: ['a-release-that-is-gone'],+ audioCfgScale: 7,+ cfgScale: 3,+ modalityScale: 3,+ stgScale: 1,+ };+ // The distilled LoRA is present and on; the key the toggle recorded is not.+ const present = [{ isEnabled: true, model: DISTILLED, weight: 1 }];+ const result = getAcceleratorLoraChangeResult({ ...settings, loras: present }, model, [DISTILLED], present);++ expect(result.outcome).toBe('switched');+ expect(result.settings).toMatchObject({+ acceleratorEnabled: true,+ audioCfgScale: 1,+ cfgScale: 1,+ modalityScale: 1,+ steps: 8,+ stgScale: 0,+ });});it('leaves families whose accelerator keeps guidance alone', () => {diff --git a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.tsindex 5ed00aa0ac..3269f24626 100644--- a/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts+++ b/invokeai/frontend/webv2/src/features/video/core/videoPolicies.ts@@ -697,6 +697,24 @@ export const getEffectiveVideoTiming = (};};+/**+ * Whether the run is guidance-free because an accelerator made it so.+ *+ * An accelerator that declares a guidance triple drives every scale to its identity AND makes the+ * graph send `schedule: 'distilled'`. The backend then *discards* the guidance scales and the step+ * count outright (`_resolve_guidance` and the step clamp in `ltx2_denoise.py`, both of which log+ * that they are ignoring what was asked). So those controls are not merely redundant while the+ * accelerator is on -- they cannot take effect at all, and the panel must stop offering them.+ *+ * Which is to say: an accelerated Dev model *is* the family's distilled variant, and presents like+ * it. Families whose accelerator declares no guidance (Wan, MiniMax H3) only change steps and CFG+ * and are unaffected.+ */+const isGuidanceDistilled = (+ config: VideoVariantConfig,+ settings: Pick<VideoSettings, 'acceleratorEnabled'>+): boolean => settings.acceleratorEnabled && config.accelerator?.guidance !== undefined;+export const getVideoPromptPolicy = (model: MainModelConfig | undefined,settings: Pick<@@ -728,18 +746,18 @@ export const getVideoPromptPolicy = (// CFG of 1 that disabled it: the toggle did. Families whose accelerator declares no guidance// (Wan, MiniMax H3) are unaffected.//- // Gated on guidance being actually inactive, not merely on the toggle: raising a scale back above- // 1 with the accelerator still on is off-recipe but legal, and it makes the negative prompt count- // again -- so the field has to come back rather than stay hidden while silently taking effect.- const guidanceActive = settings.cfgScale > 1 || lowNoiseCfgActive || audioCfgActive;- const hiddenByAccelerator =- settings.acceleratorEnabled && config.accelerator?.guidance !== undefined && !guidanceActive;+ // Not conditioned on the live scale values: with the accelerator on the backend discards them, so+ // there is no state in which raising one makes the negative prompt count again. The scales are+ // not editable in that state either (see `isGuidanceDistilled`), so this cannot strand a value.+ const guidanceDistilled = isGuidanceDistilled(config, settings);const negativeUsedInGraph =+ !guidanceDistilled &&settings.negativePromptEnabled &&- (config.negativePrompt.usage === 'always' || (config.negativePrompt.usage === 'cfg-gated' && guidanceActive));+ (config.negativePrompt.usage === 'always' ||+ (config.negativePrompt.usage === 'cfg-gated' && (settings.cfgScale > 1 || lowNoiseCfgActive || audioCfgActive)));return {- negativeVisible: config.negativePrompt.visible && !hiddenByAccelerator,+ negativeVisible: config.negativePrompt.visible && !guidanceDistilled,negativeUsedInGraph,...(config.negativePrompt.usage === 'cfg-gated' ? { negativeHelpTextKey: 'widgets.video.negativeCfgHelp' } : {}),};@@ -796,6 +814,9 @@ export const getVideoModelPolicy = (model: MainModelConfig | undefined, settings// The H3 task (fl2va vs ref2va) lives on the selected model itself: a// single-file transformer checkpoint carries its own variant.const config = getVideoConfig(model);+ // With an accelerator that removes guidance, the backend ignores the scales and the step count+ // outright, so the panel stops offering the controls it would ignore.+ const guidanceDistilled = isGuidanceDistilled(config, settings);return {aspectRatioOptions: getVideoAspectRatioOptions(model),@@ -812,7 +833,7 @@ export const getVideoModelPolicy = (model: MainModelConfig | undefined, settingstargetResolutions: config.targetResolutions,ui: {accelerator: config.accelerator,- audioCfgVisible: config.guidance.audioVisible,+ audioCfgVisible: config.guidance.audioVisible && !guidanceDistilled,// The step count the help text quotes is the one the *running*// accelerator LoRA was distilled for — with the 8-step LightX2V Turbo// LoRA on, "6 steps" would be a lie. It is deliberately NOT folded into@@ -822,12 +843,14 @@ export const getVideoModelPolicy = (model: MainModelConfig | undefined, settings? getAcceleratorSteps(config.accelerator, getRecordedAcceleratorLoras(settings)): null,audioOutput: config.audioOutput,- cfgLowNoiseVisible: config.cfg.lowNoiseVisible,- cfgVisible: config.cfg.visible,+ cfgLowNoiseVisible: config.cfg.lowNoiseVisible && !guidanceDistilled,+ cfgVisible: config.cfg.visible && !guidanceDistilled,fpsVisible: config.fps.editable,- modalityVisible: config.guidance.modalityVisible,- stepsEditable: config.stepsEditable,- stgVisible: config.guidance.stgVisible,+ modalityVisible: config.guidance.modalityVisible && !guidanceDistilled,+ // The distilled schedule is a fixed step count the backend clamps to; an editable scrubber+ // here would silently do nothing.+ stepsEditable: config.stepsEditable && !guidanceDistilled,+ stgVisible: config.guidance.stgVisible && !guidanceDistilled,},};};@@ -1304,6 +1327,7 @@ export const getAcceleratorLoraChangeResult = (acceleratorLoraKeys: replacement.map((lora) => lora.key),cfgScale: config.accelerator.cfgScale,cfgScaleLowNoise: config.accelerator.cfgScaleLowNoise,+ ...config.accelerator.guidance,steps: getAcceleratorSteps(config.accelerator, replacement),},};@@ -1318,6 +1342,17 @@ export const getAcceleratorLoraChangeResult = (acceleratorLoraKeys: [],cfgScale: config.defaults.cfgScale,cfgScaleLowNoise: config.defaults.cfgScaleLowNoise,+ // The same restore the toggle-off path does. Without it, turning the accelerator off by+ // disabling its LoRA leaves the extra scales at the identity values the accelerator wrote --+ // a guided run with three quarters of its guidance silently off, which is the washed-out+ // output this file works to prevent. Only for accelerators that set them in the first place.+ ...(config.accelerator?.guidance+ ? {+ audioCfgScale: config.defaults.audioCfgScale,+ modalityScale: config.defaults.modalityScale,+ stgScale: config.defaults.stgScale,+ }+ : {}),steps: config.defaults.steps,},};diff --git a/tests/app/invocations/test_ltx2_nodes.py b/tests/app/invocations/test_ltx2_nodes.pyindex d0f7563e8b..6aa780f4a7 100644--- a/tests/app/invocations/test_ltx2_nodes.py+++ b/tests/app/invocations/test_ltx2_nodes.py@@ -34,6 +34,7 @@ from invokeai.app.invocations.ltx2.ltx2_latent_upsample import LTX2LatentUpsamplfrom invokeai.app.invocations.ltx2.ltx2_model_loader import LTX2ModelLoaderInvocationfrom invokeai.app.invocations.ltx2.ltx2_video_conditioning import LTX2VideoConditioningInvocationfrom invokeai.app.invocations.model import (+ LoRAField,LTX2LatentUpsamplerField,LTX2TransformerField,LTX2VocoderField,@@ -92,13 +93,13 @@ def test_the_schedule_follows_the_variant_unless_it_is_set_explicitly("""Sampling a distilled checkpoint on the dev schedule returns noise, so the default reads thevariant the loader stamped rather than trusting a literal in the graph."""node = _denoise(transformer=LTX2TransformerField(transformer=_identifier(), variant=variant), schedule=schedule)- assert node._resolve_distilled() is expected+ assert node._resolve_distilled(_context()) is expecteddef test_an_unstamped_transformer_cannot_resolve_the_schedule_automatically() -> None:node = _denoise(transformer=LTX2TransformerField(transformer=_identifier(), variant=None), schedule="auto")with pytest.raises(ValueError, match="Auto"):- node._resolve_distilled()+ node._resolve_distilled(_context())def test_the_distilled_schedule_ignores_the_guidance_scales_and_says_so() -> None:@@ -1378,21 +1379,64 @@ def test_a_last_frame_encode_wired_into_the_first_frame_slot_is_refused() -> Nonnode._load_image_latents(_context())-def test_the_reservation_grows_with_the_loras_that_will_be_patched_in() -> None:- """A LoRA is not free headroom. The distilled accelerator is rank 450 over 1660 layers -- about- 8.3 GiB of patch tensors in bf16 -- plus the transient a sidecar-patched layer holds while it- computes the low-rank residual. Reserving the same bytes with and without it packs VRAM with- weights and dies in the first forward."""+def test_the_reservation_is_sized_from_what_the_patches_weigh() -> None:+ """The reservation is subtracted from VRAM *before* any weight streams in, so it is not a+ ceiling -- every byte over-reserved is a byte of transformer that stays in host RAM and is+ streamed each forward. A per-LoRA constant big enough for the rank-450 distilled accelerator+ (8.3 GiB over 1660 layers) would charge a rank-16 style LoRA the same, and two of them would+ exceed a 24 GB card's whole budget on their own."""node_type = LTX2DenoiseInvocationrows, audio = 13728, 300+ small, large = 8 * 1024**2, 9 * 1024**3bare = node_type._estimate_working_memory(rows, audio)- with_one = node_type._estimate_working_memory(rows, audio, 1)- with_two = node_type._estimate_working_memory(rows, audio, 2)- assert with_one > bare- # The per-LoRA term dominates, so a second LoRA has to add roughly as much as the first.- assert with_two - with_one >= 8 * 1024**3+ # Proportional to the patch, not to the count.+ assert node_type._estimate_working_memory(rows, audio, small) - bare == small + 1024**3+ assert node_type._estimate_working_memory(rows, audio, large) - bare == large + 1024**3+ # A small LoRA must not be charged like a large one -- the defect a flat constant has.+ assert (+ node_type._estimate_working_memory(rows, audio, large)+ > node_type._estimate_working_memory(rows, audio, small) + 8 * 1024**3+ )+++def test_an_auto_schedule_with_a_lora_applied_says_so() -> None:+ """`auto` follows the transformer's VARIANT, which names the checkpoint -- and a LoRA does not+ change it. A step-distillation LoRA on a Dev checkpoint therefore resolves to the guided+ ~30-step schedule and samples the LoRA's 8 steps on it. The panel sets `schedule` explicitly to+ avoid this; a hand-built graph (or the shipped workflow, whose default is `auto`) cannot be told+ any other way, and the resulting clip looks like a broken model rather than a wiring mistake."""+ node = _denoise(+ num_frames=121,+ transformer=LTX2TransformerField(+ transformer=_identifier("transformer"),+ loras=[LoRAField(lora=_identifier("distilled-lora"), weight=1.0)],+ variant="ltx2_dev",+ ),+ )+ context = _context()++ assert node._resolve_distilled(context) is False+ warning = " ".join(str(call) for call in context.logger.warning.call_args_list)+ assert "Distilled" in warning++ # Said once, and only when it could be wrong: no LoRAs, or an explicit schedule, stays quiet.+ quiet = _context()+ _denoise(num_frames=121, schedule="distilled")._resolve_distilled(quiet)++ assert quiet.logger.warning.call_count == 0+++def test_a_directly_patched_lora_reserves_nothing_for_itself() -> None:+ """Only the sidecar path leaves patch tensors on the device; the direct path returns each patch+ to the CPU as it applies it. The caller passes zero for that case, and charging for it anyway+ would cost a bf16 run -- the shipped Dev starter -- gigabytes of residency for nothing."""+ rows, audio = 13728, 300++ assert LTX2DenoiseInvocation._estimate_working_memory(+ rows, audio, 0+ ) == LTX2DenoiseInvocation._estimate_working_memory(rows, audio)def test_the_reservation_covers_the_keyframe_rows_the_transformer_attends_over(monkeypatch) -> None: