Let's get straight to it.
So the place where you can see everything that's going on and get knee deep in your data is a beautiful
platform called Weights and Biases.
It's completely free for personal use anyway, and it's a superb.
You can, uh, go here.
Uh wandb is weights and biases.
I to sign up, create your free account.
You don't need to if you don't wish to.
This is an this is completely optional.
It will allow you to visualize your training while it runs.
I strongly recommend it because it's super satisfying.
Uh, there's no point in doing training in my mind if you can't see lots of wiggly lines.
And believe me, we're going to have a lot of wiggly lines.
Uh, not not just today, but in the coming two weeks to go, it will be, uh, lots of charts, uh,
when you go to weights and biases and you've signed up for your free account or you may already have
one, uh, if you go to the avatar menu, like the settings menu and go to settings, You can create
an API key very similar to the sorts of API keys we've used for OpenAI and so on.
You can then go to the OpenAI dashboard, and I've put a link right here in the notebook.
And when you go to that page, but in the middle of the page, there is a section that says integrations,
and it has a section where you can put in your weights and biases key.
And if you do that, then it's your OpenAI account is hooked up to weights and biases, and you'll be
able to watch this fine tuning process happening in weights and biases.
And that's just great.
So I strongly recommend it but not required.
Assuming you did do that, then you're going to want to execute this line here which is setting up your
weights and biases integration.
And you can give it a name.
I'm calling the name of this project generally.
Overall we'll be doing a lot of this project.
I call it Pricer, but for this one I'm calling it GPT pricer because it is.
GPT is fine tuned version to price products, That's why I call it Pricer.
So we run that.
Just setting up a settings right now.
But this this is it.
This folks.
This is the time when we actually do our fine tuning.
We call a new OpenAI API, which is a the big the big one OpenAI fine tuning dot jobs dot create.
And what we pass in.
So so you remember earlier this this is what came back from uploading our file.
It has an ID.
Let me show you that it has an ID which identifies the file.
That's the name of the file.
As far as OpenAI is concerned, we had a rather simpler name for it.
This is the whole this is a file object.
You probably remember seeing this a moment ago.
That's the file ID and that's all the details about it.
Um, and that's its ID.
So we provide the ID of the training file.
We also provide the ID of the validation file.
Again not strictly necessary in our case now, but a good practice and you will want to do this for
your fine tuning runs in the future.
Probably.
We provide the model.
Now I'm suggesting GPT for many, partly because it's going to be cheaper to run it in inference.
It's just going to be a couple of cents at the most.
Um, and partly because if you remember earlier when we ran the original models, GPT for the big guy
and for mini gave fairly similar performance, not a ton of difference between them.
So it seems like we might as well fine tune the smaller one.
The seed means that it will be repeatable.
Um, number of epochs.
So this is optional.
You don't need to specify number of epochs, how many times it's going to go all the way through the
data.
You can let it decide for itself.
I want to fix it to one because we're providing a fair amount of data, 500 data points more than than
is usually recommended.
Um, and so I figured there's no point in doing multiple epochs.
If we decide we want to do more, we can just bump up the amount of training data because we've got
lots of it, rather than doing multiple epochs.
This is where I specify the weights and biases integration.
If you don't want to use weights and biases, just don't just remove this line altogether.
Um, and then suffix is an optional thing that just will include that in the name of the model that
it creates.
Just something you can do if you want the model to have a decent name.
Uh, and that's about all there is to it.
I will just mention if you haven't come across the word hyperparameters before, but I'm sure you have.
But for anyone that hasn't, hyperparameters is what people data scientists call just the extra knobs
and wheels and settings that control how your training is going to work.
Any extra parameter that is something that you can set.
Try to different possibilities to see if it makes things better or worse.
And that process of trying out different values and seeing if it makes it better or worse, uh, known
as hyperparameter Optimization.
Hyperparameter tuning as well.
And all of this is very fancy talk for trial and error, which is what it really is.
It's saying these are settings.
We don't really know if it's going to make it better or worse.
There's no real there's no no great theory behind this.
So just try some different possibilities and see what happens.
But no one wants to say it quite like that.
So everyone says hyperparameter optimization because that sounds much more important.
And so that's that's what we'll call it.
And that's why we pass in the hyper parameters.
And if you want to yourself do some hyperparameter optimization and try different epochs, then you
certainly should do so.
But anyways I talk enough.
We will run this guy and like that it runs and what comes back is a fine tuning job.
It says when it was created, uh, it says there's no error, which is good.
Not yet.
Uh, it's finished at none.
Uh, here are our hyperparameters with the number of epochs.
Um, that is the model.
Um, and then everything else, the files that we passed in.
Uh, now, this, uh, here will list all of the jobs that we've got right now.
And it starts with the most recent first.
So since we've just kicked this off, if we run this, we'll see that this, this particular job, um,
uh, and we can check it is because we should see that this here matches this here.
So we're talking about the same job, uh, and we can see somewhere here what's going on?
Um, well, actually, first, let's just this job ID thing so that we don't have to keep remembering
it.
Let's let's take it into a variable job ID.
Just make sure that that's what we expect.
If I print that you see this job, ID matches that there and that there.
This is the name of our current run the job ID that we'll use to refer to it.
And we can call this retrieve, uh, to get information about what's going on.
And so let me see what we can learn from this.
Uh, somewhere here we should see that it says that it's running.
Uh, but anyway, the most important thing where you really see what's going on is in the next line
here, which is list events passing in the job ID, and I'm limiting it to ten events.
And if I run this now, you really see the business.
They only have been two events.
Um, and it's listing them in in order where the most recent event comes on top.
So there's been two events created fine tuning job and validating training file, which is what it's
doing now.
And so what's going to happen next is that over time it's going to validate the file.
And then it's going to start to train.
And that's where things get interesting.
And because it's going to take a couple of minutes before it gets to that point, I will break for the
next video.
And in the next video we'll see.
Training in action.
I will see you over there.