Commit Graph

159 Commits

Author SHA1 Message Date
Vladimir Mandic 98a7d17207 linting
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-03 22:05:33 +02:00
CalamitousFelicitousness 888cdd1eca feat(video): support first-last-frame for Wan 2.2 I2V
The I2V path forwards a last-frame image to the pipeline when one is supplied and the loaded pipeline accepts it, turning the run into first-last-frame interpolation. supports_last_frame() gates on the pipeline taking a last_image argument and not running expand_timesteps, which conditions on the first frame only, so a model that cannot use a last frame logs a warning instead of silently ignoring it.
2026-06-30 23:00:36 +01:00
CalamitousFelicitousness 10647c7b67 fix(video): apply Wan 2.2 MoE boundary at runtime in both image and video paths
Wan 2.2 A14B ships a per-model boundary_ratio (0.9 I2V, 0.875 T2V) that selects the high- or low-noise expert per step. The video and base-model image loaders both load the shipped value; the slider override is applied at generation time in set_pipeline_args, the one point both paths pass through before invoking the pipeline.

The denoising loop reads config.boundary_ratio each call, so tuning takes effect with no reload for video and base-model images alike. The slider defaults to -1, meaning use the model's value; 0 to 1 set the boundary explicitly. Single-expert stages stay load-time because they drop a transformer to free VRAM.
2026-06-30 23:00:26 +01:00
Vladimir Mandic 37f0d7c1c1 fix ltx
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-26 10:52:51 +02:00
Vladimir Mandic 8d71d5206d delay init of video models
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-20 10:28:46 +02:00
Vladimir Mandic 8f5759ac01 fix video prompt
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-16 08:47:19 +02:00
Vladimir Mandic 1a59647b12 cleanup
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-15 13:03:09 +02:00
QualiaRain 8a8d99019a fix: dead hasattr-on-dict path, double video-vae normalization, undefined self.device, hyimage if/elif, attention-mask attr typo, wrong face logged
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-12 13:00:57 -04:00
Vladimir Mandic 469428b502 update transformers/diffusers and enhanced tests
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-12 15:15:16 +02:00
Vladimir Mandic a664c33965 Merge pull request #4891 from ryanmeador/fix/video-thumbnail-toggle
feat(video): add thumbnail save toggle
2026-06-03 08:10:43 +02:00
Ryan Meador 11096bc0aa feat(video): add thumbnail save toggle 2026-06-02 23:43:58 -04:00
Ryan Meador 8085eadffb feat(video): save prompt metadata in mp4 2026-06-02 23:05:47 -04:00
Vladimir Mandic c319f8f92d refactor shared text encoder
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-01 10:03:10 +02:00
CalamitousFelicitousness 394d4e5b84 fix(ltx): patch connectors regression and group model dropdown
- monkey-patch LTX2ConnectorTransformer1d.forward to restore pre-#13564
  padding logic when the upstream torch.flip pattern is detected; fixes
  word-order scrambling in audio dialogue tracks
- reorganize LTX model entries into version-group separators (2.3 v1.1,
  2.3 v1.0, 2.0, 0.9.x) with base/distilled subgroups; separators are
  selectable no-ops handled in run_ltx
2026-05-21 03:01:51 +01:00
Vladimir Mandic f67562b912 - all guidance values set to -1 to enable using model defaults
- log default values used if not overriden by user
- rename inconsistent guidance variables:

p.cfg_scale
p.image_cfg_scale -> p.cfg_image
p.diffusers_guidance_rescale -> p.cfg_rescale
p.pag_scale -> p.cfg_true
p.pag_adaptive -> p.cfg_adaptive

Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-05-16 11:06:23 +02:00
Vladimir Mandic c8d6fd5cf8 Revert "much stricter ruff linting"
This reverts commit 310dbf1574.
2026-05-11 08:13:57 +02:00
Vladimir Mandic 310dbf1574 much stricter ruff linting
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-05-11 07:15:37 +02:00
CalamitousFelicitousness 506f5e1c29 fix(ltx): audio toggle ux and audio mux stream registration
relabel toggle to 'LTX save audio' (default true) since audio always
generates on 2.x audio-capable models; the toggle gates mux only. hint
added to locale_en.json.

