zhiweili
commited on
Commit
•
1d517a9
1
Parent(s):
e00097c
fix adapter error
Browse files- inversion_run_adapter.py +5 -12
inversion_run_adapter.py
CHANGED
@@ -92,18 +92,12 @@ adapters = MultiAdapter(
|
|
92 |
)
|
93 |
adapters = adapters.to(torch.float16)
|
94 |
|
95 |
-
adapters = T2IAdapter.from_pretrained(
|
96 |
-
"TencentARC/t2i-adapter-lineart-sdxl-1.0",
|
97 |
-
torch_dtype=torch.float16,
|
98 |
-
varient="fp16",
|
99 |
-
),
|
100 |
-
|
101 |
pipeline = DiffusionPipeline.from_pretrained(
|
102 |
BASE_MODEL,
|
103 |
torch_dtype=torch.float16,
|
104 |
variant="fp16",
|
105 |
use_safetensors=True,
|
106 |
-
|
107 |
adapter=adapters,
|
108 |
custom_pipeline="./pipelines/pipeline_sdxl_adapter_img2img.py",
|
109 |
)
|
@@ -170,13 +164,12 @@ def run(
|
|
170 |
print(f"-------->num_steps_inversion: {num_steps_inversion} num_steps_actual: {num_steps_actual} step_start: {config.step_start}")
|
171 |
print(f"-------->timesteps len: {len(timesteps)} max_norm_zs len: {len(config.max_norm_zs)}")
|
172 |
lineart_image = lineart_detector(input_image, detect_resolution=int(generate_size * lineart_detect), image_resolution=generate_size)
|
173 |
-
|
174 |
# pidinet_image = pidinet_detector(input_image, detect_resolution=512, image_resolution=generate_size, apply_filter=True)
|
175 |
# depth_image = midas_detector(input_image, detect_resolution=512, image_resolution=generate_size)
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
conditioning_scale = lineart_scale
|
180 |
pipeline.__call__ = partial(
|
181 |
pipeline.__call__,
|
182 |
num_inference_steps=num_steps_inversion,
|
|
|
92 |
)
|
93 |
adapters = adapters.to(torch.float16)
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
pipeline = DiffusionPipeline.from_pretrained(
|
96 |
BASE_MODEL,
|
97 |
torch_dtype=torch.float16,
|
98 |
variant="fp16",
|
99 |
use_safetensors=True,
|
100 |
+
vae=AutoencoderKL.from_pretrained("madebyollin/sdxl-vae-fp16-fix", torch_dtype=torch.float16),
|
101 |
adapter=adapters,
|
102 |
custom_pipeline="./pipelines/pipeline_sdxl_adapter_img2img.py",
|
103 |
)
|
|
|
164 |
print(f"-------->num_steps_inversion: {num_steps_inversion} num_steps_actual: {num_steps_actual} step_start: {config.step_start}")
|
165 |
print(f"-------->timesteps len: {len(timesteps)} max_norm_zs len: {len(config.max_norm_zs)}")
|
166 |
lineart_image = lineart_detector(input_image, detect_resolution=int(generate_size * lineart_detect), image_resolution=generate_size)
|
167 |
+
canny_image = canndy_detector(input_image, detect_resolution=int(generate_size * canny_detect), image_resolution=generate_size)
|
168 |
# pidinet_image = pidinet_detector(input_image, detect_resolution=512, image_resolution=generate_size, apply_filter=True)
|
169 |
# depth_image = midas_detector(input_image, detect_resolution=512, image_resolution=generate_size)
|
170 |
+
cond_image = [lineart_image, canny_image]
|
171 |
+
conditioning_scale = [lineart_scale, canny_scale]
|
172 |
+
|
|
|
173 |
pipeline.__call__ = partial(
|
174 |
pipeline.__call__,
|
175 |
num_inference_steps=num_steps_inversion,
|