Instructions to use Charles-Elena/InstantID with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use Charles-Elena/InstantID with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("Charles-Elena/InstantID", dtype=torch.bfloat16, device_map="cuda") prompt = "Astronaut in a jungle, cold color palette, muted colors, detailed, 8k" image = pipe(prompt).images[0] - Notebooks
- Google Colab
- Kaggle
Commit ·
f84540b
1
Parent(s): e61a361
reorder
Browse files- handler.py +9 -3
handler.py
CHANGED
|
@@ -60,15 +60,21 @@ class EndpointHandler():
|
|
| 60 |
safety_checker=None,
|
| 61 |
feature_extractor=None,
|
| 62 |
).to(device)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
self.pipe.cuda()
|
| 65 |
self.pipe.load_ip_adapter_instantid(face_adapter)
|
| 66 |
self.pipe.image_proj_model.to("cuda")
|
| 67 |
self.pipe.unet.to("cuda")
|
| 68 |
|
| 69 |
-
self.pipe.scheduler = diffusers.EulerDiscreteScheduler.from_config(
|
| 70 |
-
self.pipe.scheduler.config
|
| 71 |
-
)
|
| 72 |
|
| 73 |
# if we need more parameters
|
| 74 |
# scheduler_class_name = "EulerDiscreteScheduler"
|
|
|
|
| 60 |
safety_checker=None,
|
| 61 |
feature_extractor=None,
|
| 62 |
).to(device)
|
| 63 |
+
|
| 64 |
+
self.pipe.scheduler = diffusers.EulerDiscreteScheduler.from_config(
|
| 65 |
+
self.pipe.scheduler.config
|
| 66 |
+
)
|
| 67 |
|
| 68 |
+
# load and disable LCM
|
| 69 |
+
self.pipe.load_lora_weights("latent-consistency/lcm-lora-sdxl")
|
| 70 |
+
self.pipe.disable_lora()
|
| 71 |
+
|
| 72 |
+
|
| 73 |
self.pipe.cuda()
|
| 74 |
self.pipe.load_ip_adapter_instantid(face_adapter)
|
| 75 |
self.pipe.image_proj_model.to("cuda")
|
| 76 |
self.pipe.unet.to("cuda")
|
| 77 |
|
|
|
|
|
|
|
|
|
|
| 78 |
|
| 79 |
# if we need more parameters
|
| 80 |
# scheduler_class_name = "EulerDiscreteScheduler"
|