multimodalart HF staff commited on
Commit
bade8d8
1 Parent(s): d3774b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -75,8 +75,6 @@ for item in sdxl_loras_raw:
75
  "state_dict": state_dict
76
  }
77
 
78
- sdxl_loras_raw_new = [item for item in sdxl_loras_raw if item.get("new") == True]
79
-
80
  sdxl_loras_raw = [item for item in sdxl_loras_raw if item.get("new") != True]
81
 
82
  # download models
@@ -125,7 +123,7 @@ pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config,
125
  pipe.load_ip_adapter_instantid(face_adapter)
126
  pipe.set_ip_adapter_scale(0.8)
127
  zoe = ZoeDetector.from_pretrained("lllyasviel/Annotators")
128
- zoe.to("cuda")
129
 
130
  original_pipe = copy.deepcopy(pipe)
131
  pipe.to(device)
@@ -256,7 +254,7 @@ def run_lora(face_image, prompt, negative, lora_scale, selected_state, face_stre
256
  weight_name = sdxl_loras[selected_state.index]["weights"]
257
 
258
  full_path_lora = state_dicts[repo_name]["saved_name"]
259
- loaded_state_dict = copy.deepcopy(state_dicts[repo_name]["state_dict"])
260
  cross_attention_kwargs = None
261
  print("Last LoRA: ", last_lora)
262
  print("Current LoRA: ", repo_name)
@@ -265,7 +263,7 @@ def run_lora(face_image, prompt, negative, lora_scale, selected_state, face_stre
265
  if(last_fused):
266
  pipe.unfuse_lora()
267
  pipe.unload_lora_weights()
268
- pipe.load_lora_weights(loaded_state_dict)
269
  pipe.fuse_lora(lora_scale)
270
  last_fused = True
271
  is_pivotal = sdxl_loras[selected_state.index]["is_pivotal"]
@@ -325,7 +323,6 @@ def deselect():
325
 
326
  with gr.Blocks(css="custom.css") as demo:
327
  gr_sdxl_loras = gr.State(value=sdxl_loras_raw)
328
- gr_sdxl_loras_new = gr.State(value=sdxl_loras_raw_new)
329
  title = gr.HTML(
330
  """<h1>Face to All</h1>""",
331
  elem_id="title",
 
75
  "state_dict": state_dict
76
  }
77
 
 
 
78
  sdxl_loras_raw = [item for item in sdxl_loras_raw if item.get("new") != True]
79
 
80
  # download models
 
123
  pipe.load_ip_adapter_instantid(face_adapter)
124
  pipe.set_ip_adapter_scale(0.8)
125
  zoe = ZoeDetector.from_pretrained("lllyasviel/Annotators")
126
+ zoe.to(device)
127
 
128
  original_pipe = copy.deepcopy(pipe)
129
  pipe.to(device)
 
254
  weight_name = sdxl_loras[selected_state.index]["weights"]
255
 
256
  full_path_lora = state_dicts[repo_name]["saved_name"]
257
+ #loaded_state_dict = copy.deepcopy(state_dicts[repo_name]["state_dict"])
258
  cross_attention_kwargs = None
259
  print("Last LoRA: ", last_lora)
260
  print("Current LoRA: ", repo_name)
 
263
  if(last_fused):
264
  pipe.unfuse_lora()
265
  pipe.unload_lora_weights()
266
+ pipe.load_lora_weights(full_path_lora)
267
  pipe.fuse_lora(lora_scale)
268
  last_fused = True
269
  is_pivotal = sdxl_loras[selected_state.index]["is_pivotal"]
 
323
 
324
  with gr.Blocks(css="custom.css") as demo:
325
  gr_sdxl_loras = gr.State(value=sdxl_loras_raw)
 
326
  title = gr.HTML(
327
  """<h1>Face to All</h1>""",
328
  elem_id="title",