haowu11 commited on
Commit
49680b6
·
verified ·
1 Parent(s): c0645dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -66,7 +66,7 @@ face_info_generator = FaceInfoGenerator(root_dir = "./")
66
 
67
  clip_image_encoder = CLIPVisionModelWithProjection.from_pretrained("Kwai-Kolors/Kolors-IP-Adapter-FaceID-Plus",cache_dir='./',subfolder="clip-vit-large-patch14-336", ignore_mismatched_sizes=True)
68
  clip_image_processor = CLIPImageProcessor(size = 336, crop_size = 336)
69
- print(os.listdir('./models--Kwai-Kolors--Kolors-IP-Adapter-FaceID-Plus'))
70
  pipe = StableDiffusionXLControlNetImg2ImgPipeline(
71
  vae=vae,
72
  controlnet = controlnet,
@@ -83,7 +83,7 @@ pipe = StableDiffusionXLControlNetImg2ImgPipeline(
83
  if hasattr(pipe.unet, 'encoder_hid_proj'):
84
  pipe.unet.text_encoder_hid_proj = pipe.unet.encoder_hid_proj
85
  ip_scale = 0.5
86
- pipe.load_ip_adapter_faceid_plus('models--Kwai-Kolors--Kolors-IP-Adapter-FaceID-Plus/ipa-faceid-plus.bin', device = 'cuda')
87
  pipe.set_face_fidelity_scale(ip_scale)
88
  pipe = pipe.to("cuda")
89
  pipe.enable_model_cpu_offload()
 
66
 
67
  clip_image_encoder = CLIPVisionModelWithProjection.from_pretrained("Kwai-Kolors/Kolors-IP-Adapter-FaceID-Plus",cache_dir='./',subfolder="clip-vit-large-patch14-336", ignore_mismatched_sizes=True)
68
  clip_image_processor = CLIPImageProcessor(size = 336, crop_size = 336)
69
+ snapshotname = os.listdir('./models--Kwai-Kolors--Kolors-IP-Adapter-FaceID-Plus/snapshots')[0]
70
  pipe = StableDiffusionXLControlNetImg2ImgPipeline(
71
  vae=vae,
72
  controlnet = controlnet,
 
83
  if hasattr(pipe.unet, 'encoder_hid_proj'):
84
  pipe.unet.text_encoder_hid_proj = pipe.unet.encoder_hid_proj
85
  ip_scale = 0.5
86
+ pipe.load_ip_adapter_faceid_plus(f'models--Kwai-Kolors--Kolors-IP-Adapter-FaceID-Plus/snapshots/{snapshotname}/ipa-faceid-plus.bin', device = 'cuda')
87
  pipe.set_face_fidelity_scale(ip_scale)
88
  pipe = pipe.to("cuda")
89
  pipe.enable_model_cpu_offload()