Noename commited on
Commit
bc46e48
·
verified ·
1 Parent(s): 2e2e1d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -10
app.py CHANGED
@@ -35,13 +35,13 @@ precision = 'fp16'
35
  # Check for different hardware architectures
36
  if torch.cuda.is_available():
37
  device = "cuda"
38
- # Check for xformers
39
- try:
40
- import xformers
41
 
42
- enable_xformers = True
43
- except ImportError:
44
- enable_xformers = False
45
  elif torch.backends.mps.is_available():
46
  device = "mps"
47
  else:
@@ -71,8 +71,9 @@ pipe = pipe.to(device)
71
  if device == "cuda":
72
  pipe = pipe.to(device)
73
  if enable_xformers:
74
- pipe.enable_xformers_memory_efficient_attention()
75
- print("xformers optimization enabled")
 
76
  elif device == "mps":
77
  pipe = pipe.to(device)
78
  pipe.enable_attention_slicing()
@@ -187,11 +188,11 @@ with block:
187
  with gr.Accordion("Advanced options", open=False):
188
  num_samples = gr.Slider(label="Images", minimum=1, maximum=1, value=1, step=1, visible=False)
189
  # num_samples = 1
190
- image_resolution = gr.Slider(label="Image Resolution", minimum=256, maximum=768, value=768, step=64)
191
  strength = gr.Slider(label="Control Strength", minimum=0.0, maximum=2.0, value=1.0, step=0.01)
192
  # guess_mode = gr.Checkbox(label='Guess Mode', value=False)
193
  ddim_steps = gr.Slider(label="Steps", minimum=1, maximum=20, value=20, step=1)
194
- scale = gr.Slider(label="Guidance Scale", minimum=0.1, maximum=30.0, value=4.0, step=0.1)
195
  threshold = gr.Slider(label="Segmentation Threshold", minimum=0.1, maximum=0.9, value=0.5, step=0.05)
196
  seed = gr.Slider(label="Seed", minimum=-1, maximum=2147483647, value=-1, step=1)
197
  eta = gr.Number(label="eta (DDIM)", value=0.0)
 
35
  # Check for different hardware architectures
36
  if torch.cuda.is_available():
37
  device = "cuda"
38
+ # # Check for xformers
39
+ # try:
40
+ # import xformers
41
 
42
+ # enable_xformers = True
43
+ # except ImportError:
44
+ # enable_xformers = False
45
  elif torch.backends.mps.is_available():
46
  device = "mps"
47
  else:
 
71
  if device == "cuda":
72
  pipe = pipe.to(device)
73
  if enable_xformers:
74
+ # pipe.enable_xformers_memory_efficient_attention()
75
+ # print("xformers optimization enabled")
76
+ pipe.enable_attention_slicing()
77
  elif device == "mps":
78
  pipe = pipe.to(device)
79
  pipe.enable_attention_slicing()
 
188
  with gr.Accordion("Advanced options", open=False):
189
  num_samples = gr.Slider(label="Images", minimum=1, maximum=1, value=1, step=1, visible=False)
190
  # num_samples = 1
191
+ image_resolution = gr.Slider(label="Image Resolution", minimum=256, maximum=512, value=512, step=64)
192
  strength = gr.Slider(label="Control Strength", minimum=0.0, maximum=2.0, value=1.0, step=0.01)
193
  # guess_mode = gr.Checkbox(label='Guess Mode', value=False)
194
  ddim_steps = gr.Slider(label="Steps", minimum=1, maximum=20, value=20, step=1)
195
+ scale = gr.Slider(label="Guidance Scale", minimum=0.1, maximum=30.0, value=7.0, step=0.1)
196
  threshold = gr.Slider(label="Segmentation Threshold", minimum=0.1, maximum=0.9, value=0.5, step=0.05)
197
  seed = gr.Slider(label="Seed", minimum=-1, maximum=2147483647, value=-1, step=1)
198
  eta = gr.Number(label="eta (DDIM)", value=0.0)