-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Flux.1 LoRA training #2701
Comments
The branch now contain MVP but for some reason the flux1 trainer crash with an Optimizer argument list is empty. |
But I am not sure why I keep getting this error when trying to train:
Maybe I really need to upgrade to PyTorch to 2.4.0... not liking that as this might bork my non Flux.1 GUI... not feeling like upgrading... |
Hi there, is it possible to only update PyTorch to 2.4.0 for only the Flux version of Kohya_ss GUI ? |
SimpleTuner upadted to v0.9.8: quantised flux training in 40 gig.. 24 gig.. 16 gig... 13.9 gig.. Waiting so much for kohya |
probably very soon |
Hi there! Any news about the integration of Flux into the gui ? |
I am running into similar but different errors. Waiting for the as-scripts code to stabilize to further work on it. I have a lot of the elements already in the gui. The missing ones can be added as extra parameters in the Advanced Accordion. |
Nice! Should be released soon so, cannot wait to try! Thanks for your work |
I updated to the latest sd-script commit for flux... still can't run training at my end unfortunately:
Here is a copy of my flux1_test.json config if you are interested to poke at it. |
I pushed an update with support for the missing GUI parameters for Flux.1. Here is the latest config for testing based on Kohya's readme config: |
thanks a lot |
The GUI is a real mess with so many options. I get lost myself when trying to fing where is the option I need to set. Wish there was an easy solution… but I can’t think of one. |
bro, flux does not support training the text encoder, yet. Set your text encoder lr to 0 |
I'm surprised that wasn't more widely known actually. Stability AI, when they released SD3, mentioned that training the T5 model was not only not necessary but not recommended. The same is likely true for FLux also. It simply relies on the tokenization from the Clip L and the Transformer model working in conjunction with the T5 model's established natural language processing. And Clip L is almost entirely tag-based and seems highly unstable when trained anyway. In other words as long as you create the embedding within the model itself, the T5's existing capabilities should be enough to hit the ground running and incorporate that embedding into natural language prompting off the bat. How exactly this translates to the end result is something I am yet to see myself though. |
ai toolkit skript works really great. Trained 3 LORAs so far (in 3 hours) its not perfect but super good. Awaiting for Kohya |
Is anyone getting past the AttributeError: 'T5EncoderModel' object has no attribute 'text_model'? |
Someone implemented a potential fix for it, but Kohya hasn't added it yet: |
Have you an example json? |
Koyha has added it now. Pulled these files: but now I get: |
I can confirm that I am getting the same AttributeError as @jpXerxes after cloning the latest sd3 branch Able to bypass the issue and begin training by adding --cache_text_encoder_outputs to the additional parameters! |
That did it. I ran the test file, with sample outputs every 1 epoch (4 epochs) and prompt: a painting of a steam punk skull with a gas mask , by darius kawasaki These are the 4 sample images: |
How are you running the sd3_train,py script with kohya? I downloaded it but don't know what to do with it. I've always just used kohya normally but really want to try some flux training. |
Go to https://github.com/kohya-ss/sd-scripts/tree/sd3 and download the 4 files below, and place them in the appropriate folders: grab the second flux1_test.json posted above in this thread. Edit it to change all hard-coded paths to your own structure. Near the top is the line "additional_parameters": and add to it --cache_text_encoder_outputs In the gui, add a choice for sample output frequency, and add a prompt Please, anybody spot something wrong with this please correct me! |
A general problem with my test run is that Flux already knows how to deal with that prompt, so I get good images without the Lora. I will have to find something Flux knows nothing about to properly test. |
You can also remove the sd scripts directory and replace it with the latest version of the sd3 branch.
…On Thu, Aug 15, 2024, 3:09 PM jpXerxes ***@***.***> wrote:
How are you running the sd3_train,py script with kohya? I downloaded it
but don't know what to do with it. I've always just used kohya normally but
really want to try some flux training.
Likely you could wait a very short time until bmaltais catches up, but:
I'm no expert, but here's what I did:
First, make sure you have the proper branch of bmaltais/kohya using git
checkout sd3-flux.1
Go to https://github.com/kohya-ss/sd-scripts/tree/sd3 and download the 4
files below, and place them in the appropriate folders:
library/flux_train_utils.py
flux_train_network.py
train_network.py
library/flux_models.py
grab the second flux1_test.json posted above in this thread. Edit it to
change all hard-coded paths to your own structure. Near the top is the line
"additional_parameters": and add to it --cache_text_encoder_outputs
In the gui, add a choice for sample output frequency, and add a prompt
Please, anybody spot something wrong with this please correct me!
—
Reply to this email directly, view it on GitHub
<#2701 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AH2WKOZ53CHAUV6BFZJXCATZRT4IDAVCNFSM6AAAAABMKAEAG2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJSGAYTONRSHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
With a 24GB card, I run out of VRAM after about 30 or so training steps. |
|
A lot of recent postings (external) recommend using non distilled versions of FLUX for finetuning. I know when I try to use them instead of Flux1_dev, it errors out. (I believe this is related to how the metadata is structured, but I could be wrong.) Will we be able to support the training for the non distilled model? I have been trying train the Flux_Dev checkpoint - it has been successful for likenesses of individual - but full finetuning of multiple concepts has been failures so far. The model is so resilient and responsive to LoRA training, but seems to breakdown quickly under dreambooth finetuning. I am hoping having the distillation removed will be more predictable. (Sorry if I am misstating any of this as I am an avid hobbyist but very new to the more technical side.) |
Flux dev is distilled, a non distilled version is not available, Flux pro is the not distilled one but the weights were not released publicly, there are some ideas to undo the distillation process at least in the human class to avoid class bleeding, training the model Flux dev with a diverse dataset of people of all races genders and ages and then on top of this finetune you train your new subjects, this was not tested but is promising that the model will behave more like a non distilled model when training people, but doing this first finetune will require time and resources. |
Hmm. I've had good results with dropping this in, in place of regular flux dev and no other changes: https://civitai.com/models/812892/flux1-dev2pro |
some people said that this model is probably fake, the original version was published on hugging face more than a month ago and it claimes that were trained on 3 million images ir will have to take a lot of time and resources, but if you are getting good results who knows... I will give it a try |
I will try to train many people at the same time and see if still bleeds... |
"good" when it comes to these things is subjective. My opinion is that faces are more realistic. They do caution to not apply loras produced with this version back with the version, but rather use distilled. |
Did you try the one I pointed to, or another? I tried using the FP8 version, but that errored out. |
Is not just that the faces looks realistic, the problem with distilled models is that they are unable to learn many people of the same class without mixing them together, flux dev suffers of bleeding and catastrophic forgetting. |
https://www.reddit.com/r/StableDiffusion/comments/1fuukwz/fluxdevdedistill_an_undistilled_version_of_flux/ I am not saying if they are legit, but there are two models claiming to have removed the distillation being promoted on Reddit. One full and the other FP8 I believe. I know Furkan has posted about them as well. |
Ok, good news if it works, I will give it a try |
i think real distilled will be ostris one https://huggingface.co/ostris/OpenFLUX.1 but i think too early atm |
Can you train a LoRA in the Khoya GUI now on a checkpoint made with Ostris LoRA's merged into them? I was not sure if that was working or if it errored out like the finetuning does. I have it working in AIToolkit, but much prefer the GUI here for larger projects. |
The recent 3.1.0 release (02.10.24) has Flux support as stated in https://github.com/KohakuBlueleaf/LyCORIS/blob/main/Change.md So it would be great to use the GUI to train LoKR and DoRA |
awesome DoRA better than LokR? |
When we can train both we can compare. nVidia had a paper where they discussed that DoRA should/could/will be the future replacement for LoRA as it is much better and has no negatives with it. |
Last time I attempted to update to the Lycoris 3.x version, most Lycoris-based training modules broke. It doesn’t seem to be backward compatible, and it will require substantial effort to use in the GUI. I’ve pushed that aside because I didn’t want to invest the time to make it work. However, I might consider giving it a try as part of the sd3 branch. |
OK, I updated the requirements file and re-aligned the GUI to match the documented options parameter support... hope this allow you to train a Flux.1 LoRA using the Lycoris method. |
I have this exact same problem. I managed to merge 3 loras into a checkpoint (with adjusted block weights) using ComfyUI, I can use the checkpoint, but I cannot extract a LoRa from it or use it to train another LoRA on Kohya... I think merging the diffuser format breaks the checkpoint in kohya. It's funny that it can be used normally on Comfy or Forge though. |
2d_toska_v1.5_lycoris_dylora.json if start train with checked Flux.1 checkbox i have error if uncheck i have this error log
maybe i use wrong settings? can someone make preset for flux LyCoris ? |
@leporel RIght... I had that there when I tried to make sure users could only select FLux.1 compatible models... Let me add the ones for LyCORIS to the list... |
@leporel OK, Try pulling the latest commit. Should allow to use LyCORIS LoRA types with Flux.1... hope that work. |
I can confirm that it works now. |
does it only work with attn-only and not full? cant seem to get full to work |
Were you able to obtain a functional LoRA from it? |
Full worked for me. |
Yes. |
Maybe I should add that I only tried Lycoris LoCon so far. Trying LoHa now. |
LoHa works fine with full, too. Just increases "training intensity" a lot so you gotta lower rank/alpha and/or learning rates accordingly to not overtrain. |
can you post your config file (preset) ? |
I git cloned to linux and ran requirements but I cant spawn the Flux tickbox in the Lora tab even after chosing the model. Am I'm missing something? SDXL training works great.. |
Kohya has added preliminary support for Flux.1 LoRA to his SD3 branch. I have created a
sd3-flux.1
branch and updated to the latest sd-scripts sd3 branch code... No GUI integration yet... I will start adding the basic code to be able to establish that the model is Flux as part of the GUI.The text was updated successfully, but these errors were encountered: