Welcome back.
With all our pipeline parameters defined, we are ready to start the actual training process.
If we look on the GitHub page of axolotl, we can see that in order to launch a training session, we
just need to run this command and point it at our configuration file.
So in a new bash script let's just paste it and change the path.
All right.
Now we can just run it and the training should start.
There we go.
The model is being loaded and the data set is being tokenized.
And now the actual training takes place.
We can see each step how the loss is getting smaller meaning our model is actually able to learn the
task.
This is a very small data set, so the epochs go by very fast.
Let's just wait it out and let it finish.
All right.
And that was it.
The training is now complete.
It was as easy as that.
Now this was a rather small model on a small dataset.
But the basic idea is the same.
And we will see that even with such a tiny large language model trained on so few examples, we can
still get very good results.
Our model is saved right here.
Now it's time to test it and see what it managed to actually learn.
We'll create a new Python file for this.
If we go back to the model page of Tiny Llama, we can see it already has a how to use for us.
This is the generic way to run most large language models.
It's not fast and it can be drastically optimized, but it will do just fine for a test.
Let's start from it.
First, we'll change the model path so we use our newly trained model.
Then we'll keep the dtype to be float16 since that's what this model likes.
And the device map so that we can use the GPUs.
Then for the input we haven't fine tuned the model with a system prompt, so we'll be removing that.
As for the user content, which is our actual input, let's write a synopsis for it to start from.
Let's say that a bright student was working with the fuzzy scientist on a project.
All right, let's prepare our input prompt.
We can see the chat template is added in the same format as we specified during training.
Start with the user and then finish with the end of sentence and the system tokens.
All right let's pass it through our model now.
We'll keep things simple and only set its maximum length to 512 tokens, which should be enough for
a short story.
Starting from this prompt.
All right, here's the output.
Let's take a look.
So it's a story where the student was in a struggle to come up with fresh ideas and his intelligence
saves everyone from a quite dramatic situation.
Okay.
Interesting.
Now let's try another one.
So this one is about a project meant for all humanity, with images of crowded cities and roads packed
with people.
All right.
It's clear the model got the idea quite well, even from such a small data set.
Sample size.
This is great.
Okay, this covers the most basic way of fine tuning a large language model.
Now, in order to get to the next level, we'll have to cover some more advanced concepts that will
allow us to train better and larger models, all while doing it faster and with less resources.
Thank you for making it so far and for paying attention.
We'll resume our work together in the next section of this course.
Good luck and I'll be seeing you there.