WEBVTT

00:00.080 --> 00:03.600
All right, so we're doing fine tuning with flux.

00:03.640 --> 00:07.840
Laura, this is using the file AI API.

00:07.840 --> 00:10.720
And you can see I made a picture of myself.

00:11.080 --> 00:12.360
How did the AI know about me?

00:12.360 --> 00:16.560
I fine tuned it based on some images that I uploaded.

00:16.960 --> 00:20.040
So this one I'm not going to run because it takes a little bit of time.

00:20.040 --> 00:22.600
I'm just going to walk you through the code.

00:22.600 --> 00:28.760
But the general idea of what we're trying to go for is that you upload a zip file of images, you put

00:28.760 --> 00:36.120
in a prompt, and you prompt this new model that you fine tuned with a specific trigger word.

00:36.120 --> 00:38.760
In this case, I just chose Random letters UK.

00:39.320 --> 00:45.600
And now it knows that thanks to the fine tuning we did earlier, that UK means me right?

00:45.640 --> 00:47.840
And I uploaded a bunch of images of myself.

00:48.080 --> 00:49.640
You can run this yourself.

00:49.640 --> 00:53.400
It does cost a bit of money if you are going to run it on file.

00:53.520 --> 00:56.800
I also recommend you check out other providers as well.

00:56.800 --> 01:02.050
Replicate I think has done more for fine tuning, although it is possible to do it on four.

01:02.530 --> 01:04.210
So let me walk you through this.

01:04.770 --> 01:09.930
First you have to install the file client and load the environment variables.

01:10.090 --> 01:14.370
You can get the API key from the file dashboard.

01:14.370 --> 01:16.090
And you just need this file key.

01:16.530 --> 01:20.010
And the other thing you need is to prepare a bunch of images.

01:20.610 --> 01:22.930
Here you can upload a zip file.

01:22.930 --> 01:24.410
And I just had that locally.

01:24.410 --> 01:26.810
I just got a bunch of pictures of myself.

01:26.810 --> 01:29.610
I think it was like ten different pictures from my Facebook account.

01:29.770 --> 01:35.850
And then I downloaded those images and, uh, created a zip file on my Mac.

01:35.930 --> 01:40.490
And then I put that into this project and I called it MT Face my face.

01:40.890 --> 01:45.650
If you want to see how to do this, we can go to this URL here.

01:46.210 --> 01:50.610
So this is the Flux Pro trainer that we're using.

01:50.970 --> 01:52.690
You can see how much it costs.

01:52.690 --> 01:57.490
So for example it's about I think it's like between 2 and 4 to 2 to $6.

01:57.770 --> 01:59.170
And you can actually run it in here.

01:59.170 --> 02:02.730
So you don't necessarily need to use the API.

02:02.770 --> 02:07.930
You can just upload your images or pick a zip file and then choose your trigger word as well.

02:07.930 --> 02:11.970
If you want all the code that's up to date, like you can get the code here.

02:11.970 --> 02:13.090
So that's what I've done.

02:13.890 --> 02:17.770
And you can see this is the job that ran for me and it completed.

02:17.810 --> 02:19.970
I had a failed job before as well.

02:20.250 --> 02:27.730
Once you have this you can also just click to run inference and it's going to take you straight to the

02:27.930 --> 02:30.010
model that lets you run it fine tuned.

02:30.010 --> 02:32.210
So this is a fine tuned Flux Pro.

02:32.570 --> 02:37.130
And you just have to give the fine tuned ID which is the output you get, and you choose the fine tuning

02:37.130 --> 02:37.770
strength.

02:37.770 --> 02:40.410
So those are the two things we're going to be doing today.

02:41.210 --> 02:45.970
We just want to make a little message to keep us updated when we're running the trainer.

02:46.690 --> 02:51.610
And we're going to subscribe to this trainer, we just need to pass in a few different things.

02:51.610 --> 02:53.530
One is just a name.

02:53.610 --> 02:58.370
So you can find this fine tune again, just to test face, you want to choose the mode.

02:58.410 --> 03:00.820
I did character because I was doing a picture of me.

03:00.820 --> 03:06.180
But you could also do this for products or a specific style, or just a general fine tune, and then

