Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -90,21 +90,21 @@ import torch.nn.functional as F
|
|
| 90 |
|
| 91 |
|
| 92 |
# ---------------------------------------------------------------------------
|
| 93 |
-
#
|
| 94 |
# ---------------------------------------------------------------------------
|
| 95 |
def setup_intelligent_memory_pipeline(pipe, apply_quantization=True):
|
| 96 |
-
"""
|
| 97 |
print("Configuring pipeline for ZeroGPU...")
|
| 98 |
|
| 99 |
-
# Enable VAE optimizations
|
| 100 |
print("Enabling VAE slicing and tiling...")
|
| 101 |
if hasattr(pipe, 'vae'):
|
| 102 |
pipe.vae.enable_slicing()
|
| 103 |
pipe.vae.enable_tiling()
|
| 104 |
|
| 105 |
-
#
|
| 106 |
-
print("
|
| 107 |
-
pipe.
|
| 108 |
return pipe
|
| 109 |
|
| 110 |
print("loading base pipeline architecture...")
|
|
@@ -404,7 +404,7 @@ body, .gradio-container {
|
|
| 404 |
}
|
| 405 |
"""
|
| 406 |
|
| 407 |
-
with gr.Blocks(
|
| 408 |
with gr.Column(elem_id="col-container"):
|
| 409 |
with gr.Row(elem_id="preset-row"):
|
| 410 |
preset_dropdown = gr.Dropdown(
|
|
@@ -1021,4 +1021,4 @@ with gr.Blocks(css=css) as demo:
|
|
| 1021 |
)
|
| 1022 |
|
| 1023 |
if __name__ == "__main__":
|
| 1024 |
-
demo.launch(server_name="0.0.0.0", server_port=7860, share=False)
|
|
|
|
| 90 |
|
| 91 |
|
| 92 |
# ---------------------------------------------------------------------------
|
| 93 |
+
# ZEROGPU MEMORY MANAGEMENT
|
| 94 |
# ---------------------------------------------------------------------------
|
| 95 |
def setup_intelligent_memory_pipeline(pipe, apply_quantization=True):
|
| 96 |
+
"""Optimized for ZeroGPU - keep everything on GPU"""
|
| 97 |
print("Configuring pipeline for ZeroGPU...")
|
| 98 |
|
| 99 |
+
# Enable VAE optimizations only
|
| 100 |
print("Enabling VAE slicing and tiling...")
|
| 101 |
if hasattr(pipe, 'vae'):
|
| 102 |
pipe.vae.enable_slicing()
|
| 103 |
pipe.vae.enable_tiling()
|
| 104 |
|
| 105 |
+
# Move to GPU - no CPU offloading for ZeroGPU
|
| 106 |
+
print("Moving pipeline to GPU...")
|
| 107 |
+
pipe = pipe.to("cuda")
|
| 108 |
return pipe
|
| 109 |
|
| 110 |
print("loading base pipeline architecture...")
|
|
|
|
| 404 |
}
|
| 405 |
"""
|
| 406 |
|
| 407 |
+
with gr.Blocks() as demo:
|
| 408 |
with gr.Column(elem_id="col-container"):
|
| 409 |
with gr.Row(elem_id="preset-row"):
|
| 410 |
preset_dropdown = gr.Dropdown(
|
|
|
|
| 1021 |
)
|
| 1022 |
|
| 1023 |
if __name__ == "__main__":
|
| 1024 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, share=False, css=css)
|