Полная расшифровка видео «Run DeepSeek Locally + API (and any other LLM) for FREE». Нажмите на таймкод, чтобы открыть видео с этого момента. Нужно другое видео? Воспользуйтесь генератором расшифровки YouTube.
0:00 how you doing it's look in today's video I'm going to show you how to install large language models on your machine specifically two uh functionalities I'm going to show you one oop a little bit Apple for you one is to turn it into a chat bot so we can chat here just like it was a a chat and chat GPT and also using an API so you can integrate it into your code so let's first look at uh deep seek well deep seek is this new model that's out deep seek R1 and deep seek V3 they're all the age cause apparently they're better than open eyes 01 but it's also open source so open eye models
0:46 they're closed Source you can't just download them online however deep seat you can and you also you can with meta llama models so anyway how are we going to do this well there's kind of two ways you could install or run uh large language models on your machine One is using hug and faces Transformers but that's a bit complex which we might cover in a future video but a simple way to do it is by using ol Lama which as I say get up and run with large language models literally all you do is download AMA download it for mac and then you install it as an application and once it's installed that's you you now literally just pass in which model you want to use so for example the top one
1:32 here in models on ama.com is deep seek R1 whoops let me zoom in there and if we click on that let's see you can see almost 800,000 people have pulled um I cancel Sor they have it downloaded thow one minut on that you can see that it has a bunch of different models so 1.5 billion 7 billion 8 blah blah blah now I would suggest depending on the size your computer use a smaller one the better up the higher up you go the better they are but then a they're going to take ages to download B they're going to be much more computationally expensive if you just have a normal laptop like me you know 1.5 billion 7 billion maybe eight but
2:17 we're just going to go with the 1.5 and so the way that we run this is literally with the command it gives here Lama run then the name of the model then we have colon if it's a specific version it's a 1.5 billion version so let's go to the code and I'll show you so let me leave this and we'll clear this so you've just started up your download of a llama now you want to run it what do you do well I have here an Alama model script which you could just run for reference if you're running script you're not too familiar with it script automates tasks so automates run in ama essentially this one now the way that you do it is once
3:04 you've downloaded these files this setup AMA model you would shamod plus X the name of the file and then that will allow you to then run the file by/ setup and then you'd run it but if you want to do it just straight from terminal the way that we do it here is we would first want to download the model so that's that um all Lama run would run the model first we would want to pull the model so Lama pull and I already have it so it's instant but for you it might take you know a couple of minutes or whatever now once that's pulled the model you now have that model on your system to run so you could do Lama run and then the same
3:50 same one um easier for me to just paste it go back to the middle oh I already had it run um and then run and then automatically starts running and you can send the message so just say hi now you see it thans it's like hi how can I assist you today let's say I'm making a tutorial about running LMS locally to me LMS so there you go and sorry they started saying some stuff back now you'll notice here that it kind of comes in two chunks when you talk to this R3 model specifically as it has this initial
4:36 chunk where it's like I'm thinking and thinking maybe that then the next chunk which is actually the stuff like that it wants to give you back so for example a a good example that I had done practicing for this is um write me an article on the recent election of trump and so it will start thinking it'll start streaming out so it's like all right so we need to write an article about Trump first off I know this I think it would help blah blah blah also I guess it would be good here I'm curious about this but wait what about that and so you can see it starts to have this like human train of thought
5:22 which I think is possibly where to like SEL and replicating the human mind but I think that's possible a downside of people who are you know doing this kind of thing with AI is I don't really know if you want to replicate the human mind exactly because it's a bit kind of flawed in in a lot of ways so um anyway under that you can then see it's like right I've finished thinking here's the actual results so pretty cool pretty good um and then to leave this this chat you just say follow slby that's you out and the cool thing about this chat is obviously you can get confidential information it's not over the Internet it's not stored anywhere your data is not used to retrain the model it's just your model that you're running which is cool now if I have this model now but I want to implement it into my program say
6:08 for example I have this tweet generating uh AI program which I created using AI in like 30 minutes you can check it on the carded video here but basically this chats to a hugging face API which is a basically a a place which hosts models on like large language models Etc and data set stuff so I wanted to run it locally instead and so instead of using this hug and face API I can use the AMA API so this Local Host 11434 is not your large language model it's all Lama because then when you start trying to interact with the API you have to pass in which model you want
6:53 so here what we have is this is me just getting some data and then I construct a prompt so for the prompt for this tweet generation one as a copywriter generate this tweet about this do not you're thinking only tweet resting tweet your response has a hard limit of 280 chars um now that's because it's a tweet and you create this payload which is the model and then the prompt and then streaming as false you can set that to true and it will stream see the way in terminal where it can comes up like this that would be streaming true streaming false waits till the whole thing's done and then gives you it so then you do this response equals requests. poost it's a post request on HTTP which is what requests is so import
7:39 requests to that URL with that payload so basically you pass that to the URL and then it'll give you something back and that will be the response and it gives you a big response with a bunch of stuff in it we only want the actual response the generated text we don't want all the other stuff date created model Etc so we have here the model tiny llama so I'll show you deep um deep seek in a minute we use tiny Lama first tiny llama is another model now where do you get this model again it was literally just on on um AMA so on AMA you can go to models you can have a flick through and you can see there's a bunch for
8:25 example we have this other one code llama as well which is pretty cool but yeah tiny llama so the reason I'm thinking for tiny llama is I'll show you in a minute but basically it's small and it's fast and it does exactly what you need which is always remember whenever you're running these llms like do you really need for instance deep seek R1 to to do a tweet generating app probably not probably Overkill but anyway so on the Tweet generating app I would just write like say Trump and then give me some casual tweet about Trump that will generate and there we go sometimes I think it's better to be a donkey than a horse at least I can get away with anything there you go anyway it just in the cool thing is it keeps changing each time whereas the previous model I had on
9:11 hug and face which was the free model was rubbish whereas this now is a good model that's running so let's try instead then using the Deep seek one so if we go here we'll copy that model name deep seat we get the 1.5 billion one that's best in here deep and contr S make sure that's run where's it run there we go so the thing now as you see a it's going to take ages B will let listen to my instruction let's wait and see so if we go back here we can see that it's done the get request it should be doing the post request but it may not show me
9:56 until it's completely done oh there we go that's pretty junky right so there that's what it's generated it hasn't listened to the 28 chars and as you can see it's shown me all of its thinking but the good thing is because it's between this think and think you could then just use some sort of split um to to remove the text before this or keep the text only after because it is in that kind of format but it is a bit verbos but it's cool cuz it shows you how it's thinking anyway there you go so so that's how you can create your own or use your own uh or use a large language model on your own machine such as the new open source one which is super cool so anyway if you have any comments questions queries do let me know below
10:42 until next time I'll see you later take care