Logo
How To Train Flux AI Image Model To Generate Unlimited Photos of Yourself
technologyartificial intelligenceflux
Sep 12 2024

How To Train Flux AI Image Model To Generate Unlimited Photos of Yourself

Today, you can fine-tune the most capable open-weight image model, Flux, from Black Forest Labs to generate unlimited AI images of yourself. The entire process is done in your browser, and you don’t need powerful hardware or write a single line of code.

The fine-tuning capability of Flux on human faces is something that wasn’t easily achievable with previous generations of open-source image models like Stable Diffusion.

If you’re not familiar with Flux image models yet, check out this article:

Flux.1 is a Mind-Blowing Open-Weights AI Image Generator with 12B Parameters
Flux by Black Forest Labs is currently the largest state-of-the-art (SOTA) open-source AI image model with 12B…jimclydemonge.medium.com

Trust me, the process of fine-tuning Flux is simple, and the results are astonishing. I just fed the AI a bunch of photos of myself from my phone’s gallery, and 20 minutes later, I found myself generating imaginative images of myself in a variety of interesting situations.

In this article, I’ll walk you through the step-by-step process of fine-tuning Flux to generate your personalized AI images. It’s going to be fun, simple, and yes—mind-blowing.

Before you start, you’ll need:

  • At least 10 clear images of yourself
  • A Replicate account
  • A payment method to train the AI model (it’ll only cost $1–2)

If you have these, let’s get started.

Training Flux on Replicate

Step 1: Prepare your training images

The first step in fine-tuning Flux is preparing your training images. Gather at least 10 images of your own face.

  • These images should show your face clearly. Aim for different angles and lighting conditions to give Flux a good variety to learn from.
  • They can be in WebP, JPG, and PNG formats
  • Use HD images, preferably at least 1024x1024 or higher resolution if possible
  • File names and aspect ratio don’t matter

Remember, the more diverse your images in terms of angles and lighting, the better your results will be. However, keep in mind that using more images will result in longer training times.

Once you’ve gathered your images, place them in a zip file (without a password). You can name the zip file whatever you like.

Step 2: Pick a Unique Trigger Word

When prompting the fine-tuned image model, it’s important to have a unique “trigger word” as an identifier in your text prompt when generating images.

For example, you shouldn’t use generic words like “man” or “dog.” Instead, use your name, like “Jimclyde,” as a trigger word.

Here are some of the things to consider when choosing a trigger word:

  • It should be something unique, like MY_UNIQ_TRGGR. Think “vanity license plates”, but without any length limits.
  • It should not be an existing word in any language, like dog or cyberpunk.
  • It should not be TOK, because it will clash with other fine-tunes if you ever want to combine them.
  • Case doesn’t matter, but capital letters can help visually distinguish the trigger word from the rest of the text prompt.

Hold on to your trigger word for now — you’ll use it once you train the model.

Step 3: Train the Flux Image Model

Now comes the important part: training the model. Go to your Replicate account, and under the “Explore” tab, find the “flux-dev-lora-trainer.”

In the “Create training” section, set the model destination. You can either use an existing model or create a new one.

In this example, let’s create a new model I’ll call “jimclyde-flux” to train with my own photos. Make sure to set the visibility to ‘private’ to avoid access by other users.

In the input images section, upload the zip file containing the training images.

Next, set the trigger keyword you selected in step 2.

Leave the rest of the fields at default and finally click on the “Create training” button.

Remember, the training won’t start if you don’t add a payment method.

The training process takes around 20 minutes to complete, but it depends on the queue length. To monitor the progress, go to the “Trainings” page and select the model under training.

Once the training is done, you’ll see a success status and a message like this:

The training was successful! You can now run and learn more about your trained model in our web playground or start running predictions via the Replicate API.

You are now ready to do a test run of the fine-tuned model. Click on the “Run trained model” to get started. When adding your prompt, make sure to include your trigger_word in the prompt to activate your newly trained concept in the resulting images.

Generating Images

Now you can start generating custom images. Let’s try an example:

Prompt: JIMCLYDE, wearing a tuxedo posing for a magazine in a red carpet show, the room is well lit, he’s facing the camera, half body shot

Image by Jim Clyde Monge

Holy sh*t, I was creeped out and laughing out loud when I first saw the image. Just take a look at the level of realism and how closely it resembles my face. It’s freaky, hilarious, and amazing all at the same time!

Here’s more:

Prompt: JIMCLYDE, studio photoshoot, wearing white polo, and black pants, smiling
Prompt: JIMCLYDE, excitedly eating sushi in a japanese restaurant, wearing black bubble jacket because it’s winter time, half body shot
Prompt: JIMCLYDE, in a white oversize T-shirt posing for a brand shooting in front of a skyblue backround, full body shot

Again, this is nothing short of amazing. I did not expect Flux to be this good. The overall image is coherent with the text prompt, the subject looks exactly like me, and even the hands—a notorious stumbling block for many image generators—are perfectly rendered.

You can play around with the prompt and other settings to match your preferences. Forgive me, but this is so fun to use—I ended up making a bunch of images. Here are some of my favorites.

To view the history of your generated images, go to the “Predictions” tab and click on the ID link.

You can also access this model via API and integrate it into your custom apps. Here’s an example code in Node.js:

import Replicate from "replicate";const replicate = new Replicate({ auth: process.env.REPLICATE_API_TOKEN,});const output = await replicate.run( "jimclydegm/jimclyde-flux:5502907a82b7cfa8915abd05e9436XXXXXXXXX", { input: { model: "dev", lora_scale: 1, num_outputs: 1, aspect_ratio: "1:1", output_format: "webp", guidance_scale: 3.5, output_quality: 90, prompt_strength: 0.8, extra_lora_scale: 1, num_inference_steps: 28 } });console.log(output);

Final Thoughts

Overall, I had so much fun generating images of myself with a fine-tuned Flux model. It’s super easy to do and quite cheap (only 1–2 USD) considering that the number of training steps is at 1,000. The results are really impressive, with an eerily good resemblance to my face, and the overall coherence with the text prompt is great.

Note that the model used in this guide is the DEV model, not the Pro model. The Flux Pro model offers state-of-the-art performance in image generation, delivering top-notch prompt following, visual quality, image detail, and output diversity. It’s a much more capable image model than the Dev, so you can expect even better images with the Pro model.

I hope you find this guide helpful. If you try it and run into any problems, please let me know in the comments.

Share This Post:

Related Articles

Flux.1 is a Mind-Blowing Open-Weights AI Image Generator with 12B Parameters
techologyartificial intelligenceflux

Flux.1 is a Mind-Blowing Open-Weights AI Ima...

Flux by Black Forest Labs is currently the largest state-of-the-art (SOTA) open-source AI image model with 12B parameters.

Sep 09 2024
Flux 1.1 Pro Is Here — Better and Faster Image Generation
technologyfluxaiartificial intelligence

Flux 1.1 Pro Is Here — Better and Faster Ima...

Flux 1.1 Pro provides six times faster generation than its predecessor while also improving image quality, prompt adherence, and diversity.

Oct 04 2024
How To Train Flux AI Image Model To Generate Unlimited Photos of Yourself
technologyartificial intelligenceflux

How To Train Flux AI Image Model To Generate...

Today, you can fine-tune the most capable open-weight image model, Flux, from Black Forest Labs to generate unlimited AI images of…

Sep 12 2024