00:00:00
okay let's jump right into customizing
00:00:03
llama 3 which was just updated about 16
00:00:06
minutes ago here on the olama website so
00:00:09
if you haven't already go ahead and
00:00:11
search for llama 3 on the olama website
00:00:14
if you don't have Ama already installed
00:00:16
check out the two videos Down Below in
00:00:18
the description I have a video on how to
00:00:20
install and set up AMA on both Macs and
00:00:24
on windows so go ahead and check that
00:00:26
out before we get going so this is Alama
00:00:29
3 that just dropped today we're going to
00:00:32
show how you can go about customizing
00:00:34
this model with system prompts and
00:00:37
different parameters that we have
00:00:38
available so if you haven't already go
00:00:40
ahead and navigate here check it out
00:00:42
read some documentation here we're going
00:00:43
to be using the Llama 3 8 billion
00:00:46
parameter model and for those who aren't
00:00:47
familiar you can get some different
00:00:49
information around the model here on the
00:00:52
model card so first thing I am going to
00:00:55
do is jump over into the terminal so
00:00:58
that we can start running some ol
00:01:00
commands to pull down llama 3 onto our
00:01:03
computers okay I've got my terminal
00:01:05
pulled up here now the first thing I'm
00:01:07
going to do is run the olama list
00:01:09
command which will list all the models
00:01:11
that I have installed here on AMA as you
00:01:14
can see I don't have any and install so
00:01:16
the next thing that I am going to do is
00:01:17
run AMA pull and I know the model that I
00:01:22
want is the brand new llama 3 Model here
00:01:26
and I want the 8 billion parameter model
00:01:29
so I'm going to go ahead and run this
00:01:32
take a few minutes to download it and
00:01:34
then come back after it's done
00:01:35
completing its download okay I'm back at
00:01:38
the terminal here and we can see that
00:01:41
llama 3 has officially downloaded onto
00:01:43
my laptop now the next command that I'm
00:01:46
going to run is AMA run and llama
00:01:50
38b just to make sure everything's
00:01:52
functioning properly I am going to ask
00:01:55
it a very simple question write me some
00:01:59
sample python
00:02:02
code all right so we can see that it's
00:02:05
printing out some output here and
00:02:07
writing me some sample python code so I
00:02:11
am going to stop that because we know
00:02:12
it's running I am going to type in
00:02:15
slashy to exit the model and clear this
00:02:18
out now the next step that we're going
00:02:20
to take is we're going to actually
00:02:22
customize this model the system props
00:02:25
and some of the parameters to just make
00:02:27
it more customized to our particular
00:02:30
needs maybe we want the system prompt to
00:02:32
say certain things so that's why you
00:02:33
would go about customizing your own
00:02:36
version of the model here so I'm going
00:02:38
to jump into VSS code and we'll walk
00:02:41
through how to create a custom version
00:02:44
of llama 3 okay I have vs code open up
00:02:47
here and I have a file called custom-
00:02:50
llama 3 holded up here on my laptop you
00:02:53
can call this file whatever you want but
00:02:55
you'll have to be sure when we type in
00:02:57
the command to reference our model file
00:02:59
file that you're typing the correct name
00:03:01
of your file here also you could just
00:03:03
type this in text editor if you want it
00:03:05
to I'm using vs code cuz it has an
00:03:08
integrated terminal now we're going to
00:03:10
briefly walk through each line here of
00:03:15
what it takes to create your own model
00:03:17
file now the first thing that we're
00:03:18
going to do is call from llama 3 colon
00:03:24
8B now this is our base model that we're
00:03:27
going to be using here we're going to be
00:03:28
using the bass llama 3 8 billion
00:03:31
parameter model as our starting point
00:03:34
for our custom model so that's why you
00:03:36
have the from llama 3 colon 8B now one
00:03:39
thing to call out here the from is not
00:03:41
case sensitive you could type that in
00:03:43
all lower cases if you want but the
00:03:45
convention when creating your custom
00:03:46
model files is to type in all caps there
00:03:50
now that's the reason that we have the
00:03:51
from llama 3 now the next thing that
00:03:54
we're going to do here is we're going to
00:03:56
set up some custom parameters now you
00:04:00
have to set these correctly for each
00:04:02
model or when you create your custom
00:04:04
model then your output will be incorrect
00:04:08
or you may see some weird output if you
00:04:10
don't type these parameters correctly
00:04:12
here now I'm just going to go here and
00:04:16
the first parameter that I am going to
00:04:18
set is temperature by default the
00:04:20
underlying temperature is 08 or 07 for
00:04:25
most of the models so we're going to say
00:04:28
we're going to set this temperature to
00:04:29
one so this is going to make the model
00:04:31
as creative as it can possibly be that's
00:04:34
what the value of one means when we set
00:04:37
a temperature parameter and if you're
00:04:39
used to playing with open Ai and things
00:04:41
like that and other large language
00:04:43
models this parameter here shouldn't be
00:04:46
foreign to you at all now we're going to
00:04:49
set some other parameters here that I'm
00:04:51
going to just paste in these are our
00:04:53
stop parameters now these are set based
00:04:56
on the model now you can get these
00:04:58
values here by going to look at the
00:05:00
model card on olama so let's jump back
00:05:03
over into the browser so you can
00:05:05
understand how I came up with these
00:05:06
parameters here and it's not just
00:05:08
something I'm making up okay we're back
00:05:10
at ama.com and we're at the Llama 3
00:05:13
Model here now I was going to show you
00:05:16
how I came about getting the stop
00:05:19
parameters and what you're going to do
00:05:20
is go down to this section here and go
00:05:22
to params and then click on that now we
00:05:25
can see that the stop parameters are
00:05:27
these sets of values here so you're
00:05:29
going to take these values one by one
00:05:31
and add them individually like I did in
00:05:34
my model file so again each model is
00:05:36
going to be different so if we're
00:05:38
customizing minstral you would have to
00:05:40
make sure that you were actually using
00:05:44
their stop parameters okay so now you
00:05:46
know how I came about those stop
00:05:48
parameters we're going to go back over
00:05:49
into our model file okay I'm back in my
00:05:51
model file here in vs code here and now
00:05:54
hopefully you have a better
00:05:55
understanding of how I came about
00:05:57
getting these stop parameters now the
00:05:59
process is the same for any model that
00:06:01
is hosted on ama.com so you can follow
00:06:04
this process for any model there all
00:06:06
right so the next thing that we're going
00:06:07
to do is we need to actually have the
00:06:11
template that this model uses to produce
00:06:15
its output now I'm going to grab that
00:06:18
and paste that in so you can see it and
00:06:21
again we'll jump back over to the model
00:06:23
file so you'll know exactly how did I
00:06:25
get these values now I'm going to paste
00:06:28
that in here and this is the template
00:06:30
for the Llama 3 Model now let's jump
00:06:34
back over into the browser so you can
00:06:36
see what that looks like in the model
00:06:38
card here now we're back here at the
00:06:39
Llama 3 Model card here and where we get
00:06:43
the template information is right here
00:06:45
where we click template and the model
00:06:47
card location now we can see the
00:06:50
template here that we need to use for
00:06:52
the model to produce output properly for
00:06:55
us so all I've done is copied this value
00:06:58
here and then paste that into my model
00:07:01
file so that's all it is to it again
00:07:02
this process is the same for any model
00:07:04
that you want to customize that's on
00:07:06
ama.com all right so now let's jump back
00:07:08
over into vs code and set up our last
00:07:12
parameter okay so we're back here in vs
00:07:14
code and we're going to set up our last
00:07:16
parameter which is going to be our
00:07:19
system parameter which is basically our
00:07:21
system prompt now I am going to use this
00:07:23
as my system prop here I'm just saying
00:07:26
you are a helpful AI assistant named
00:07:28
llama 3 Droid so so that's all I'm going
00:07:30
to set you can set it to whatever you
00:07:31
want you can even make this a little bit
00:07:33
longer if you want it to but for this
00:07:35
example here I'm going to keep it pretty
00:07:37
simple here so that's all it is here for
00:07:40
us to create our model file so now we
00:07:42
need to create our new model based on
00:07:46
this model file here so I'm going to go
00:07:47
ahead and click save here and the next
00:07:50
thing I am going to do here is open up
00:07:53
terminal so I'm going to go here and I
00:07:56
have my terminal window open now I'm
00:07:59
going to type in the AMA command to
00:08:01
create our new model so we're going to
00:08:03
type in olama and then we're going to
00:08:06
type create and then I'm just going to
00:08:09
call this my llama 3 Model you can name
00:08:15
it whatever you want to now the next
00:08:18
thing we need to do is set the file flag
00:08:21
so this is going to be where is my
00:08:23
custom model located my model is located
00:08:26
in this current directory here so I can
00:08:28
just reference
00:08:30
custom- llama 3 because again that's
00:08:33
what I named my model here and I can
00:08:37
simply hit enter so I'm going to hit
00:08:39
enter here and it ran pretty quickly
00:08:42
here it's just transferring the model
00:08:44
reading the model metadata and then
00:08:46
creating the model layers there so
00:08:47
that's all it is to create my custom
00:08:49
model with the create command now let's
00:08:52
see if our model shows up for us I'm
00:08:55
going to type in ama list and we can now
00:08:58
see that I have the Llama 8 billion
00:09:01
parameter model and then llama latest
00:09:03
here with the latest tags and the last
00:09:06
Model that you can see here is my llama
00:09:10
3- model that we just created a few
00:09:13
seconds now let's go ahead and test out
00:09:15
our model to see how it funed I'm going
00:09:17
to just go ahead and open up a brand new
00:09:19
terminal window so that you can have a
00:09:21
better view okay we're back at the
00:09:23
terminal here and we're going to test
00:09:25
out our models now the first one we're
00:09:28
going to test is the Baseline model for
00:09:31
llama 3 now I'm going to ask it what is
00:09:35
your
00:09:36
name and it says it doesn't have a
00:09:38
personal name there so we don't expect
00:09:40
it to give us a name let's exit out of
00:09:43
it so that's the base model now let's
00:09:45
use our new model here which is the my
00:09:50
llama 3 model and we're going to type in
00:09:53
olama run and then my model name and
00:09:55
just a heads up you don't have to add
00:09:57
the tag at the end if you don't want to
00:10:00
you only need to use the tag when you're
00:10:01
calling out certain parameter counts so
00:10:04
if I had llama 3 8 billion parameter and
00:10:07
llama 3 the 70 bilar parameter model I
00:10:11
would have to do that to call those
00:10:13
particular Models All right so let's ask
00:10:16
this model our custom model remember we
00:10:18
set the system prompt to be llama 3
00:10:20
Droid
00:10:22
what is your
00:10:26
name and you can see hello there my name
00:10:28
is llama 3 Droid but you can call me
00:10:31
llama for short so that's just a example
00:10:35
of how you can customize certain
00:10:37
parameters such as your system prompt
00:10:39
your temperature and things of that
00:10:41
nature with a custom model file now
00:10:44
let's ask it one more question can
00:10:47
you write me a simple
00:10:51
Java
00:10:53
program and it's writing me a simple
00:10:56
Java program so it still functions as it
00:10:59
did before is just we added new
00:11:02
parameters on top of the base model
00:11:05
there for you so that's what we did to
00:11:06
make this model our own now I'm going to
00:11:09
exit out of here and type in
00:11:13
slby and the next thing I'm going to do
00:11:16
is show you where you can check out
00:11:18
other parameters that we could have set
00:11:20
in our model file okay I'm here at the
00:11:23
Alama documentation on GitHub here I'm
00:11:26
at the olama model file document a now
00:11:30
we can see the different options that we
00:11:32
have here when we want to create a model
00:11:35
file and some of these things we've
00:11:37
already gone over but like I said I
00:11:39
wanted to show you where you could get
00:11:41
other information related to other
00:11:43
parameters that you could set so I'm
00:11:44
going to go to the parameter section
00:11:46
here and click on that and there's a
00:11:47
host of other parameters that I could
00:11:50
have set so for example I could have set
00:11:53
the context window to be larger if that
00:11:56
model supported a larger token contacts
00:12:00
there or I could also set the things
00:12:02
like top K or top P if I wanted to also
00:12:06
you can see where you had the stop
00:12:08
parameter and the temperature parameter
00:12:10
so that's where a lot of these different
00:12:12
things came from I will put this link
00:12:15
into the description section also the
00:12:18
link to the model file will be in a
00:12:21
GitHub repo if you want to pull that and
00:12:23
alter it to create your own model files
00:12:25
like I said you'll have to create a
00:12:27
model file for any model you want to
00:12:28
cover customiz onama anyways so you're
00:12:31
probably wondering okay I've got a
00:12:33
custom model how can I go about using
00:12:35
that model in an application well check
00:12:37
out the two videos that show up on the
00:12:39
screen on how you could go about
00:12:41
building your very own olama chatbot and
00:12:44
if you like this video and the content
00:12:46
hit like subscribe I try to put content
00:12:49
out like this on a weekly basis
00:12:51
appreciate you hanging around to the end
00:12:52
of the video hope you like it and have a
00:12:54
great day