Spaces:
Running on Zero
Running on Zero
Update app.py
#10
by dabangboss - opened
app.py
CHANGED
|
@@ -102,26 +102,42 @@ pipeline = DistilledPipeline(
|
|
| 102 |
)
|
| 103 |
|
| 104 |
# Preload all models for ZeroGPU tensor packing.
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
print("=" * 80)
|
| 127 |
print("Pipeline ready!")
|
|
@@ -259,7 +275,7 @@ with gr.Blocks(title="LTX-2.3 Distilled") as demo:
|
|
| 259 |
lines=3,
|
| 260 |
placeholder="Describe the motion and animation you want...",
|
| 261 |
)
|
| 262 |
-
|
| 263 |
with gr.Row():
|
| 264 |
duration = gr.Slider(label="Duration (seconds)", minimum=1.0, maximum=10.0, value=3.0, step=0.1)
|
| 265 |
with gr.Column():
|
|
@@ -308,5 +324,4 @@ css = """
|
|
| 308 |
"""
|
| 309 |
|
| 310 |
if __name__ == "__main__":
|
| 311 |
-
demo.launch(theme=gr.themes.Citrus(), css=css)
|
| 312 |
-
|
|
|
|
| 102 |
)
|
| 103 |
|
| 104 |
# Preload all models for ZeroGPU tensor packing.
|
| 105 |
+
# DistilledPipeline does NOT have model_ledger — inspect at runtime instead.
|
| 106 |
+
print("Inspecting DistilledPipeline internals for ZeroGPU preloading...")
|
| 107 |
+
_model_attrs = [a for a in dir(pipeline) if not a.startswith('_')]
|
| 108 |
+
print(f"Available attributes: {_model_attrs}")
|
| 109 |
+
|
| 110 |
+
_preloaded = []
|
| 111 |
+
for attr_name in _model_attrs:
|
| 112 |
+
try:
|
| 113 |
+
val = getattr(pipeline, attr_name)
|
| 114 |
+
if isinstance(val, torch.nn.Module):
|
| 115 |
+
val.eval()
|
| 116 |
+
_preloaded.append(attr_name)
|
| 117 |
+
print(f" Preloaded module: pipeline.{attr_name}")
|
| 118 |
+
except Exception:
|
| 119 |
+
pass
|
| 120 |
+
|
| 121 |
+
# Also check inner dicts like _models, models, components, etc.
|
| 122 |
+
for inner in ['_models', 'models', '_components', 'components']:
|
| 123 |
+
if hasattr(pipeline, inner):
|
| 124 |
+
container = getattr(pipeline, inner)
|
| 125 |
+
if isinstance(container, dict):
|
| 126 |
+
for k, v in container.items():
|
| 127 |
+
if isinstance(v, torch.nn.Module):
|
| 128 |
+
v.eval()
|
| 129 |
+
_preloaded.append(f"{inner}['{k}']")
|
| 130 |
+
print(f" Preloaded module: pipeline.{inner}['{k}']")
|
| 131 |
+
elif isinstance(container, torch.nn.Module):
|
| 132 |
+
container.eval()
|
| 133 |
+
_preloaded.append(inner)
|
| 134 |
+
print(f" Preloaded module: pipeline.{inner}")
|
| 135 |
+
|
| 136 |
+
if not _preloaded:
|
| 137 |
+
print("WARNING: Could not preload any sub-modules. "
|
| 138 |
+
"The pipeline will load models on first __call__.")
|
| 139 |
+
else:
|
| 140 |
+
print(f"Preloaded {len(_preloaded)} sub-module(s) total.")
|
| 141 |
|
| 142 |
print("=" * 80)
|
| 143 |
print("Pipeline ready!")
|
|
|
|
| 275 |
lines=3,
|
| 276 |
placeholder="Describe the motion and animation you want...",
|
| 277 |
)
|
| 278 |
+
|
| 279 |
with gr.Row():
|
| 280 |
duration = gr.Slider(label="Duration (seconds)", minimum=1.0, maximum=10.0, value=3.0, step=0.1)
|
| 281 |
with gr.Column():
|
|
|
|
| 324 |
"""
|
| 325 |
|
| 326 |
if __name__ == "__main__":
|
| 327 |
+
demo.launch(theme=gr.themes.Citrus(), css=css)
|
|
|