devindevine commited on
Commit
501a7cf
·
verified ·
1 Parent(s): 8629bce

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -90,21 +90,21 @@ import torch.nn.functional as F
90
 
91
 
92
  # ---------------------------------------------------------------------------
93
- # INTELLIGENT MEMORY MANAGEMENT - Works on ZeroGPU
94
  # ---------------------------------------------------------------------------
95
  def setup_intelligent_memory_pipeline(pipe, apply_quantization=True):
96
- """Intelligent memory management for ZeroGPU"""
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
- # Use CPU offloading for ZeroGPU
106
- print("Using model CPU offloading for ZeroGPU")
107
- pipe.enable_model_cpu_offload()
108
  return pipe
109
 
110
  print("loading base pipeline architecture...")
@@ -404,7 +404,7 @@ body, .gradio-container {
404
  }
405
  """
406
 
407
- with gr.Blocks(css=css) as demo:
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)