So this is where I left you looking at this satisfying chart on training loss and seeing the training
loss coming down.
Could stare at this all day.
Uh, but, uh, we will move on to other charts.
Uh, let's go back to this diagram again.
Um, I wanted to point out this one that you may have already seen.
This is the learning rate.
Let's blow this up.
Uh, so this is showing you exactly what I was trying to describe earlier, but but as I, as I told
you it would, it looks much more clear when when you're looking at it, uh, in weights and biases.
Um, so this is showing how the learning rate changed over time from the beginning through to the end
of the four, almost four, uh, didn't quite get to the end of the fourth epoch, um, when I ran the
model before.
And what you can see is that the learning rate started at zero.
It then went up, uh, because of the warm up to this point here.
Um, and then you can see that it, it gradually comes down in this very nice, smooth way, slowly
to start with and then a lot more.
And then at the end it tails off.
And the idea is that it actually gets to exactly zero when you're four epochs are up.
But I didn't make it to the end of the fourth epoch.
And obviously if you choose to run for one epoch, then you get this whole chart just for the one epoch.
It just takes the number of epochs that you set, and it smoothens the learning rate over that number
of epochs.
Uh, so, um, it hopefully illustrates exactly the point.
And you can see that our blue line representing the current batch is right up at the top of this.
Uh, and it looked flat to us only because we were at the very, very top.
But in due course, it is going to come down smoothly, just as its predecessor did.
Uh, so then another thing I wanted to mention, um, is that when we were looking at the different
runs just here, you can see you can use this eye icon here to decide what you're going to be looking
at.
And I didn't put an eye on this one here in between.
Now, what this is, is that after my, uh, my this batch, uh, was a brutally kicked off by by kicked
off its instance by by Google.
I was annoyed and decided I wanted to try and continue where it left off and run another couple of epochs.
Even though the results got worse, I wanted to see what happened.
I wanted to take it to an extreme, and I wanted to make sure it wasn't just an anomaly that the fourth
epoch, the results got worse.
Maybe the fifth epoch, they would suddenly be a lot better.
So I at least wanted to see it play out a bit.
Um, and so I'm going to now show that for you.
Now it's going to be a bit confusing because I started it again.
It's not going to continue off to the right here.
It's going to begin over on the left.
So you just have to bear in mind that it's going to see it as if it was the first training step.
But in fact, what I'm going to show you belongs over to the right of this purple line.
Let's see.
Now this this this thing.
And there it is.
So let me blow this up.
So hopefully it's clear to you that there should really be over here.
It should be we should be able to take that and pull it over to the right.
Because this is what happened when I resumed that SFT trainer from where it left off down here.
And what you can see is this is then basically a fifth, another full epoch, um, representing that
we never completed the fourth one, but this is like doing a whole nother epoch.
And then this would be like the whole of the sixth epoch.
Um, and what you can see again, another of these falls between the, um, when it, when it started,
uh, the sixth epoch and at this point, definitely in a very suspicious territory.
The loss looking too low.
And sure enough, when I took these versions of the model and tried to run tests against them, they
were all poorer in performance than the model that I took from a cut off about about here.
So it was a test worth doing.
I needed to satisfy myself that it wasn't just bad luck back here, but that it really was overfitting
and that I wasn't getting useful results anymore.
And that did prove to be the case.
So it was a good test to do.
And you can benefit from this because you can know if you have decided to do the full, the full Monty
and run with this big version of the model, then, you know, once you've done, uh, your you might
as well not go beyond three epochs.
There is no no use for that, in my experience, unless you've tried changing hyperparameters and you've
discovered something different.
Uh, so then, um, the final thing I'll show you, you can play around with many of the other charts
and weights and biases.
There's lots to explore.
You can look at the gradients themselves, and that is quite a rabbit hole.
And you'd have to do a little bit of, uh, digging and research to understand what you're looking at
and how to learn things from it.
And ideally, what you the main things that you want to be looking for is making sure that you never
get into a situation where your gradients are becoming zero.
Um, which means that you're not learning anymore.
If your gradients are zero, then your model is no longer learning and there's no use to be continuing
the learning process.
So you want to watch out for gradients being zero, and you also want to watch out for gradients blowing
up and being too high, because that means that your your model is going to be bouncing around too much
unless your learning rate is really tiny.
Uh, your model is going to be, uh, not learning in a productive way.
So those are some of the things to look for when you're looking at gradients in weights and biases.
But the last thing I wanted to show you was going to hugging face.
Um, and just show you if you if you remember this, this model here, which is the, uh, the the version
of the Pricer model that I ran for all of these epochs.
Um, you see this?
The name of the run is the name that I constructed based on the date and time.
Um, and it ends in, uh, 39.
The number of seconds.
Uh, just keep keep that in your mind.
When we turn to hugging face, you go to the avatar menu and to your own name.
Uh, you will then see your spaces if you have any, your models and your data sets.
You can see I have 1 or 2.
Uh, and when it comes to Pricer, I've run this once or twice.
Uh, uh, and these, each of these represent the different repos that represent one of the different
pricer runs.
Um, and I like to keep them each each of these runs as a separate repo so that I can have all the different
epochs and everything within this, this, this one repo.
So what this 139 I think is the one that was the big guy with, with the, the, the four, three and
a half epochs.
So if we click into this, um, it comes up with the model page, uh, and if you go to files and versions,
what you're looking at here is basically you're looking at git, you're looking at a repo which has
within it the files associated with your model.
Um, and as I mentioned uh, recently, you can see that the business here is this file, the safe tensors.
And that file is 109MB, which is the size of the adapters that the adapters that we're using with are
set to 32.
When we did the maths, we worked out that that would be 109MB worth of weights.
And that is all in this file.
Safe tenses right here.
Um, and, um, yeah, there's there's, uh, a few other things that we could look at.
Adaptive config.json, uh, gives information about the, the adapter that we're using for the Lora
fine tuning.
And you can see, for example, it has the target modules stored in here, and it has our value of R
32.
It says we're using Lora training.
Um, and so it has and it has the base model name uh llama 3.18 billion in there.
Um, so that that gives you a sense of all of the information that's saved for this, this model.
But the other thing I wanted to point out was this 16 commits over here.
So this is showing the commit history.
And basically every 5000 steps, um, the code that you saw was saving.
This was pushing our model to the hub.
That was something we configured in the training parameters.
So it was being saved every 5000 steps.
And that means that we can load in any of these models and test them.
And that's how we can select the one that's performing the best.
We've got each of these different checkpoints.
And we can do as many of these as we want.
Um, and uh, and we can use that to, to, to come back and recreate that moment when the model was
at that point in training.
Um, and so you can imagine I could have all of my different training runs all in this as different,
uh, different revisions of this, uh, different, different versions of this price, the repository.
But then it would get very cluttered.
And that's why I separate it out so that each run is its own repo.
And then the different batch steps show here, um, as the different history of the commits.
Um, I think that's a nice, organized way of doing it.
So that's how to see the model in the in the Huggingface hub.
Uh, presumably We'll see.
This is the one that's running right now.
It's updated 15 minutes ago.
So we go into this go into files and versions.
We'll see that.
Yes it's already saved a version.
We've got to step 5000.
So one version of this or two commits because there was an initial commit.
And then step 5000 is just has been saved 15 minutes ago.
So there's already a model that's running.
And if you've been doing this at the same time as me, then you'll be in a similar boat and you'll be
having versions of this model being uploaded to the Huggingface hub while I speak.
And you'll actually, you would be able to test them right away.
You don't need to wait for the training to complete.
Um, so there we go.
We've seen the, uh, the training underway, with the losses showing here that are a bit hard to understand.
We visualize them beautifully in weights and biases, and we've seen the model itself being saved to
the hub.
And this is the experience of training.
And I tell you, I can do this for hours.
And I have done this for hours, which is very tragic of me.
And in fact, I mentioned, I think right back at the very beginning of this course, that that screen
you see over there that actually has weights and biases on it and the the chart that I was just showing
you, uh, was, uh, this chart was the chart that was on there, uh, at the very beginning.
Right now it's showing this chart here.
Uh, and so I've been watching that during the course of the first few weeks of building this, this
course.
Uh, and it's been terrific fun.
Uh, and hopefully you're doing much the same thing, watching the training happening, seeing your
model versions being uploaded to the hub.
Uh, and all that remains is for the run to complete.
And then tomorrow for us to come and evaluate the model and see how we have done fine tuning our own
verticalized model.
Um, but we'll just wrap up for today.
Back to the slides.