Spaces:
Runtime error
Runtime error
Update ip_adapter/ip_adapter.py
Browse files- ip_adapter/ip_adapter.py +2 -2
ip_adapter/ip_adapter.py
CHANGED
|
@@ -25,7 +25,7 @@ class ImageProjModel(torch.nn.Module):
|
|
| 25 |
clip_extra_context_tokens = self.proj(embeds).reshape(-1, self.clip_extra_context_tokens, self.cross_attention_dim)
|
| 26 |
clip_extra_context_tokens = self.norm(clip_extra_context_tokens)
|
| 27 |
return clip_extra_context_tokens
|
| 28 |
-
|
| 29 |
class IPAdapter:
|
| 30 |
|
| 31 |
def __init__(self, sd_pipe, image_encoder_path, ip_ckpt, device, num_tokens=4):
|
|
@@ -180,7 +180,6 @@ class IPAdapter:
|
|
| 180 |
|
| 181 |
return images
|
| 182 |
|
| 183 |
-
'''
|
| 184 |
class IPAdapterXL(IPAdapter):
|
| 185 |
"""SDXL"""
|
| 186 |
|
|
@@ -285,6 +284,7 @@ class IPAdapterXL(IPAdapter):
|
|
| 285 |
negative_prompt_embeds = torch.cat([negative_prompt_embeds, uncond_image_prompt_embeds], dim=1)
|
| 286 |
|
| 287 |
generator = torch.Generator(self.device).manual_seed(seed) if seed is not None else None
|
|
|
|
| 288 |
images = self.pipe(
|
| 289 |
prompt_embeds=prompt_embeds,
|
| 290 |
negative_prompt_embeds=negative_prompt_embeds,
|
|
|
|
| 25 |
clip_extra_context_tokens = self.proj(embeds).reshape(-1, self.clip_extra_context_tokens, self.cross_attention_dim)
|
| 26 |
clip_extra_context_tokens = self.norm(clip_extra_context_tokens)
|
| 27 |
return clip_extra_context_tokens
|
| 28 |
+
|
| 29 |
class IPAdapter:
|
| 30 |
|
| 31 |
def __init__(self, sd_pipe, image_encoder_path, ip_ckpt, device, num_tokens=4):
|
|
|
|
| 180 |
|
| 181 |
return images
|
| 182 |
|
|
|
|
| 183 |
class IPAdapterXL(IPAdapter):
|
| 184 |
"""SDXL"""
|
| 185 |
|
|
|
|
| 284 |
negative_prompt_embeds = torch.cat([negative_prompt_embeds, uncond_image_prompt_embeds], dim=1)
|
| 285 |
|
| 286 |
generator = torch.Generator(self.device).manual_seed(seed) if seed is not None else None
|
| 287 |
+
|
| 288 |
images = self.pipe(
|
| 289 |
prompt_embeds=prompt_embeds,
|
| 290 |
negative_prompt_embeds=negative_prompt_embeds,
|