lucataco / ai-toolkit

Ostris AI-Toolkit for Flux LoRA Training (Proof of Concept). Please use the official trainer at: ostris/flux-dev-lora-trainer

  • Public
  • 45.5K runs
  • GitHub
  • Weights
  • License

------------------------------------------------

Use the OFFICIAL Flux LoRA Trainer here

It supports more features, runs faster, and is cheaper to use!

------------------------------------------------

About

A Cog implementation of ostris/ai-toolkit

(Training only supports FLUX.1-dev)

Follow me on Twitter/X @lucataco93

How to use

In the TRAIN tab (between README and VERSIONS) you’ll see the parameters that you can select to train a LoRA

For destination select/create an empty Replicate model location to store your LoRAs. (Ex: lucataco/flux-loras)

For images upload your zip/tar file of images for training. Images must be jpg, jpeg, or png. File names must be their captions, ex: a_bird_in_the_style_of_TOK.png, etc. If you include txt files, the text files should be named the same as the images and should contain only the caption.

For model_name use “black-forest-labs/FLUX.1-dev”

For hf_token use your Huggingface token to access the Flux-Dev weights for training. Make sure the Access Token has the right permissions: “Read access to public gated repos you can access”

For steps select a value from 500-4000

By default the trigger word is: ‘TOK’. The other steps are optional

Example Training runs:

Below is an example training run to create a watercolor style LoRA, trained on 16 watercolor images for 1000 steps in 41min: watercolor training

Below is an example training run to create a LoRA of a dog, trained on 26 images of Queso for 500 steps in 21min: queso training

How to test your LoRA

Once you have an Output.zip file you can download and extract the safetensors file, and upload it to a huggingface space (ex: lucataco/flux-dev-lora). If you added a model name for the Train parameter repo_id at the bottom, then this should be done for you automatically

With your LoRA in a huggingface model under your repo_id (lucataco/flux-dev-lora) go to the LoRA Explorer model and try it out. In this example, I trained a watercolor style LoRA, so to activate the LoRA I would use the prompt: “a boat in the style of TOK”

Licensing and commercial use

If you generate images on Replicate with FLUX.1 models and their fine-tunes, then you can use the images commercially.

If you download the weights off Replicate and generate images on your own computer, you can’t use the images commercially.

All Flux-Dev LoRAs have the same license as the original base mode for FLUX.1-dev

If you choose the option to auto-upload your trained LoRA to Huggingface, this License will be added for you