-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Bugfix for flux2 img2img2 prediction #12855
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
Conversation
|
@sayakpaul Please take a look at this PR. Thank you for your help! |
|
Do you have a reproducer? |
|
@sayakpaul I've updated the result in the description, thanks :) |
|
@linoytsaban Please take a look at this PR. Thank you for your help! |
|
I noticed the anomaly in the loss statement a while ago. The main issue is that the This is the core problem with this training script; please fix it as soon as possible. |
|
@tcaimm thanks for pointing that out. Since you have already characterized the bug and proposed a solution would you like to open a PR? That way, your contribution will stay within the library :-) |
|
@sayakpaul probably I can add @tcaimm as the co-auther for this PR after I change the line: are still needed. |
|
Sure that works. |
|
@sayakpaul @tcaimm Please take a look |
Thanks for the update! I’ve taken a look at the changes, and they look great to me. Since we collaborated on this, would you mind adding me as a co-author in the final squash/merge commit? This helps GitHub track the contribution correctly. You can add this line to the bottom of the commit message: Co-authored-by: tcaimm [email protected] Looking forward to seeing this merged! |
Co-authored-by: tcaimm <[email protected]>
Done! |
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
linoytsaban
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot @leisuzz!
|
Thanks for the awesome contributions! |
What does this PR do?
I got the error:
raise ValueError(f"Expected
image_latentsto be a list, got {type(image_latents)}.")(1) cond_model_input_list will go to "_prepare_image_ids" in a list of
[[1, cond_model_input[0], cond_model_input[1], cond_model_input[2]], ...](2) As the "_prepare_image_ids" in pipeline will do the
torch.cat(image_latent_ids, dim=0), this will cause mismatch of shape in the training step in codemodel_input_ids = torch.cat([model_input_ids, cond_model_input_ids], dim=1).cond_model_input_ids .shape[0]is 1, butmodel_input_ids.shape[0]is the batch size. The codecond_model_input_ids.viewis to resize the shape to meet the requirementSo this change will also work if batch size is more than 1.
When I only changed the cond_model_input to list, I got the training abnormal training loss (start with ~1.7, which is too high). So I fix model prediction based on the pipeline part, and loss becomes reasonable (start with ~0.4).
With the code:
With the original code:
The training loss is:
Co-authored-by: @tcaimm
Before submitting
documentation guidelines, and
here are tips on formatting docstrings.
Who can review?
Anyone in the community is free to review the PR once the tests have passed. Feel free to tag
members/contributors who may be interested in your PR.
Co-authored-by: @tcaimm