cosmicman commited on
Commit
0bb369d
Β·
verified Β·
1 Parent(s): 5875883

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -106,19 +106,21 @@ base_model_path: str = "stabilityai/stable-diffusion-xl-base-1.0"
106
  refiner_model_path: str = "stabilityai/stable-diffusion-xl-refiner-1.0"
107
  unet_path: str = "cosmicman/CosmicMan-SDXL"
108
  SCHEDULER = schedule_map[schedule]
109
- scheduler = SCHEDULER.from_pretrained(base_model_path, subfolder="scheduler")
110
- # unet = UNet2DConditionModel.from_pretrained(unet_path)
111
 
112
  pipe = StableDiffusionXLPipeline.from_pretrained(
113
  base_model_path,
114
  # unet=unet,
115
  scheduler=scheduler,
 
116
  use_safetensors=True
117
  ).to("cuda")
118
  pipe.watermark = NoWatermark()
119
  refiner = StableDiffusionXLImg2ImgPipeline.from_pretrained(
120
  base_model_path, # we found use base_model_path instead of refiner_model_path may get a better performance
121
  scheduler=scheduler,
 
122
  use_safetensors=True
123
  ).to("cuda")
124
  refiner.watermark = NoWatermark()
@@ -184,7 +186,7 @@ with gr.Blocks(theme=gr.themes.Soft(),css="style.css") as demo:
184
  value=0,
185
  )
186
  random_seed = gr.Checkbox(label="Randomize seed", value=True)
187
- img_num = gr.Slider(minimum=1, maximum=4, value=4, label="Number of images", step=1)
188
 
189
  gr.Examples(
190
  examples=examples,
 
106
  refiner_model_path: str = "stabilityai/stable-diffusion-xl-refiner-1.0"
107
  unet_path: str = "cosmicman/CosmicMan-SDXL"
108
  SCHEDULER = schedule_map[schedule]
109
+ scheduler = SCHEDULER.from_pretrained(base_model_path, subfolder="scheduler", torch_dtype=torch.float16)
110
+ # unet = UNet2DConditionModel.from_pretrained(unet_path, torch_dtype=torch.float16)
111
 
112
  pipe = StableDiffusionXLPipeline.from_pretrained(
113
  base_model_path,
114
  # unet=unet,
115
  scheduler=scheduler,
116
+ torch_dtype=torch.float16,
117
  use_safetensors=True
118
  ).to("cuda")
119
  pipe.watermark = NoWatermark()
120
  refiner = StableDiffusionXLImg2ImgPipeline.from_pretrained(
121
  base_model_path, # we found use base_model_path instead of refiner_model_path may get a better performance
122
  scheduler=scheduler,
123
+ ,torch_dtype=torch.float16,
124
  use_safetensors=True
125
  ).to("cuda")
126
  refiner.watermark = NoWatermark()
 
186
  value=0,
187
  )
188
  random_seed = gr.Checkbox(label="Randomize seed", value=True)
189
+ img_num = gr.Slider(minimum=1, maximum=4, value=1, label="Number of images", step=1)
190
 
191
  gr.Examples(
192
  examples=examples,