1
00:00:00,160 --> 00:00:03,120
Okay, so this is something completely different.

2
00:00:03,120 --> 00:00:04,440
That hugging face is.

3
00:00:04,480 --> 00:00:05,960
And of course they're related.

4
00:00:05,960 --> 00:00:13,120
But but nonetheless this is different as well as being this this this platform, this hub that's online

5
00:00:13,120 --> 00:00:18,560
that is basically a bunch of repos of data sets and models and also spaces.

6
00:00:18,800 --> 00:00:27,160
Hugging face also has code, open source libraries that they've made available that everybody uses.

7
00:00:27,400 --> 00:00:28,160
Everyone.

8
00:00:28,400 --> 00:00:34,320
And these are these are open source libraries that implement open source transformer models.

9
00:00:34,320 --> 00:00:39,080
So using PyTorch and also TensorFlow which is and also Jax.

10
00:00:39,080 --> 00:00:41,720
These are all different deep neural network libraries.

11
00:00:41,720 --> 00:00:45,200
But PyTorch is the most popular and that's the one that we'll use most.

12
00:00:45,360 --> 00:00:53,080
And they've they've written Transformers in PyTorch so that you can then just import some Python code,

13
00:00:53,080 --> 00:01:00,920
download some weights, and be running the model yourself in, in like in JupyterLab in cursor, or

14
00:01:01,200 --> 00:01:03,240
as we will in a minute on Google Colab.

15
00:01:03,480 --> 00:01:09,170
And so the first thing you might have in mind is, okay, what's the difference between running an open

16
00:01:09,170 --> 00:01:14,530
source model that way versus running a llama, which we did in week one?

17
00:01:14,730 --> 00:01:17,050
Well, I mentioned this at the time, but I'm going to do it again now.

18
00:01:17,050 --> 00:01:21,970
But hopefully you're like, I get this llama is like a software product.

19
00:01:21,970 --> 00:01:23,490
It's something that's been written.

20
00:01:23,490 --> 00:01:24,810
It runs on your machine.

21
00:01:24,810 --> 00:01:26,850
You don't get to run the code of it.

22
00:01:26,890 --> 00:01:34,970
It's like an application and it is able to take files which are very efficient packaged models like

23
00:01:35,010 --> 00:01:36,730
Gemma and Llama and the others.

24
00:01:36,730 --> 00:01:43,570
They've been packaged into this file called a GIF file, and then it runs it with efficient C++ code

25
00:01:43,570 --> 00:01:49,570
locally in a box, and it listens on a particular port, which and it provides an endpoint that's compatible

26
00:01:49,570 --> 00:01:51,490
with OpenAI, as you know.

27
00:01:51,650 --> 00:01:54,450
So you can just use OpenAI's libraries and connect to it.

28
00:01:54,450 --> 00:01:59,690
So think of it as fast packaged pre-baked software.

29
00:02:00,170 --> 00:02:06,290
Hugging faces libraries is like you get access to the actual code, the Python code, and you can step

30
00:02:06,290 --> 00:02:12,890
through that code and you can run the model yourself in, in cursor or wherever, and in doing so,

31
00:02:12,890 --> 00:02:13,970
you can change it as well.

32
00:02:13,970 --> 00:02:15,650
You can mess around with the tokens.

33
00:02:15,650 --> 00:02:18,450
You can swap out some layers of the neural network if you wish.

34
00:02:18,490 --> 00:02:18,890
You can.

35
00:02:18,890 --> 00:02:22,610
You can do things like fine tuning, and none of that is possible with a llama.

36
00:02:22,810 --> 00:02:24,450
And so it's so completely different.

37
00:02:24,450 --> 00:02:26,890
And I hope that now does make sense to you.

38
00:02:26,890 --> 00:02:33,770
So the other thing that Hugging Face offers is a set of open source libraries for running Python code

39
00:02:33,770 --> 00:02:38,610
to run neural networks with, with transformers as part of it yourself.

40
00:02:38,610 --> 00:02:43,930
And that that that is the huge thing that they offer and something which is used everywhere.

41
00:02:44,250 --> 00:02:50,610
And it started out that one of the the early models that you could run was llama, the model from Mata.

42
00:02:50,730 --> 00:02:57,090
But but now almost any open source model you could imagine you can run using hugging face libraries.

43
00:02:57,090 --> 00:03:02,370
And in particular there are six different hugging face libraries that we will use together during the

44
00:03:02,370 --> 00:03:04,330
remainder of this course.

45
00:03:04,650 --> 00:03:10,490
And the first of them is a little bit confusing, so bear with me here.

46
00:03:10,650 --> 00:03:19,020
The first library that I will mention to you is a library called the Hugging Face hub, which you may

47
00:03:19,020 --> 00:03:21,660
remember I told you was the name of the other thing.

