Instructions to use kiigii/imagedream-ipmv-diffusers with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusers
How to use kiigii/imagedream-ipmv-diffusers with Diffusers:
pip install -U diffusers transformers accelerate
import torch from diffusers import DiffusionPipeline # switch to "mps" for apple devices pipe = DiffusionPipeline.from_pretrained("kiigii/imagedream-ipmv-diffusers", 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
Update pipeline_imagedream.py
Browse files- pipeline_imagedream.py +2 -0
pipeline_imagedream.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from typing import Any, Callable, Dict, List, Optional, Union
|
| 2 |
|
| 3 |
import torch
|
|
|
|
| 4 |
import torch.nn.functional as F
|
| 5 |
from diffusers.callbacks import MultiPipelineCallbacks, PipelineCallback
|
| 6 |
from diffusers.image_processor import PipelineImageInput
|
|
@@ -75,6 +76,7 @@ class ImageDreamPipeline(StableDiffusionPipeline):
|
|
| 75 |
print("IP-Adapter Loaded.")
|
| 76 |
|
| 77 |
if pretrained_model_name_or_path_or_dict == "kiigii/imagedream-ipmv-diffusers":
|
|
|
|
| 78 |
add_imagedream_attn_processor(self.unet)
|
| 79 |
logging.set_verbosity_error()
|
| 80 |
print(
|
|
|
|
| 1 |
from typing import Any, Callable, Dict, List, Optional, Union
|
| 2 |
|
| 3 |
import torch
|
| 4 |
+
import torch.nn as nn
|
| 5 |
import torch.nn.functional as F
|
| 6 |
from diffusers.callbacks import MultiPipelineCallbacks, PipelineCallback
|
| 7 |
from diffusers.image_processor import PipelineImageInput
|
|
|
|
| 76 |
print("IP-Adapter Loaded.")
|
| 77 |
|
| 78 |
if pretrained_model_name_or_path_or_dict == "kiigii/imagedream-ipmv-diffusers":
|
| 79 |
+
setattr(self.image_encoder, "visual_projection", nn.Identity())
|
| 80 |
add_imagedream_attn_processor(self.unet)
|
| 81 |
logging.set_verbosity_error()
|
| 82 |
print(
|