split add_audio_stream from write_audio. avformat_write_header runs on
first container.mux() and freezes the stream set, so audio added after
video packets has time_base=0/0 and raises 'Cannot rebase to zero time.'
atomic_save_video registers the audio stream before the encode loop.
2026-05-02 19:38:08 +01:00
CalamitousFelicitousness 6acde69467 feat(video): route video pipelines through interpolation helper
LTX, video_run, and framepack_worker bypass process_images_inner, so
they call apply_video_interpolation explicitly before save_video. Save
receives already-inflated frames; the sentinel guard skips its own pass.

- LTX and video_run scale mp4_fps by interpolation_factor(p) so duration
  is preserved instead of stretched (LTX is conditioned on source fps)
- FramePack pre-divides at gen time per get_latent_paddings, so save fps
  stays at mp4_fps; worker passes p=None so save call uses
  mp4_interpolate=0 to skip directly
- replaces the inline (mp4_interpolate+1) fps math at LTX with the
  helper-driven equivalent
2026-04-26 03:08:19 +01:00
CalamitousFelicitousness e42f1fd8fb feat(video): video_interpolate as execution-time stage
Promote RIFE interpolation from a save-time kwarg to a real stage of the
processing pipeline so per-frame work (detailer, color correction,
postprocess scripts) operates on source-rate frames and the inflated
stream becomes the saved output.

- new modules/processing_video.py with apply_video_interpolation,
  interpolation_factor, expand_infotexts; PIL/tensor/numpy dispatch
- video_interpolate, video_interpolate_scale, video_interpolated fields
  on StableDiffusionProcessingVideo
- process_images_inner runs the helper after the batch loop and inflates
  infotexts in lockstep
- save_video in modules/video.py and modules/video_models/video_save.py
  short-circuit re-interpolation when p.video_interpolated is set; the
  user-facing kwarg still flows into metadata
2026-04-26 03:08:07 +01:00
CalamitousFelicitousness 121b357ba0 fix(video): normalize pixel range to [0,1] before RIFE
video_save passes [-1,1]-range pixels to rife.interpolate_nchw, but
RIFE v4.25's IFNet explicitly clamps inputs to [0,1] (Head and IFNet
forward pass), turning every negative pixel value into zero. v3.9
silently extrapolated and produced soft artifacts; v4.25 produces
washout. Convert to [0,1] before the RIFE call and back to [-1,1] for
downstream save.
2026-04-25 21:14:36 +01:00
CalamitousFelicitousness 4caf3f9495 fix(ltx): correct repo_cls for 2.3-1.1 I2V Distilled entries
Both 2.3-1.1 I2V Distilled entries (full and SDNQ-4Bit) advertised
LTX2Pipeline. ltx_capabilities derives is_i2v partly from the cls_name
check, so I2V code paths (input media UI, supports_input_media, latent
prep) were not engaged for these models.
2026-04-25 04:47:34 +01:00
CalamitousFelicitousness 7e5d040c4c refactor(ltx): address PR #4783 review threads 1, 3-6
LTXCaps gains a `variant` field ('0.9', '2.0', '2.3') replacing
`is_ltx_2_3`; variant-specific branches check `caps.variant == '2.3'`
instead of grepping the model name.

ltx_util.load_upsample_2x mirrors load_upsample's contract so the 2.x
path owns a module-level cache and stops reloading ~2.3 GB every run.
The cached pipe is stamped with a synthetic
`CheckpointInfo('ltx-upsampler-2.x')` so it gets its own OffloadHook
slot and can go through apply_balanced_offload without invalidating
the main pipe's module map. The hardcoded `.to('cpu')` and post-pass
torch_gc are gone; the second apply_balanced_offload handles spill.

video_overrides comment on OzzyGT LTX-2.3 connectors states plainly
that mirrors pack weights twice by design; ignore_patterns is the
surgical workaround, not an hf_hub bug.

