zhiweili
commited on
Commit
·
9199ab3
1
Parent(s):
a9c1f71
test from pipe
Browse files- inversion_run_adapter.py +31 -4
inversion_run_adapter.py
CHANGED
@@ -5,6 +5,7 @@ from diffusers import (
|
|
5 |
DiffusionPipeline,
|
6 |
T2IAdapter,
|
7 |
MultiAdapter,
|
|
|
8 |
)
|
9 |
from controlnet_aux import (
|
10 |
LineartDetector,
|
@@ -91,19 +92,45 @@ adapters = MultiAdapter(
|
|
91 |
)
|
92 |
adapters = adapters.to(torch.float16)
|
93 |
|
94 |
-
|
95 |
BASE_MODEL,
|
96 |
torch_dtype=torch.float16,
|
97 |
variant="fp16",
|
98 |
use_safetensors=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
adapter=adapters,
|
100 |
custom_pipeline="./pipelines/pipeline_sdxl_adapter_img2img.py",
|
101 |
)
|
|
|
102 |
pipeline = pipeline.to(device)
|
103 |
|
104 |
-
pipeline.scheduler = DDPMScheduler.
|
105 |
-
|
106 |
-
subfolder="scheduler",
|
107 |
)
|
108 |
|
109 |
config = get_config(args)
|
|
|
5 |
DiffusionPipeline,
|
6 |
T2IAdapter,
|
7 |
MultiAdapter,
|
8 |
+
StableDiffusionXLImg2ImgPipeline,
|
9 |
)
|
10 |
from controlnet_aux import (
|
11 |
LineartDetector,
|
|
|
92 |
)
|
93 |
adapters = adapters.to(torch.float16)
|
94 |
|
95 |
+
basePipe = StableDiffusionXLImg2ImgPipeline.from_pretrained(
|
96 |
BASE_MODEL,
|
97 |
torch_dtype=torch.float16,
|
98 |
variant="fp16",
|
99 |
use_safetensors=True,
|
100 |
+
)
|
101 |
+
basePipe = basePipe.to(device)
|
102 |
+
|
103 |
+
basePipe.scheduler = DDPMScheduler.from_pretrained(
|
104 |
+
BASE_MODEL,
|
105 |
+
subfolder="scheduler",
|
106 |
+
)
|
107 |
+
|
108 |
+
# pipeline = DiffusionPipeline.from_pretrained(
|
109 |
+
# BASE_MODEL,
|
110 |
+
# torch_dtype=torch.float16,
|
111 |
+
# variant="fp16",
|
112 |
+
# use_safetensors=True,
|
113 |
+
# adapter=adapters,
|
114 |
+
# custom_pipeline="./pipelines/pipeline_sdxl_adapter_img2img.py",
|
115 |
+
# )
|
116 |
+
# pipeline = pipeline.to(device)
|
117 |
+
|
118 |
+
# pipeline.scheduler = DDPMScheduler.from_pretrained(
|
119 |
+
# BASE_MODEL,
|
120 |
+
# subfolder="scheduler",
|
121 |
+
# )
|
122 |
+
|
123 |
+
|
124 |
+
pipeline = DiffusionPipeline.from_pipe(
|
125 |
+
basePipe,
|
126 |
adapter=adapters,
|
127 |
custom_pipeline="./pipelines/pipeline_sdxl_adapter_img2img.py",
|
128 |
)
|
129 |
+
|
130 |
pipeline = pipeline.to(device)
|
131 |
|
132 |
+
pipeline.scheduler = DDPMScheduler.from_config(
|
133 |
+
pipeline.scheduler.config,
|
|
|
134 |
)
|
135 |
|
136 |
config = get_config(args)
|