Unlock Ollama's Modelfile | How to Upgrade your Model's Brain using the Modelfile

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi guys in this video we are going to look at something known as model files in olama this is where you can use your skills your prompts and you can change the sort of brain of a model so we know how to install olama but for the sake of all I'm just saying the steps once again so we go to ama.com and then we have the download button now it is available for the three of the systems Mac OS Linux Windows you name it so since I on my I'm on my Mac so I'm going to download for Mac OS get this downloaded install this and when you run AMA when you start AMA you will see an icon on the top specifying that ama is running you can quit Ama from here and again you can start AMA uh by searching uh in your applications so once we have ol running uh let me go to a terminal so let's go to a [Music] terminal and in the terminal what we can say is O Lama just o Lama and you will get a list of options where you have uh these uh you know available commands at your disposal now let us look at the models that we have and then we can maybe move ahead with the model files if you want to learn more about AMA and see the different use cases I already have tons of videos on my channel you can go ahead and look at the different use cases of AMA but this video is specifically for the model file as has been requested by one of my viewers so uh we say AMA list then we can see the list of models that I have as you can see I have huge list of model I'm going to take my favorite model here which is the mistal model here and run that so to run this I'm going to say o Lama uh run and mistal okay so this is going to pull the model if it is not available here since it is already downloaded it is going to use the already downloaded model uh which is sitting at my local system so what is 1 + 4 and we should get the answer so this is how we use AMA but we are not here for using AMA but we are here for changing the you know the mind and the brain of the model that we are working in so right now I'm going to introduce you to one more function if you just click U type AMA here and uh you just see the list of available commands we can see we have a help here the show in the show information for a model so let me see uh show and help so we want to see the help um menu we are asking uh to show us the help in the show uh command that we have at our disposal So within the show command this is a user so AMA show and give the model name and then we can use these Flex so for example we can say o Lama show mistal and then the flex so we can say specify the the for example the parameters that we have here uh we can say parameters okay so this is the stop parameters uh which is the INS and/ INS we can have a look at the license uh let's look at the license this is the license okay we can have uh a look at now we have seen the license we can have a look at the model file itself so uh let's go to show model file let me clear this first so you can have a good view so uh we're going to look at the model files okay so this is the model file of mistel as you can see we have this command so from uh this is the location where my models are downloaded this is the template of mral model so instruction then we have a system and then we have a prompt here parameters these are the parameters two parameters that we have uh let me go to a Visual Studio code editor and uh I've chosen this folder as my working folder let me create a model file here so let's say a model file here maybe we can run this here so we can say AMA show mril and uh model file so we can maybe copy this things and uh copy this and paste it here so we are creating a new model file uh from we don't need to put this uh we just need to specify that we're creating this from mistal file so this is the model file so from mistal we have this template now now this is the parameter stop this is the parameter stop of iny and now uh let's introduce a system here so in the system what you can say that you uh are an assistant who speaks like M&M the famous rapper okay so contrl s for this now we you have created a model file you can also have a read of how to create the model file so you can go to this link so here is an official documentation of AMA Lo AMA docs and model file so how you can create a model file is that we need the from instruction so from defines from which model you're trying to use if you have downloaded your own models like a bin file or like a GG UF file from hugging face you can use that particular model as well for creating the model file now since we already have mistl downloaded so we're going to use mistl as our base model for creating this model file Now using this model file we are going to create another instance of mistal and that let's say we are going to call it mistal prompt so what other things that we require is we can set different parameters so for example in the parameter section if we go and have a look at the parameter we have this temp temperature settings okay so for example uh if you have uh we can specify this parameter so parameter temperature one so we can indeed specify this uh this is a parameter this is a temperat and one okay you can specify this as well also instead uh with regards to parameters there are different parameters that you can load uh the top the temperature being famous we have the seed the top K top p and everything next we have u in the model file we can specify the template so you can see this is the template for the mystal model we can specify different uh parameters we have seen this system this is a system message that will be set in the template so we are trying to create a system message so this is the system message that we have already said your an assistant who speaks like &em the famous rapper we can add license as well and we can specify the specific memory history as well okay so first of all Let's uh see and try to create a model using this so in order to create a model what you need to do is these are the steps which are already mentioned we can we first need to save it as a model file so this is the model file we have then we can specify AMA create choose a Model name- F and location of the file so what we can do here is I'm just going to clear this we can say AMA create the name of the model let's say mistal and prompt so this is the name of the model mistal prompt and then you're going to locate uh specify the location of the file so the model file is here itself so we can specify the model file just press enter this has been transferred and we see a success here so now if you list the models that we have so AMA list we can see that we have mistal prompt as a new model now let's go ahead and try this new model and see uh how does it perform does it remember that it's &m so uh let's try this olar R uh mystal prompt okay and let's call this uh let us ask it any particular questions with did expectation that it should return the response in the style of &m so what is the capital of India maybe let's see the response yo it's slame Shady here and you're asking me about capital city of India all right let me spit some knowledge India's Got A bustling Metropol called Delhi but New Delhi is its heart where the political scenes at so New Delhi it's the okay so we have this uh wrapper that is pretty good now what we can do is uh we have set this brain uh sort of we have changed the brain of this model now if we uh go ahead and let's say push this model uh to uh the AMA library then you can open it up for everyone to use this model so that will be covered in the next video uh but for this video uh what we if we summarize is we can create something known as a model file that will use the instance of the myal here that has this template this is the parameters and we can set the temperature as well and in a system prompt you can change the brain of the model you can also attach some messages so for example uh let me give one more example so you can see these messages that we have here specify the message history so you can specify the message history as well so I had an example of that so for example this I can copy this so let's say uh this is the initial message that you want to set so the message from the user is let's say uh let's say hi my name is Mary okay uh and assistant is like hi Mary and we can say what is like what is is the capital of India and it says New Delhi okay so we can remove this two uh just for testing it out so we can specify this messages as well now let's create another model using this same thing so we say AMA uh create a new model known as mistal with let's say memory uh and uh give it the model file- f which is the model file so that has been created we can see the list of models that we have and we can see this mystal memory so what we can do now is that we can or run this so or Lama run mistal memory okay so this is these two messages are fixed now we can say what is my name and ask it what is my name so uh you ask first now you're asking who you you are merry so that's again the reply is uh given um you know in the style of Eminem So that's uh you know how do do you change the uh system prompt how do you change the model file and this is in response to one of the comments from my subscribers so if you like this style of uh you know addressing the small difficulties that people face while using AMA subscribe to my channel and uh in in the next video uh probably I will uh show you how to export this model to your olama login so if you go to your login you can sign in here and you can upload your own models so that is a process that we are going to see in the next video uh but yeah that's all for this video thank you so much for joining please watch out the next set of videos that I have please watch the next set of videos that I have I have so many videos uploaded on AMA but until then see you in the other video have a nice day thank you so much
Info
Channel: Prompt Engineer
Views: 5,646
Rating: undefined out of 5
Keywords: prompt, ai, llm, localllms, openai, promptengineer, promptengineering
Id: QTv3DQ1tY6I
Channel Id: undefined
Length: 13min 30sec (810 seconds)
Published: Thu Mar 07 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.