Add optimized inference scripts, memory utilities, and Studio documentation#73
Open
MrEdwards007 wants to merge 6 commits intothu-ml:mainfrom
Open
Add optimized inference scripts, memory utilities, and Studio documentation#73MrEdwards007 wants to merge 6 commits intothu-ml:mainfrom
MrEdwards007 wants to merge 6 commits intothu-ml:mainfrom
Conversation
This is an optimized inference script for generating videos from a single input image and a text prompt. It features a Tiered Failover System to prevent "Out of Memory" (OOM) errors on consumer GPUs by automatically switching between high and low-noise models and utilizing tiled encoding/decoding. It is designed to maximize performance on hardware like the RTX 5090 while maintaining stability for high-resolution (720p) outputs.
This script handles video generation directly from text prompts. It includes Intelligent Hardware Detection to automatically select the best precision (BF16/FP16) for your GPU and a three-tier memory recovery system (GPU → Checkpointing → CPU Offloading). It also enforces safety checks, such as disabling torch.compile for quantized models to prevent system crashes during the diffusion process.
A utility script designed by John D. Pope to pre-compute and save text embeddings to a file. By "caching" these embeddings, you can run the main inference scripts without loading the heavy 11GB T5 Text Encoder into VRAM. This is essential for running the large 14B models on GPUs with limited memory, effectively "skipping" the most memory-intensive part of the initialization.
A Gradio-based dashboard that centralizes Text-to-Video and Image-to-Video workflows. It automates environment setup, provides real-time VRAM monitoring, and enforces the 4n+1 frame rule for VAE stability. It also supports automatic T5 caching and saves reproduction metadata for every video generated.
Readme for TurboDiffusion Studio , a unified, high-performance Gradio interface for Wan2.1 and Wan2.2 video generation that automates memory management through real-time VRAM monitoring and integrated T5 embedding caching.
logging
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.
This commit introduces the core optimized scripts and documentation for the TurboDiffusion framework:
TurboDiffusionStudio: (turbo_diffusion_t5_cache_optimize_v6.py) A unified Gradio-based Web interface for both Text-to-Video and Image-to-Video generation
All scripts include optimizations co-developed by Waverly Edwards and Google Gemini, and received support (cache_t5.py) by Johhn D. Pope, to maximize performance on consumer GPUs.
I was able to run this on a 5090, maxing out at 117 frames in 136 seconds (I2V) and 160 seconds (T2V), 16:9 aspect ratio using sagesla attention. Technically the T2V can be done in 126 seconds, using sla attention but I cant explain why sagesla seems to always outperform sla, except in this instance.
To reproduce without the gradio interface, utilize the committed files and this attached metadata, which can be used as a script.
t2v_20260101_085350_metadata.txt

i2v_20260101_063848_metadata.txt
(This is the original image used for I2V)
There are three anomalies.