Drive-by: load_upsample log line used `__class__.__name__` (always
'type'); switched to `__name__`.
2026-04-20 00:26:15 +01:00
CalamitousFelicitousness ef00f93570 fix(video): drop empty Model URL accordion on generic tab 2026-04-19 04:52:15 +01:00
CalamitousFelicitousness 44759f5f92 refactor(video): per-engine self-contained tab layout
Each engine tab (Generic, FramePack, LTX) now owns its own size, seed,
frame count, and init imagery. The previously shared Size and Inputs
subtabs are removed; persistent encoding settings move to a single
Output subtab constructed first so engine tabs can consume its widgets.
FramePack drops its local fps/interpolate sliders and consumes the
shared Output widgets; LTX drops the redundant shared init_image
parameter and keeps only its own ltx_init_image, with run_ltx's
condition_image fallback removed in turn.
2026-04-19 04:38:47 +01:00
CalamitousFelicitousness 19b930a221 feat(video): hide LTX engine from general video tab dropdown
The LTX tab owns LTX generation; keep the general video engine dropdown
from listing LTX so users have a single entry point per engine.
2026-04-19 03:42:51 +01:00
CalamitousFelicitousness 5cf46d2f81 feat(ltx): canonical LTX-2.x Stage 2 recipe (LoRA + guidance + connectors)
Implement the Lightricks two-stage recipe (diffusers PR #13217) for the
LTX-2.x Dev family: Stage 1 at half-res with full four-way guidance,
2x latent upsample, Stage 2 with distilled LoRA + scheduler swap + identity
guidance on STAGE_2_DISTILLED_SIGMA_VALUES.

Extends to both LTX-2.0 and LTX-2.3 Dev via per-family distilled-LoRA
repos carried on the caps; Distilled variants take the same flow minus
the LoRA swap. Auto-couples Refine with a fixed 2x upsample on any Dev
variant with a known LoRA when the user enables Refine without Upsample.

- caps: is_ltx_2_3, use_cross_timestep, default_dynamic_shift,
  stage2_dev_lora_repo, supports_canonical_stage2, modality_default_scale,
  guidance_rescale_default; LTX-2.x defaults realigned to canonical
  cfg=3.0 / steps=30; per-variant STG block and four-way guidance wired
  for non-distilled 2.x
- process: canonical Stage 1/Stage 2 helpers, scheduler + opts snapshot
  under try/finally, per-family upsampler repo, audio latents threaded
  from Stage 1 into Stage 2, use_cross_timestep gated per caps
- overrides: skip the redundant unsharded LTX-2.3 connectors blob and
  share LTX2TextConnectors weights across 2.3 variants when te_shared_t5
- load: Gemma3 shared-TE path for LTX-2.3; gate use_dynamic_shifting=False
  override to 0.9.x only so LTX-2.x stays on its canonical token-count
  dynamic shift
2026-04-19 03:37:25 +01:00
CalamitousFelicitousness 05abd99285 fix(video): invalidate ltx cache on pipe-class mismatch
Move cache tracking from ltx_util into video_load where shared.sd_model
lives, and invalidate the name-based hit when the cached class no longer
matches the current pipeline (e.g. after Unload Models triggers an
auto-reload of the default checkpoint).

- Drop the duplicate module-level loaded_model cache in ltx_util
- Add a pipe-class isinstance check around the cache hit in video_load
2026-04-19 03:36:16 +01:00
CalamitousFelicitousness acac6157b0 refactor(ltx): unify tab across 0.9.x and 2.x pipeline families
Rework the LTX Video tab so one UI handles every registered variant
(0.9.0 through 2.3, Dev/Distilled/SDNQ-4Bit, T2V/I2V/Condition). Per-
variant behavior is driven from a single capability lookup rather than
substring matching on model names scattered across the backend.

- modules/ltx/ltx_capabilities.py: new module computing family, is_i2v,
  distilled, supports_input_media, supports_multi_condition,
  supports_image_cond_noise_scale, supports_decode_timestep,
  supports_stg, supports_audio, supports_frame_rate_kwarg, and the
  default CFG / steps / sampler_shift for a given model name by reading
  its registered repo_cls in models_def.

- modules/ltx/ltx_ui.py: capability-gated UI. Selecting a model rewires
  accordion visibility, slider interactivity, and defaults via a single
  model.change handler. New controls: dedicated image input slot inside
  the LTX tab (replaces the disconnected shared init_image for I2V),
  condition strength slider, CFG / sampler shift / dynamic shift
  sliders that were previously unreachable. Input media accordion
  restructured so the image slot is always-visible while the video /
  gallery prefix tabs only appear on Condition pipelines.

- modules/ltx/ltx_process.py: route the base pass through
  processing.process_images(p) so LTX inherits standard scheduler
  wiring, extra_networks activation, VAE handling, and error plumbing
  from StableDiffusionProcessingVideo. The multi-pass latent path
  (upsample / refine) stays on direct pipeline calls for latent
  re-entry. Refine noise control gets family-specific kwargs:
  denoise_strength for 0.9.x LTXConditionPipeline, noise_scale for all
  2.x pipelines; the prior strength= injection crashed on 2.x and only
  affected conditioning intensity on 0.9.x. Add torch_gc between every
  stage boundary (base to upsample to refine to vae decode) so the
  CUDA allocator cache does not retain the prior pass's allocations
  across stages. Remove the TypeError fallback that silently passed
  raw latents to save_video when VAE decode returned None on OOM;
  those errors now surface cleanly.

- modules/ltx/ltx_util.py: get_conditions grows a family parameter and
  builds LTX2VideoCondition (frames, index, strength) for 2.x or
  LTXVideoCondition (image, video, frame_index, strength) for 0.9.x.
  get_bucket floors to max(32, vae_spatial_compression_ratio) since LTX
  pipelines validate divisibility by 32 regardless of family.

- modules/video_models/video_overrides.py: extend the I2V generator
  reset to cover LTX2ImageToVideoPipeline and both Condition classes.
  Keep the strength= kwarg injection gated to 0.9.x
  LTXConditionPipeline only; LTX2ConditionPipeline.__call__ does not
  accept it (per-condition strength lives on the LTX2VideoCondition
  dataclass instead).
2026-04-17 00:37:15 +01:00
CalamitousFelicitousness ca93f0b9b6 fix(video): correct pipeline classes for ltx 2.3 i2v and condition variants
The 2.3 I2V variants (Dev, Distilled, SDNQ-4Bit, Distilled SDNQ-4Bit)
were registered against LTX2Pipeline, whose __call__ does not accept an
image kwarg; init images were silently dropped. Route them through
LTX2ImageToVideoPipeline instead.

Also register the four 2.3 Condition variants under LTX2ConditionPipeline
so the multi-condition (image/video/gallery prefix) generation path is
reachable on LTX 2.3.
2026-04-17 00:37:15 +01:00
CalamitousFelicitousness 2f00a5764d fix(video): friendlier error messages for missing inputs
Replace "init image not set" / "last image not set" with actionable
messages that tell the user what to do. Matches the phrasing used by
the Caption tab for the same failure class.
2026-04-17 00:37:15 +01:00
vladmandic 7061672252 add ltx-2.3-1.1
Signed-off-by: vladmandic <mandic00@live.com>
2026-04-16 08:15:46 +02:00
CalamitousFelicitousness 0541843a86 fix(video): resolve outdir_video against outdir_samples 2026-04-15 23:03:15 +01:00
vladmandic ec1341348b update todo/changelog
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-30 12:19:36 +02:00
vladmandic ca2d49497b ltx test
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-30 11:16:55 +02:00
awsr 09ab19c438 RUF013 updates and formatting 2026-03-24 06:07:34 -07:00
vladmandic a72e3c4f29 merge: modules/video_models/video_run.py 2026-03-13 13:21:14 +01:00
vladmandic 24e3416e02 merge: modules/video_models/video_save.py 2026-03-12 14:16:51 +01:00
vladmandic afff46f2ac add google-flash-3.1-image
Signed-off-by: vladmandic <mandic00@live.com>
2026-02-27 10:53:22 +01:00
Vladimir Mandic d79d4edddb add explicit sdnq import
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-02-21 13:26:20 +00:00
Vladimir Mandic 4006b3e093 pylint 2026-02-19 11:36:20 +01:00
Vladimir Mandic e5c494f999 cleanup logger 2026-02-19 11:09:13 +01:00
Vladimir Mandic a3074baf8b unified logger 2026-02-19 09:46:42 +01:00
Vladimir Mandic bfe014f5da modernize typing 2026-02-19 09:15:37 +01:00
vladmandic da1cf2f996 refactor image methods
Signed-off-by: vladmandic <mandic00@live.com>
2026-02-11 12:29:00 +01:00
vladmandic cc03ebc584 move vae to subfolder
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-30 11:34:25 +01:00
Ryan Meador e6eeb22a81 fix/add element names for some video controls that were duplicate/missing 2026-01-21 19:53:11 -05:00
vladmandic 84ad7bf20b improve wrap_gradio_call
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-20 18:56:49 +01:00
Vladimir Mandic d934920c23 cleanup
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-01-16 17:34:34 +00:00
Vladimir Mandic 05b919f35b ltx2 improvements
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-01-16 17:31:56 +00:00