All right, so we're doing fine tuning with flux.
Laura, this is using the file AI API.
And you can see I made a picture of myself.
How did the AI know about me?
I fine tuned it based on some images that I uploaded.
So this one I'm not going to run because it takes a little bit of time.
I'm just going to walk you through the code.
But the general idea of what we're trying to go for is that you upload a zip file of images, you put
in a prompt, and you prompt this new model that you fine tuned with a specific trigger word.
In this case, I just chose Random letters UK.
And now it knows that thanks to the fine tuning we did earlier, that UK means me right?
And I uploaded a bunch of images of myself.
You can run this yourself.
It does cost a bit of money if you are going to run it on file.
I also recommend you check out other providers as well.
Replicate I think has done more for fine tuning, although it is possible to do it on four.
So let me walk you through this.
First you have to install the file client and load the environment variables.
You can get the API key from the file dashboard.
And you just need this file key.
And the other thing you need is to prepare a bunch of images.
Here you can upload a zip file.
And I just had that locally.
I just got a bunch of pictures of myself.
I think it was like ten different pictures from my Facebook account.
And then I downloaded those images and, uh, created a zip file on my Mac.
And then I put that into this project and I called it MT Face my face.
If you want to see how to do this, we can go to this URL here.
So this is the Flux Pro trainer that we're using.
You can see how much it costs.
So for example it's about I think it's like between 2 and 4 to 2 to $6.
And you can actually run it in here.
So you don't necessarily need to use the API.
You can just upload your images or pick a zip file and then choose your trigger word as well.
If you want all the code that's up to date, like you can get the code here.
So that's what I've done.
And you can see this is the job that ran for me and it completed.
I had a failed job before as well.
Once you have this you can also just click to run inference and it's going to take you straight to the
model that lets you run it fine tuned.
So this is a fine tuned Flux Pro.
And you just have to give the fine tuned ID which is the output you get, and you choose the fine tuning
strength.
So those are the two things we're going to be doing today.
We just want to make a little message to keep us updated when we're running the trainer.
And we're going to subscribe to this trainer, we just need to pass in a few different things.
One is just a name.
So you can find this fine tune again, just to test face, you want to choose the mode.
I did character because I was doing a picture of me.
But you could also do this for products or a specific style, or just a general fine tune, and then
you choose the trigger word.
A lot of people use Tok tok.
I use UK.
It doesn't really matter what you use, as long as it's something that won't be in the training data.
So it's something that there's no real image for in the training of the client.
And when you run that, you get a fine tune ID.
It gives you an ID that you can follow up on and then you can submit the job.
This is the other way to do it.
You could submit the job.
You can take this request ID that you get.
And then you can get the status whenever you want.
Like in this case this is completed.
And it took 759 seconds here.
There's also you can get the result the fine tuned ID.
So when you've run the full thing and it's completed that's how you get the result.
If you're doing this programmatically, then you just want to run in a loop and just check each time
as the status completed yet.
And once it is, then you've got your fine tuned ID that you can call back, but yeah, once you've
got the fine tuned ID, you can just use that model as much as you want forever for as long as you want,
and it's just something you have to pass in here to this fine tuned result here.
We can actually run this.
I'm not going to do another fine tuned job, but let me just run that and that and then just gonna upload
the file clean here, the fine tune ID I'm just going to paste in here.
That was what it was.
And then I can run this.
So I asked for the LinkedIn profile picture.
I just need to bring in my Q update which is here.
This is going to give me messages while it's running.
See, when it comes back with oh, I didn't define the request library, just encrypt that.
All right.
So I've got all the right libraries here.
Now there's another image of me.
Look a bit like JD Vance.
You could just say editor instead of LinkedIn.
Profile picture.
You say picture of you in Times Square because it knows who your CK is.
Now, with this fine tune ID, then it will be able to kind of follow that prompt.
There we go.
Funnily enough, one of the things you find is that you tend to it tends to make all the other people
in the image similar to you as well.
So you can see here it's made a few very similar to me.
But yeah, that's that's how it works.
That's fine tuning.
It's pretty straightforward.
You don't have to know anything about machine learning.
Thankfully, I massively prefer to do this rather than trying to figure out my own computer, although
you can actually run this on your own, Mac if you have an M1 or above, or in your PC if you have a
gaming PC.
So these tools are open source, but I prefer to use an API wherever I can, even if it costs a couple
of bucks.
All right.
Yeah, hopefully that's useful for you.