Spaces:
Running on Zero
Running on Zero
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -82,8 +82,11 @@ def _latent_frames(seconds: float, variant: str) -> int:
|
|
| 82 |
|
| 83 |
|
| 84 |
def _duration(prompt, mode="chunkwise", seconds=5, seed=0, randomize_seed=True, *args, **kwargs):
|
| 85 |
-
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
|
| 89 |
@spaces.GPU(duration=_duration)
|
|
@@ -119,9 +122,6 @@ def generate(
|
|
| 119 |
num_latents = _latent_frames(float(seconds), mode)
|
| 120 |
|
| 121 |
t0 = time.perf_counter()
|
| 122 |
-
free, total = torch.cuda.mem_get_info()
|
| 123 |
-
print(f"[SGF+] GPU {torch.cuda.get_device_name()} free={free/2**30:.1f}G total={total/2**30:.1f}G "
|
| 124 |
-
f"allocated={torch.cuda.memory_allocated()/2**30:.1f}G")
|
| 125 |
pipe.kv_cache1 = None # fresh caches for every request
|
| 126 |
torch.manual_seed(seed)
|
| 127 |
noise = torch.randn([1, num_latents, 16, 60, 104], device="cuda", dtype=torch.bfloat16)
|
|
|
|
| 82 |
|
| 83 |
|
| 84 |
def _duration(prompt, mode="chunkwise", seconds=5, seed=0, randomize_seed=True, *args, **kwargs):
|
| 85 |
+
mode = mode if mode in PIPES else "chunkwise"
|
| 86 |
+
lat = _latent_frames(float(seconds), mode)
|
| 87 |
+
# measured on ZeroGPU (MIG 2g.48gb): chunkwise ~0.75 s / latent, framewise ~1.45 s / latent
|
| 88 |
+
per_latent = 0.75 if mode == "chunkwise" else 1.45
|
| 89 |
+
return int(8 + lat * per_latent * 1.15)
|
| 90 |
|
| 91 |
|
| 92 |
@spaces.GPU(duration=_duration)
|
|
|
|
| 122 |
num_latents = _latent_frames(float(seconds), mode)
|
| 123 |
|
| 124 |
t0 = time.perf_counter()
|
|
|
|
|
|
|
|
|
|
| 125 |
pipe.kv_cache1 = None # fresh caches for every request
|
| 126 |
torch.manual_seed(seed)
|
| 127 |
noise = torch.randn([1, num_latents, 16, 60, 104], device="cuda", dtype=torch.bfloat16)
|