48
00:03:21,660 --> 00:03:24,780
That Hugging Face does the website and you were like, what?

49
00:03:25,540 --> 00:03:32,660
And the reason is because this is a Python library that lets you connect to the hugging face hub to

50
00:03:32,700 --> 00:03:38,780
download the models or the data sets that you can see on Hugging Face Hub and have them in your code

51
00:03:38,780 --> 00:03:39,500
immediately.

52
00:03:39,500 --> 00:03:41,460
So that's the kind of connection between them.

53
00:03:41,460 --> 00:03:44,220
So you can import something which is like hugging Face Hub.

54
00:03:44,260 --> 00:03:50,860
You can log in through code and you can say, I want this model in code talking to this, this, this

55
00:03:50,900 --> 00:03:56,540
hub library, and it's connecting to the hugging face platform so that that's the first library.

56
00:03:56,780 --> 00:03:57,780
Hope that makes sense.

57
00:03:57,900 --> 00:04:01,020
And then the second library is called data sets.

58
00:04:01,060 --> 00:04:06,940
And that particularly is a library that when you use the hub library to connect to the hub you can then

59
00:04:06,940 --> 00:04:08,180
download a data set.

60
00:04:08,220 --> 00:04:10,980
It becomes part of this data sets library.

61
00:04:10,980 --> 00:04:14,060
And each each object represents a data set.

62
00:04:14,060 --> 00:04:15,620
And you can do amazing things with it.

63
00:04:15,620 --> 00:04:17,100
And it's super efficient.

64
00:04:17,100 --> 00:04:23,260
And it allows you basically to manipulate vast amounts of data in an effective way.

65
00:04:23,900 --> 00:04:28,220
And the third library is the big one Transformers.

66
00:04:28,460 --> 00:04:34,060
This is the library that lets you say like like I want this particular model and I want the code for

67
00:04:34,060 --> 00:04:37,060
it, and I want to be able to actually run it.

68
00:04:37,060 --> 00:04:37,980
I want to train it.

69
00:04:37,980 --> 00:04:39,340
I want to do anything with it.

70
00:04:39,340 --> 00:04:47,060
You do it with the Transformers library that that is the iconic library at the heart of hugging face.

71
00:04:47,860 --> 00:04:50,020
Then, pfft, we're now on this.

72
00:04:50,020 --> 00:04:52,100
The second row is some of the more advanced library.

73
00:04:52,140 --> 00:04:54,820
PFA is something we'll be using a lot in week seven.

74
00:04:54,860 --> 00:05:02,780
It stands for parameter Efficient Fine Tuning, and it's a way to, uh, be able to train a model yourself,

75
00:05:02,780 --> 00:05:08,820
but in a way that doesn't require you tweaking 8 billion weights or however many parameters there are

76
00:05:08,820 --> 00:05:11,220
in this model, you can do it in a more efficient way.

77
00:05:11,220 --> 00:05:14,940
And the library is the library that lets that be possible.

78
00:05:15,180 --> 00:05:20,420
Also uses a technique that is known as Laura or Laura that maybe you have come across.

79
00:05:20,780 --> 00:05:30,590
And then t which, uh, may remind you of some some ancient MTV show, but in this context, it's not

80
00:05:30,590 --> 00:05:38,710
that it is the Transformers Reinforcement Learning library, which is again all about training Transformers

81
00:05:39,030 --> 00:05:46,870
and Accelerate is a particular library that allows you to distribute models across multiple GPUs.

82
00:05:47,070 --> 00:05:53,270
So this bottom row are the more advanced things that we may touch on distributed training and fine tuning

83
00:05:53,310 --> 00:05:55,390
and and other stuff.

84
00:05:55,790 --> 00:06:02,870
So this this set of libraries, this is at the heart of of so much work that happens with open source

85
00:06:03,030 --> 00:06:03,750
with models.

86
00:06:03,750 --> 00:06:07,150
And this is the the other part of hugging faces, the two things.

87
00:06:07,150 --> 00:06:12,430
It's the the platform, the hub as it's called with with repos of datasets, models, spaces.

88
00:06:12,590 --> 00:06:19,110
And then it is the software, the open source software, the libraries that you can use as Python code

89
00:06:19,590 --> 00:06:20,350
yourself.

90
00:06:20,350 --> 00:06:23,030
And we will we will use it a lot.

91
00:06:23,190 --> 00:06:27,630
And then somewhat confusingly, one of them is called hub and allows you to connect to the hub.

92
00:06:28,070 --> 00:06:28,750
All right.

93
00:06:28,950 --> 00:06:29,870
All is clear.

94
00:06:30,110 --> 00:06:34,590
Uh, let's, uh, let's let's now move on to the the other big topic.