Skip to content

Kolors additional pipelines, community contrib #11372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,355 changes: 1,355 additions & 0 deletions examples/community/pipeline_controlnet_xl_kolors.py

Large diffs are not rendered by default.

1,557 changes: 1,557 additions & 0 deletions examples/community/pipeline_controlnet_xl_kolors_img2img.py

Large diffs are not rendered by default.

1,871 changes: 1,871 additions & 0 deletions examples/community/pipeline_controlnet_xl_kolors_inpaint.py

Large diffs are not rendered by default.

1,728 changes: 1,728 additions & 0 deletions examples/community/pipeline_kolors_inpainting.py

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/diffusers/loaders/lora_conversion_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ def _convert_to_ai_toolkit_cat(sds_sd, ait_sd, sds_key, ait_keys, dims=None):
ait_up_keys = [k + ".lora_B.weight" for k in ait_keys]
if not is_sparse:
# down_weight is copied to each split
ait_sd.update({k: down_weight for k in ait_down_keys})
ait_sd.update(dict.fromkeys(ait_down_keys, down_weight))

# up_weight is split to each split
ait_sd.update({k: v for k, v in zip(ait_up_keys, torch.split(up_weight, dims, dim=0))}) # noqa: C416
Expand Down Expand Up @@ -923,7 +923,7 @@ def handle_qkv(sds_sd, ait_sd, sds_key, ait_keys, dims=None):
ait_up_keys = [k + ".lora_B.weight" for k in ait_keys]

# down_weight is copied to each split
ait_sd.update({k: down_weight for k in ait_down_keys})
ait_sd.update(dict.fromkeys(ait_down_keys, down_weight))

# up_weight is split to each split
ait_sd.update({k: v for k, v in zip(ait_up_keys, torch.split(up_weight, dims, dim=0))}) # noqa: C416
Expand Down
2 changes: 1 addition & 1 deletion src/diffusers/pipelines/pipeline_flax_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def load_module(name, value):
class_obj = import_flax_or_no_model(pipeline_module, class_name)

importable_classes = ALL_IMPORTABLE_CLASSES
class_candidates = {c: class_obj for c in importable_classes.keys()}
class_candidates = dict.fromkeys(importable_classes.keys(), class_obj)
else:
# else we just import it from the library.
library = importlib.import_module(library_name)
Expand Down
4 changes: 2 additions & 2 deletions src/diffusers/pipelines/pipeline_loading_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,13 +341,13 @@ def get_class_obj_and_candidates(
pipeline_module = getattr(pipelines, library_name)

class_obj = getattr(pipeline_module, class_name)
class_candidates = {c: class_obj for c in importable_classes.keys()}
class_candidates = dict.fromkeys(importable_classes.keys(), class_obj)
elif os.path.isfile(os.path.join(component_folder, library_name + ".py")):
# load custom component
class_obj = get_class_from_dynamic_module(
component_folder, module_file=library_name + ".py", class_name=class_name
)
class_candidates = {c: class_obj for c in importable_classes.keys()}
class_candidates = dict.fromkeys(importable_classes.keys(), class_obj)
else:
# else we just import it from the library.
library = importlib.import_module(library_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def test_save_load_optional_components(self):
# set all optional components to None and update pipeline config accordingly
for optional_component in pipe._optional_components:
setattr(pipe, optional_component, None)
pipe.register_modules(**{optional_component: None for optional_component in pipe._optional_components})
pipe.register_modules(**dict.fromkeys(pipe._optional_components))

inputs = self.get_dummy_inputs(torch_device)
output = pipe(**inputs)[0]
Expand Down