-
Couldn't load subscription status.
- Fork 6.5k
[Flux LoRA] fix issues in flux lora scripts #11111
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
|
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. |
|
Hi @linoytsaban , thanks for this prompt fix! I believe the accelerator would produce error with line here with textual inversion specifically following the blog here: Also Is it possible to verify if textual inversion works in |
|
hey @luchaoqi! yes I'm currently testing multiple configurations - will definitely test with pivotal tuning with clip and pure textual inversion with clip. re: error with accelerator when running with multiple processes - adding it to the todo list :) |
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.
Initial comments.
examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py
Outdated
Show resolved
Hide resolved
examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py
Show resolved
Hide resolved
…n, fix accelerator.accumulate call in advanced script
|
@sayakpaul I noticed in the scripts some times we use: do you recall why it's not consistently one way or the other? |
|
Using the |
….unwrap_model with unwrap model
|
Hey @luchaoqi! could you please check if the accelerator now works fine with distributed training? I think it should be resolved now |
|
Hi @linoytsaban, yes distributed training works as expected. Pure textual inversion pops up new problems: |
|
@luchaoqi if you want to give it a try the current version should be fixed |
|
@linoytsaban thanks! Would definitely try it out asap once I get some time. |
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! Left some comments. Let me know if they make sense.
| # run inference | ||
| generator = torch.Generator(device=accelerator.device).manual_seed(args.seed) if args.seed is not None else None | ||
| autocast_ctx = nullcontext() | ||
| autocast_ctx = torch.autocast(accelerator.device.type) |
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.
I think this is only needed for the intermediate validation. Do we need to check for that?
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.
Yeah I think you're right, tested it now and seems to work as expected, changed it now
examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py
Show resolved
Hide resolved
examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py
Show resolved
Hide resolved
examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py
Show resolved
Hide resolved
examples/advanced_diffusion_training/train_dreambooth_lora_flux_advanced.py
Show resolved
Hide resolved
…x_advanced.py Co-authored-by: Sayak Paul <[email protected]>
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 ton for handling this!
|
@bot /style |
|
Style fixes have been applied. View the workflow run here. |
|
Failing test is unrelated |
|
@linoytsaban thanks for the fix earlier! CLIP only: CLIP + pivotal tuning: and the inference code I run following code here: Seems the model is not learning the concept from training images at all, producing non-personalized results. Anything I might be missing here? |
|
What is the current state of this script ? I'm looking for Flux Lora training options and I would love to use diffusers but it seems that there's a lot of disappointing results from what I'm reading (also in #10313). Is the script functional and works well or it needs some work? |
|
Hey @luchaoqi! for pure-textual inversion, we added it as an experimental feature that can potentially be used for concepts that are very closed to the model distribution / for people who are keen to experiment with very lightweight embeddings or look to try textual inversion with Flux. Naturally, since T5 carries most of the weight with Flux, training CLIP embeddings alone (i.e. pure textual inversion with CLIP) will likely be insufficient for most concepts. With pivotal tuning - the transformer is trained as well, but its also essential in that case to modify the inference code to load the lora weights into the transformer - from your example I'm not sure if you only included the inference you did for the pure textual inversion or this is also what you used for the pivotal tuning checkpoint - if so, could you try again and load the transformer weights too? |
|
Hey @Caselles! It should indeed be functional, we've addressed the bugs reported in the issue you mentioned and successfully trained with this script on various concepts. Please let us know if you encounter any issues :) |
fix remaining pending issues from #10313, #9476 in Flux LoRA training scripts
code snippets and output examples:
log_validationwith mixed precision-validation output at step 380:
