Skip to content

Commit

Permalink
Fix infotext (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Feb 2, 2024
1 parent 79df006 commit 6c31941
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,12 @@ def serialize_unit(unit: external_code.ControlNetUnit) -> str:
excluded_fields = (
"image",
"enabled",
# Note: "advanced_weighting" is excluded as it is an API-only field.
"advanced_weighting",
# Note: "inpaint_crop_image" is img2img inpaint only flag, which does not
# provide much information when restoring the unit.
"inpaint_crop_input_image",
"input_mode",
"use_preview_as_input",
"generated_image",
"mask_image",
)

log_value = {
field_to_displaytext(field): getattr(unit, field)
for field in vars(external_code.ControlNetUnit()).keys()
Expand All @@ -48,7 +47,7 @@ def serialize_unit(unit: external_code.ControlNetUnit) -> str:
if not all("," not in str(v) and ":" not in str(v) for v in log_value.values()):
logger.error(f"Unexpected tokens encountered:\n{log_value}")
return ""

return ", ".join(f"{field}: {value}" for field, value in log_value.items())


Expand Down
4 changes: 3 additions & 1 deletion extensions-builtin/sd_forge_controlnet/scripts/controlnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,9 @@ def process_unit_after_every_sampling(self,
@torch.no_grad()
def process(self, p, *args, **kwargs):
self.current_params = {}
for i, unit in enumerate(self.get_enabled_units(args)):
enabled_units = self.get_enabled_units(args)
Infotext.write_infotext(enabled_units, p)
for i, unit in enumerate(enabled_units):
self.bound_check_params(unit)
params = ControlNetCachedParameters()
self.process_unit_after_click_generate(p, unit, params, *args, **kwargs)
Expand Down

0 comments on commit 6c31941

Please sign in to comment.