Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -184,26 +184,36 @@ print("=" * 80)
|
|
| 184 |
print("Preloading all models for ZeroGPU tensor packing...")
|
| 185 |
print("This may take a few minutes...")
|
| 186 |
|
| 187 |
-
# Access
|
| 188 |
-
#
|
| 189 |
-
_transformer = pipeline.stage_1.transformer
|
| 190 |
_video_encoder = pipeline.prompt_encoder.video_encoder
|
| 191 |
_video_decoder = pipeline.video_decoder
|
| 192 |
_audio_decoder = pipeline.audio_decoder
|
| 193 |
_spatial_upsampler = pipeline.upsampler
|
|
|
|
| 194 |
|
| 195 |
-
# Trigger actual loading by
|
| 196 |
-
#
|
| 197 |
-
print(" Loading transformer...")
|
| 198 |
-
_transformer()
|
| 199 |
print(" Loading video encoder...")
|
| 200 |
-
_video_encoder
|
| 201 |
print(" Loading video decoder...")
|
| 202 |
-
_video_decoder
|
| 203 |
print(" Loading audio decoder...")
|
| 204 |
-
_audio_decoder
|
| 205 |
print(" Loading spatial upsampler...")
|
| 206 |
-
_spatial_upsampler
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
|
| 208 |
print("All models preloaded for ZeroGPU tensor packing!")
|
| 209 |
print("=" * 80)
|
|
|
|
| 184 |
print("Preloading all models for ZeroGPU tensor packing...")
|
| 185 |
print("This may take a few minutes...")
|
| 186 |
|
| 187 |
+
# Access pipeline components to force tensor loading
|
| 188 |
+
# TI2VidTwoStagesHQPipeline exposes these as class attributes (not through a ledger)
|
|
|
|
| 189 |
_video_encoder = pipeline.prompt_encoder.video_encoder
|
| 190 |
_video_decoder = pipeline.video_decoder
|
| 191 |
_audio_decoder = pipeline.audio_decoder
|
| 192 |
_spatial_upsampler = pipeline.upsampler
|
| 193 |
+
_prompt_encoder = pipeline.prompt_encoder
|
| 194 |
|
| 195 |
+
# Trigger actual loading by accessing the underlying models
|
| 196 |
+
# These are lazily loaded on first access
|
|
|
|
|
|
|
| 197 |
print(" Loading video encoder...")
|
| 198 |
+
_video_encoder.model
|
| 199 |
print(" Loading video decoder...")
|
| 200 |
+
_video_decoder.model
|
| 201 |
print(" Loading audio decoder...")
|
| 202 |
+
_audio_decoder.model
|
| 203 |
print(" Loading spatial upsampler...")
|
| 204 |
+
_spatial_upsampler.model
|
| 205 |
+
print(" Loading prompt encoder (Gemma)...")
|
| 206 |
+
_prompt_encoder.gemma
|
| 207 |
+
|
| 208 |
+
# Trigger diffusion stages to load their transformer weights
|
| 209 |
+
# We do this by creating a small dummy inference to force loading
|
| 210 |
+
print(" Loading stage 1 transformer...")
|
| 211 |
+
with torch.no_grad():
|
| 212 |
+
dummy_latent = torch.randn(1, 16, 9, 64, 64, device='cpu', dtype=torch.bfloat16)
|
| 213 |
+
dummy_sigmas = torch.tensor([1.0, 0.5, 0.0], device='cpu', dtype=torch.float32)
|
| 214 |
+
# Access the internal transformer through stage_1._transformer_ctx
|
| 215 |
+
_ = pipeline.stage_1._transformer_ctx
|
| 216 |
+
_ = pipeline.stage_2._transformer_ctx
|
| 217 |
|
| 218 |
print("All models preloaded for ZeroGPU tensor packing!")
|
| 219 |
print("=" * 80)
|