Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files425 unmodified lines426427428429429430431432433434435434435436437440438439440236 unmodified lines677678679683684685686687688689690691692680681682425 unmodified lines
@spaces.GPU(duration=get_duration, size=GPU_SIZE)def _generate(prompt_embeds, text_token_tags, references, height, width, num_frames, steps, seed, loras=()):def _generate(prompt_embeds, text_token_tags, references, height, width, num_frames, steps, seed): """The only thing on GPU time: the two reference encoders, the packed-sequence denoise loop and the decoders. References cross as paths and are decoded here; only the three generated outputs come back. A `@spaces.GPU` argument crosses a process boundary by pickling, a 5 s 1344x768 reference video is 370 MB of expanded frames, and the full `PipelineState` still holds the packed latents and the rotary grid on the card. The adapters are attached here rather than in the caller: `spaces` runs this body in its own worker, so the transformer the request sees is the one that has to carry them. """ import torch if PLACEMENT == "lazy": PIPE.to("cuda") apply_loras(PIPE.transformer_ref, loras or ()) state = PIPE( prompt_embeds=prompt_embeds.to("cuda"), text_token_tags=text_token_tags,236 unmodified lines image.change(auto_canvas, image, canvas, show_progress="hidden", api_name=False) video.change(auto_canvas, video, canvas, show_progress="hidden", api_name=False)
# `reference, strength, reference, strength, ...`, which is how `generate` unpacks them. lora_inputs = [field for pair in zip(lora_references, lora_scales) for field in pair] lora_upload.upload(_fill_lora_slots, [lora_upload, *lora_references], lora_references, api_name=False) lora_preset_add.click( _add_preset_lora, [lora_preset, *lora_references, *lora_scales], [*lora_references, *lora_scales, steps], api_name=False, )
# Same order as `SETTINGS_KEYS`. settings_fields = [prompt, upsample, canvas, match, duration, steps, seed] save.click(save_settings, settings_fields, settings_download, api_name=False)app.py+1-14