Skip to content

Commit 3edfcdb

Browse files
committed
fix: Restore accidentally removed print_combined_table function
During FreeU/Kohya removal, the print_combined_table() function was accidentally removed from generate.py, causing NameError during generation. Restored the complete function from dev branch (60+ lines) that displays formatted table of generation parameters during render loop. Function shows: - Steps, CFG, Distilled CFG, Denoise strength - Optional schedules: Subseed, Sampler, Scheduler, Checkpoint - Animation transforms: Angle, Zoom, Translation, Rotation - Perspective flip parameters if enabled This fixes the error reported at generate.py:247
1 parent 88c6fcf commit 3edfcdb

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

scripts/deforum_helpers/generate.py

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,67 @@ def pairwise_repl(iterable):
7272
next(b, None)
7373
return zip(a, b)
7474

75+
def print_combined_table(args, anim_args, p, keys, frame_idx):
76+
from rich.table import Table
77+
from rich import box
78+
79+
table = Table(padding=0, box=box.ROUNDED)
80+
81+
field_names1 = ["Steps", "CFG", "Dist. CFG"]
82+
if anim_args.animation_mode != 'Interpolation':
83+
field_names1.append("Denoise")
84+
field_names1 += ["Subseed", "Subs. str"] * (anim_args.enable_subseed_scheduling)
85+
field_names1 += ["Sampler"] * anim_args.enable_sampler_scheduling
86+
field_names1 += ["Scheduler"] * anim_args.enable_scheduler_scheduling
87+
field_names1 += ["Checkpoint"] * anim_args.enable_checkpoint_scheduling
88+
89+
for field_name in field_names1:
90+
table.add_column(field_name, justify="center")
91+
92+
rows1 = [str(p.steps), str(p.cfg_scale), str(p.distilled_cfg_scale)]
93+
if anim_args.animation_mode != 'Interpolation':
94+
rows1.append(f"{p.denoising_strength:.5g}" if p.denoising_strength is not None else "None")
95+
96+
rows1 += [str(p.subseed), f"{p.subseed_strength:.5g}"] * anim_args.enable_subseed_scheduling
97+
rows1 += [p.sampler_name] * anim_args.enable_sampler_scheduling
98+
rows1 += [p.scheduler] * anim_args.enable_scheduler_scheduling
99+
rows1 += [str(args.checkpoint)] * anim_args.enable_checkpoint_scheduling
100+
101+
rows2 = []
102+
if anim_args.animation_mode not in ['Video Input', 'Interpolation']:
103+
if anim_args.animation_mode == '2D':
104+
field_names2 = ["Angle", "Zoom", "Tr C X", "Tr C Y"]
105+
else:
106+
field_names2 = []
107+
field_names2 += ["Tr X", "Tr Y"]
108+
if anim_args.animation_mode == '3D':
109+
field_names2 += ["Tr Z", "Ro X", "Ro Y", "Ro Z"]
110+
if anim_args.aspect_ratio_schedule.replace(" ", "") != '0:(1)':
111+
field_names2 += ["Asp. Ratio"]
112+
if anim_args.enable_perspective_flip:
113+
field_names2 += ["Pf T", "Pf P", "Pf G", "Pf F"]
114+
115+
for field_name in field_names2:
116+
table.add_column(field_name, justify="center")
117+
118+
if anim_args.animation_mode == '2D':
119+
rows2 += [f"{keys.angle_series[frame_idx]:.5g}", f"{keys.zoom_series[frame_idx]:.5g}",
120+
f"{keys.transform_center_x_series[frame_idx]:.5g}", f"{keys.transform_center_y_series[frame_idx]:.5g}"]
121+
122+
rows2 += [f"{keys.translation_x_series[frame_idx]:.5g}", f"{keys.translation_y_series[frame_idx]:.5g}"]
123+
124+
if anim_args.animation_mode == '3D':
125+
rows2 += [f"{keys.translation_z_series[frame_idx]:.5g}", f"{keys.rotation_3d_x_series[frame_idx]:.5g}",
126+
f"{keys.rotation_3d_y_series[frame_idx]:.5g}", f"{keys.rotation_3d_z_series[frame_idx]:.5g}"]
127+
if anim_args.aspect_ratio_schedule.replace(" ", "") != '0:(1)':
128+
rows2 += [f"{keys.aspect_ratio_series[frame_idx]:.5g}"]
129+
if anim_args.enable_perspective_flip:
130+
rows2 += [f"{keys.perspective_flip_theta_series[frame_idx]:.5g}", f"{keys.perspective_flip_phi_series[frame_idx]:.5g}",
131+
f"{keys.perspective_flip_gamma_series[frame_idx]:.5g}", f"{keys.perspective_flip_fv_series[frame_idx]:.5g}"]
132+
133+
table.add_row(*rows1, *rows2)
134+
console.print(table)
135+
75136
def generate(args, keys, anim_args, loop_args, controlnet_args, root, parseq_adapter, frame=0, sampler_name=None, scheduler_name=None):
76137
if state.interrupted:
77138
return None

0 commit comments

Comments
 (0)