Tech With Team, Ollama Flashcards

(53 cards)

1
Q

today I’m going to show you how to access

A

Today, I’m going to show you how to access some of the best models that exist completely for free and locally on your own computer [2].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

we’re going to be doing that in just

A

We’re going to be doing that in just a few very simple lines of code using Hugging Face and Langchain [2].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

I’m going to show you how to use

A

I’m going to show you how to use various Hugging Face models for free inside of a Python application, and then we’ll connect them to Langchain so we can build something even more interesting [2, 3].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

with that said let’s get into the

A

With that said, let’s get into the video, but first, some important information [2].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

understand we’re going to be using something called

A

Understand, we’re going to be using something called Transformers [4].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

now this is a free open source package

A

Now, this is a free, open-source package that you can install with Python using pip, if you’re familiar with that [4].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

it allows you to utilize tons of different

A

It allows you to utilize tons of different models that come from Hugging Face [4].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

hugging face is a platform you can see

A

Hugging Face is a platform that has all kinds of open-source models available [4].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

some of them you do need to pay

A

Some of them you do need to pay for, or you need some specific access, but most of them are completely free, and you can just download them and use them on your own computer [4].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what the Transformers package does is just make

A

What the Transformers package does is just make it extremely easy to access these free Hugging Face models and to download them and use them on your computer [5].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

you’ll see here that in just a

A

You’ll see here that in just a few lines of code, you can run pretty much any of these models, assuming you have the correct hardware [5].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

if you wanted to go further you could

A

If you wanted to go further, you could even fine-tune these models and add a bunch of advanced configurations [5].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

we’re going to be using Transformers and we’re

A

We’re going to be using Transformers, and we’re going to use this in combination with something called Langchain [3, 5].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

now Lang chain is another python package that

A

Now, Langchain is another Python package that just makes it a lot easier to work with LLMs [3].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

so if you wanted to use one of

A

So, if you wanted to use one of these Transformer models, you can connect this with Langchain and then add things like memory, connect multiple models together, and I’ll show you the basics of that in this video [3].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

now we’re going to go ahead and start

A

Now, we’re going to go ahead and start getting all of this set up [3].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

first things first we’re just going to

A

First things first, we’re just going to make an account on Hugging Face [3, 6].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

this is because a lot of these models

A

This is because a lot of these models require that you accept some terms, or their license agreement, before you’re able to actually download them and use them [6].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

so go to hugging face I’ll leave this

A

So, go to Hugging Face; I’ll leave this link in the description [6].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

you should be able to go up here

A

You should be able to go up here somewhere in the top right-hand corner and just make a new account [6].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

once you make a new account we’re going

A

Once you make a new account, we’re going to go to access token; we’re just going to leave this page open, and we’ll come back to it in one second [6].

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

to get started here we need to

A

To get started here, we need to set up our environment to be able to execute these different Python packages [6, 7].

23
Q

now this does take a second so just

A

Now, this does take a second, so just bear with me [7].

24
Q

once the environment is configured then it’s

A

Once the environment is configured, then it’s very easy to write the code [7].

25
now you'll notice that what I'm using
Now, you'll notice that what I'm using here is **PyCharm** [7].
26
anyways you can use whatever IDE that you
Anyways, you can use whatever IDE that you want, but if you do want to check this out again, I have those links below [8].
27
so first things first we want to
So, first things first, we want to create that virtual environment [9].
28
so what I'm going to do is open
So, what I'm going to do is open up my terminal here, and from my terminal, I'm going to execute a command that will create this environment for me [9].
29
now you do need python installed in order
Now, you do need Python installed in order for this to work [9].
30
what the virtual environment will do is
What the virtual environment will do is just create an isolated area where we can have the dependencies specifically for this project [9, 10].
31
so in order to do that we're going
So, in order to do that, we're going to type `python -DM venv`, and then `venv` [10].
32
what this does is use VV to create
What this does is use VV to create a new virtual environment called venv or VV, and then once this step is finished, we're going to activate that virtual environment [10].
33
the next step is to activate the virtual
The next step is to activate the virtual environment so that we're using it when we install various dependencies [10, 11].
34
next step we're going to make a new
Next step, we're going to make a new file inside of our directory called `requirements.txt` [12].
35
now this is where we're going to
Now, this is where we're going to put the various requirements that we need in order to work with the **Transformers** and **Langchain** Library [12].
36
now that you have the requirements.txt file
Now that you have the `requirements.txt` file created from your virtual environment, you're going to type the command `pip install dashr` and then `requirements.txt` [13].
37
okay so all of that's been installed
Okay, so all of that's been installed, and the next step here is to simply get our **Hugging Face** token [13, 14].
38
now we need the hugging face token because
Now, we need the **Hugging Face** token because a lot of the models just require that you accept some license agreement; they're free to use, but you have to essentially check a box, and that's connected to your **Hugging Face** account [14].
39
so if you try to pull certain models
So, if you try to pull certain models, it will give you an error, and that's because you haven't added the token [14].
40
so what we're going to do is
So, what we're going to do is, from our user access tokens again, you can just go to **Hugging Face**, create a new account, press on your profile, press here on access tokens, and simply create a new one [14, 15].
41
now this command will work as long
Now, this command will work as long as you've installed **Transformers** in your ual environment [16].
42
okay so we're almost done here that
Okay, so we're almost done here; that is pretty much the environment setup [16, 17].
43
okay so first thing we're going to
Okay, so first thing we're going to do here is we're going to say from **Transformers** import and then we're going to import pipeline [17, 18].
44
now pipeline is a simplified way of running
Now, pipeline is a simplified way of running various models [18].
45
what I'm doing is I'm using this thing
What I'm doing is I'm using this thing called pipeline; pipeline just automatically sets everything up for me, and all I have to do is specify the task [19].
46
the first step is it's going to download
The first step is it's going to download this; it's going to take a second to download [20].
47
once the model is downloaded it will
Once the model is downloaded, it will be stored on your machine, and then you can use it very quickly after that [21].
48
now you'll also notice that we're getting
Now, you'll also notice that we're getting some kind of warnings; I'll show you how to mute those in one second, and you'll notice that it says that the device is using CPU [21].
49
now this is the main thing I want
Now, this is the main thing I want to focus on: how do we get this to use your GPU? [21].
50
so first let's look at how we
So, first, let's look at how we can run these models using our GPU [22].
51
now in order to do that you
Now, in order to do that, you are going to need an Nvidia GPU, or at least that's what I'm going to recommend because that's what works the best [22].
52
now in order for your Nvidia GPU
Now, in order for your Nvidia GPU to be used for this, you need to download and install CUDA [22, 23].
53
once Cuda is downloaded what you're going
Once Cuda is downloaded, what you're going to want to do is restart any terminal instance that you have, so close your IDE, reopen it, and you're going to type the following command just to verify that it's installed [23, 24].