Skip to content

feat: real-time denoising step progress during video generation#100

Open
Sergio Gil Jiménez (jimeneztion) wants to merge 2 commits intoLightricks:mainfrom
jimeneztion:feature/real-time-inference-progress
Open

feat: real-time denoising step progress during video generation#100
Sergio Gil Jiménez (jimeneztion) wants to merge 2 commits intoLightricks:mainfrom
jimeneztion:feature/real-time-inference-progress

Conversation

@jimeneztion
Copy link
Copy Markdown

Summary

Previously the progress bar used time-based interpolation — it estimated how
long inference would take and animated accordingly. Progress was a guess and
could be wildly off.

This PR wires actual denoising step counts from the model to the frontend so
the bar reflects real work done.

Backend: tqdm interceptor (ltx_fast_video_pipeline.py)

The denoising loop in ltx_pipelines uses tqdm internally with no callback
hook. We patch tqdm in ltx_pipelines.utils.samplers at call time using a
context manager (_tqdm_progress_interceptor) that wraps each iteration and
fires a StepCallback(current_step, total_steps). The patch is scoped to the
generate call and restores the original tqdm in a finally block.

The distilled fast pipeline runs 11 total denoising steps (8 stage 1 + 3 stage 2),
exposed as constants.

Backend: progress reporting (video_generation_handler.py)

A _on_denoising_step callback maps each step to a progress percentage:
15 + 75 * (step / total), covering inference from 15% to 90%. It calls
update_progress("inference", pct, current_step, total_steps) so the frontend
receives both the percentage and the raw step counts.

Frontend (frontend/hooks/use-generation.ts)

  • Replaces time-based inference interpolation with real currentStep /
    totalSteps from the backend SSE stream
  • Shows "Generating... (5/11)" during inference
  • Narrows loading-model interpolation from 15–95% to 5–12%
  • Adds idle response filtering: ignores SSE events with empty phase or
    status === 'idle'
  • Generalizes initial status message to "Loading model..."

How to test

  1. pnpm dev
  2. Start any video generation
  3. Progress bar should show "Generating... (1/11)""Generating... (11/11)"
    as denoising steps complete — not a smooth timer animation
  4. pnpm typecheck && pnpm backend:test

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant