multimodalart HF staff commited on
Commit
9e6fef2
1 Parent(s): 8741760

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -118,7 +118,7 @@ pipe = StableDiffusionXLInstantIDImg2ImgPipeline.from_pretrained("rubbrband/albe
118
  torch_dtype=torch.float16)
119
 
120
  compel = Compel(tokenizer=[pipe.tokenizer, pipe.tokenizer_2] , text_encoder=[pipe.text_encoder, pipe.text_encoder_2], returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED, requires_pooled=[False, True])
121
-
122
  pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, use_karras_sigmas=True)
123
  pipe.load_ip_adapter_instantid(face_adapter)
124
  pipe.set_ip_adapter_scale(0.8)
@@ -205,7 +205,6 @@ def merge_incompatible_lora(full_path_lora, lora_scale):
205
  )
206
  del weights_sd
207
  del lora_model
208
- gc.collect()
209
  @spaces.GPU
210
  def generate_image(prompt, negative, face_emb, face_image, image_strength, images, guidance_scale, face_strength, depth_control_scale):
211
  conditioning, pooled = compel(prompt)
@@ -307,7 +306,6 @@ def run_lora(face_image, prompt, negative, lora_scale, selected_state, face_stre
307
 
308
  image = generate_image(prompt, negative, face_emb, face_image, image_strength, images, guidance_scale, face_strength, depth_control_scale)
309
  last_lora = repo_name
310
- gc.collect()
311
  return image, gr.update(visible=True)
312
 
313
  def shuffle_gallery(sdxl_loras):
 
118
  torch_dtype=torch.float16)
119
 
120
  compel = Compel(tokenizer=[pipe.tokenizer, pipe.tokenizer_2] , text_encoder=[pipe.text_encoder, pipe.text_encoder_2], returned_embeddings_type=ReturnedEmbeddingsType.PENULTIMATE_HIDDEN_STATES_NON_NORMALIZED, requires_pooled=[False, True])
121
+ compel.to(device)
122
  pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config, use_karras_sigmas=True)
123
  pipe.load_ip_adapter_instantid(face_adapter)
124
  pipe.set_ip_adapter_scale(0.8)
 
205
  )
206
  del weights_sd
207
  del lora_model
 
208
  @spaces.GPU
209
  def generate_image(prompt, negative, face_emb, face_image, image_strength, images, guidance_scale, face_strength, depth_control_scale):
210
  conditioning, pooled = compel(prompt)
 
306
 
307
  image = generate_image(prompt, negative, face_emb, face_image, image_strength, images, guidance_scale, face_strength, depth_control_scale)
308
  last_lora = repo_name
 
309
  return image, gr.update(visible=True)
310
 
311
  def shuffle_gallery(sdxl_loras):