jiuface commited on
Commit
c8c2fd4
1 Parent(s): 07a147a

saving memory

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -42,7 +42,11 @@ controlnet = FluxControlNetModel.from_pretrained(controlnet_model, torch_dtype=t
42
 
43
 
44
  pipe = FluxControlNetInpaintPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16).to(device)
45
-
 
 
 
 
46
 
47
  control_mode_ids = {
48
  "scribble_hed": 0,
@@ -490,4 +494,6 @@ with gr.Blocks() as demo:
490
  output_json_component
491
  ]
492
  )
493
- demo.queue().launch()
 
 
 
42
 
43
 
44
  pipe = FluxControlNetInpaintPipeline.from_pretrained(base_model, controlnet=controlnet, torch_dtype=torch.bfloat16).to(device)
45
+ pipe.to("cuda")
46
+ torch.backends.cuda.matmul.allow_tf32 = True
47
+ pipe.vae.enable_tiling()
48
+ pipe.vae.enable_slicing()
49
+ pipe.enable_model_cpu_offload() # for saving memory
50
 
51
  control_mode_ids = {
52
  "scribble_hed": 0,
 
494
  output_json_component
495
  ]
496
  )
497
+
498
+ demo.queue(api_open=False)
499
+ demo.launch()