Skip to content

n_min>0 gives an error #16

Open
Open
@mcnckc

Description

@mcnckc

FlowEdit/FlowEdit_utils.py

Lines 207 to 225 in f9d988c

else: # i >= T_steps-n_min # regular sampling for last n_min steps
if i == T_steps-n_min:
# initialize SDEDIT-style generation phase
fwd_noise = torch.randn_like(x_src).to(x_src.device)
xt_src = scale_noise(scheduler, x_src, t, noise=fwd_noise)
xt_tar = zt_edit + xt_src - x_src
src_tar_latent_model_input = torch.cat([xt_tar, xt_tar, xt_tar, xt_tar]) if pipe.do_classifier_free_guidance else (xt_src, xt_tar)
_, Vt_tar = calc_v_sd3(pipe, src_tar_latent_model_input,src_tar_prompt_embeds, src_tar_pooled_prompt_embeds, src_guidance_scale, tar_guidance_scale, t)
xt_tar = xt_tar.to(torch.float32)
prev_sample = xt_tar + (t_im1 - t_i) * (Vt_tar)
prev_sample = prev_sample.to(noise_pred_tar.dtype)
xt_tar = prev_sample

For an obvious reason:

File "FlowEdit/FlowEdit_utils.py", line 223, in FlowEditSD3
    prev_sample = prev_sample.to(noise_pred_tar.dtype)
NameError: name 'noise_pred_tar' is not defined

I would also suggest changing

src_tar_latent_model_input = torch.cat([xt_tar, xt_tar, xt_tar, xt_tar]) if pipe.do_classifier_free_guidance else (xt_src, xt_tar)

to
src_tar_latent_model_input = torch.cat([xt_src, xt_src, xt_tar, xt_tar]) if pipe.do_classifier_free_guidance else (xt_src, xt_tar) for consistency, and to avoid misleading code readers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions