lixiang46 commited on
Commit
95ce3cf
β€’
1 Parent(s): 08f2519
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -34,7 +34,7 @@ unet = UNet2DConditionModel.from_pretrained(f"{ckpt_dir}/unet", revision=None).h
34
  controlnet_depth = ControlNetModel.from_pretrained(f"{ckpt_dir_depth}", revision=None).half().to(device)
35
  controlnet_canny = ControlNetModel.from_pretrained(f"{ckpt_dir_canny}", revision=None).half().to(device)
36
 
37
- image_encoder = CLIPVisionModelWithProjection.from_pretrained(f'{ckpt_dir_ipa}/weights/Kolors-IP-Adapter-Plus/image_encoder', ignore_mismatched_sizes=True).to(dtype=torch.float16, device=device)
38
  ip_img_size = 336
39
  clip_image_processor = CLIPImageProcessor(size=ip_img_size, crop_size=ip_img_size )
40
 
@@ -63,7 +63,7 @@ def load_ipa(pipe):
63
  if hasattr(pipe.unet, 'encoder_hid_proj'):
64
  pipe.unet.text_encoder_hid_proj = pipe.unet.encoder_hid_proj
65
 
66
- pipe.load_ip_adapter( f'{ckpt_dir_ipa}/weights/Kolors-IP-Adapter-Plus' , subfolder="", weight_name=["ip_adapter_plus_general.bin"])
67
  return pipe
68
 
69
  @spaces.GPU
 
34
  controlnet_depth = ControlNetModel.from_pretrained(f"{ckpt_dir_depth}", revision=None).half().to(device)
35
  controlnet_canny = ControlNetModel.from_pretrained(f"{ckpt_dir_canny}", revision=None).half().to(device)
36
 
37
+ image_encoder = CLIPVisionModelWithProjection.from_pretrained(f'{ckpt_dir_ipa}/image_encoder', ignore_mismatched_sizes=True).to(dtype=torch.float16, device=device)
38
  ip_img_size = 336
39
  clip_image_processor = CLIPImageProcessor(size=ip_img_size, crop_size=ip_img_size )
40
 
 
63
  if hasattr(pipe.unet, 'encoder_hid_proj'):
64
  pipe.unet.text_encoder_hid_proj = pipe.unet.encoder_hid_proj
65
 
66
+ pipe.load_ip_adapter(f'{ckpt_dir_ipa}' , subfolder="", weight_name=["ip_adapter_plus_general.bin"])
67
  return pipe
68
 
69
  @spaces.GPU