Update app.py
Browse files1 unmodified line23456789101124 unmodified lines3637383940414243656 unmodified lines7007017027037047051 unmodified lineimport subprocessimport sys# Disable torch.compile / dynamo before any torch importos.environ["TORCH_COMPILE_DISABLE"] = "1"os.environ["TORCHDYNAMO_DISABLE"] = "1"# Clone LTX-2 repo and install packagesLTX_REPO_URL = "https://github.com/Lightricks/LTX-2.git"LTX_REPO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "LTX-2")24 unmodified linesimport hashlibimport torchtorch._dynamo.config.suppress_errors = Truetorch._dynamo.config.disable = Trueimport spacesimport gradio as gr656 unmodified linesprint("Pipeline ready!")print("=" * 80)def log_memory(tag: str):if torch.cuda.is_available():allocated = torch.cuda.memory_allocated() / 1024**31 unmodified line23456724 unmodified lines3233343536373839656 unmodified lines6966976986997007017027037047057067077087097107117127131 unmodified lineimport subprocessimport sys# Clone LTX-2 repo and install packagesLTX_REPO_URL = "https://github.com/Lightricks/LTX-2.git"LTX_REPO_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "LTX-2")24 unmodified linesimport hashlibimport torchtorch._dynamo.config.suppress_errors = Falsetorch._dynamo.config.disable = Falseimport spacesimport gradio as gr656 unmodified linesprint("Pipeline ready!")print("=" * 80)# AFTER your preload block, compile the transformerprint("Compiling transformer with torch.compile...")# Regional compilation on transformer_blocks is best for DiT models# This compiles the repeated BasicAVTransformerBlock layers and reuses the graph_transformer = torch.compile(_transformer,mode="max-autotune",fullgraph=False, # safer; set True if no graph breaksdynamic=False, # critical: must be False for fixed shapes per generation)def log_memory(tag: str):if torch.cuda.is_available():allocated = torch.cuda.memory_allocated() / 1024**3
app.py+14-6