multimodalart HF staff commited on
Commit
1cdee36
1 Parent(s): a63aff9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -260,9 +260,13 @@ def run_lora(face_image, prompt, negative, lora_scale, selected_state, sdxl_lora
260
  embedding_path = hf_hub_download(repo_id=repo_name, filename=text_embedding_name, repo_type="model")
261
  state_dict_embedding = load_file(embedding_path)
262
  print(state_dict_embedding)
263
- pipe.load_textual_inversion(state_dict_embedding["clip_l"], token=["<s0>", "<s1>"], text_encoder=pipe.text_encoder, tokenizer=pipe.tokenizer)
264
- pipe.load_textual_inversion(state_dict_embedding["clip_g"], token=["<s0>", "<s1>"], text_encoder=pipe.text_encoder_2, tokenizer=pipe.tokenizer_2)
265
-
 
 
 
 
266
  image = pipe(
267
  prompt=prompt,
268
  negative_prompt=negative,
 
260
  embedding_path = hf_hub_download(repo_id=repo_name, filename=text_embedding_name, repo_type="model")
261
  state_dict_embedding = load_file(embedding_path)
262
  print(state_dict_embedding)
263
+ try:
264
+ pipe.load_textual_inversion(state_dict_embedding["clip_l"], token=["<s0>", "<s1>"], text_encoder=pipe.text_encoder, tokenizer=pipe.tokenizer)
265
+ pipe.load_textual_inversion(state_dict_embedding["clip_g"], token=["<s0>", "<s1>"], text_encoder=pipe.text_encoder_2, tokenizer=pipe.tokenizer_2)
266
+ except:
267
+ pipe.load_textual_inversion(state_dict_embedding["text_encoders_0"], token=["<s0>", "<s1>"], text_encoder=pipe.text_encoder, tokenizer=pipe.tokenizer)
268
+ pipe.load_textual_inversion(state_dict_embedding["text_encoders_1"], token=["<s0>", "<s1>"], text_encoder=pipe.text_encoder_2, tokenizer=pipe.tokenizer_2)
269
+
270
  image = pipe(
271
  prompt=prompt,
272
  negative_prompt=negative,