03:06.180 --> 03:07.500
you choose the trigger word.

03:07.540 --> 03:09.620
A lot of people use Tok tok.

03:09.860 --> 03:11.220
I use UK.

03:11.700 --> 03:15.700
It doesn't really matter what you use, as long as it's something that won't be in the training data.

03:15.700 --> 03:21.220
So it's something that there's no real image for in the training of the client.

03:21.700 --> 03:23.580
And when you run that, you get a fine tune ID.

03:23.620 --> 03:28.740
It gives you an ID that you can follow up on and then you can submit the job.

03:28.940 --> 03:30.060
This is the other way to do it.

03:30.060 --> 03:31.220
You could submit the job.

03:31.580 --> 03:34.340
You can take this request ID that you get.

03:34.340 --> 03:36.980
And then you can get the status whenever you want.

03:37.020 --> 03:39.220
Like in this case this is completed.

03:39.260 --> 03:42.980
And it took 759 seconds here.

03:43.300 --> 03:46.460
There's also you can get the result the fine tuned ID.

03:46.460 --> 03:50.780
So when you've run the full thing and it's completed that's how you get the result.

03:51.180 --> 03:55.820
If you're doing this programmatically, then you just want to run in a loop and just check each time

03:55.820 --> 03:57.220
as the status completed yet.

03:57.220 --> 04:01.870
And once it is, then you've got your fine tuned ID that you can call back, but yeah, once you've

04:01.870 --> 04:06.790
got the fine tuned ID, you can just use that model as much as you want forever for as long as you want,

04:06.830 --> 04:11.510
and it's just something you have to pass in here to this fine tuned result here.

04:11.510 --> 04:12.510
We can actually run this.

04:12.510 --> 04:22.630
I'm not going to do another fine tuned job, but let me just run that and that and then just gonna upload

04:22.630 --> 04:29.910
the file clean here, the fine tune ID I'm just going to paste in here.

04:30.750 --> 04:31.790
That was what it was.

04:32.750 --> 04:34.150
And then I can run this.

04:34.190 --> 04:36.390
So I asked for the LinkedIn profile picture.

04:37.390 --> 04:40.830
I just need to bring in my Q update which is here.

04:41.750 --> 04:44.670
This is going to give me messages while it's running.

04:46.870 --> 04:53.670
See, when it comes back with oh, I didn't define the request library, just encrypt that.

04:54.070 --> 04:54.390
All right.

04:54.390 --> 04:57.590
So I've got all the right libraries here.

04:57.630 --> 05:00.630
Now there's another image of me.

05:01.510 --> 05:02.830
Look a bit like JD Vance.

05:03.270 --> 05:07.350
You could just say editor instead of LinkedIn.

05:07.390 --> 05:08.030
Profile picture.

05:08.030 --> 05:13.710
You say picture of you in Times Square because it knows who your CK is.

05:13.710 --> 05:20.430
Now, with this fine tune ID, then it will be able to kind of follow that prompt.

05:21.430 --> 05:21.990
There we go.

05:23.550 --> 05:28.470
Funnily enough, one of the things you find is that you tend to it tends to make all the other people

05:28.470 --> 05:30.990
in the image similar to you as well.

05:31.390 --> 05:34.870
So you can see here it's made a few very similar to me.

05:35.150 --> 05:36.750
But yeah, that's that's how it works.

05:36.750 --> 05:37.790
That's fine tuning.

05:37.830 --> 05:38.750
It's pretty straightforward.

05:38.750 --> 05:40.390
You don't have to know anything about machine learning.

05:40.390 --> 05:46.110
Thankfully, I massively prefer to do this rather than trying to figure out my own computer, although

05:46.110 --> 05:51.030
you can actually run this on your own, Mac if you have an M1 or above, or in your PC if you have a

05:51.030 --> 05:51.910
gaming PC.

05:52.110 --> 05:57.190
So these tools are open source, but I prefer to use an API wherever I can, even if it costs a couple

05:57.230 --> 05:57.790
of bucks.

05:58.590 --> 05:59.110
All right.

05:59.150 --> 06:00.510
Yeah, hopefully that's useful for you.
