1
00:00:00,000 --> 00:00:00,000
Hello guys.

2
00:00:00,000 --> 00:00:04,000
So we are going to continue the discussion with respect to Hugging Face and Lang Chin.

3
00:00:04,000 --> 00:00:08,000
Uh, as mentioned, hugging face and Lang Chin, they have combined together like they have working

4
00:00:08,000 --> 00:00:13,000
together and they have actually created a new partner package which is called as hugging face.

5
00:00:13,000 --> 00:00:14,000
Uh lang chin hugging face.

6
00:00:14,000 --> 00:00:15,000
Right.

7
00:00:15,000 --> 00:00:19,000
So in order to show you the entire practical implementation, first of all, what we will do is that

8
00:00:19,000 --> 00:00:26,000
we'll go ahead and install pip install, uh, lang chin underscore hugging face.

9
00:00:26,000 --> 00:00:26,000
Okay.

10
00:00:27,000 --> 00:00:32,000
And before I go ahead, you'll be able to see that I have created this ninth folder right with this

11
00:00:32,000 --> 00:00:34,000
experiment dot ipynb file.

12
00:00:34,000 --> 00:00:36,000
We will be using the same virtual environment to execute it.

13
00:00:36,000 --> 00:00:38,000
So I have selected Python 3.10.

14
00:00:38,000 --> 00:00:45,000
Along with that you'll also be able to see that in the requirement dot txt I have installed Langen underscore

15
00:00:45,000 --> 00:00:45,000
hugging face.

16
00:00:45,000 --> 00:00:50,000
Okay, so this is the library that is basically required if you have not installed it.

17
00:00:50,000 --> 00:00:52,000
So you can go ahead and mention it over here.

18
00:00:52,000 --> 00:00:53,000
And what I will do.

19
00:00:53,000 --> 00:00:55,000
First of all, I'll just go ahead and install this.

20
00:00:55,000 --> 00:00:57,000
So see as soon as it is installed.

21
00:00:57,000 --> 00:00:59,000
And already I've done the installation.

22
00:00:59,000 --> 00:01:01,000
So it is showing requirement already.

23
00:01:01,000 --> 00:01:02,000
Satisfied.

24
00:01:02,000 --> 00:01:02,000
Okay.

25
00:01:02,000 --> 00:01:06,000
Uh if you want to do the installation from requirement dot txt.

26
00:01:06,000 --> 00:01:08,000
So just make sure to update it over here.

27
00:01:08,000 --> 00:01:10,000
And I will just go and open my terminal.

28
00:01:10,000 --> 00:01:11,000
Right.

29
00:01:11,000 --> 00:01:12,000
I will write CD dot dot.

30
00:01:12,000 --> 00:01:18,000
Okay I'll go back to my file where the requirement dot txt is present and I'll just go ahead and write

31
00:01:18,000 --> 00:01:20,000
pip install minus our requirement dot txt.

32
00:01:20,000 --> 00:01:21,000
Okay.

33
00:01:21,000 --> 00:01:24,000
So once I do this all the installation will start taking place.

34
00:01:24,000 --> 00:01:27,000
So please make sure that you do this particular work from your side okay.

35
00:01:27,000 --> 00:01:32,000
But anyhow, I am also making sure to show you that how from the Jupyter notebook only you will be able

36
00:01:32,000 --> 00:01:32,000
to do it.

37
00:01:32,000 --> 00:01:39,000
Okay, one more thing, uh, that we are going to install is something called as Huggingface hub.

38
00:01:39,000 --> 00:01:39,000
Right.

39
00:01:39,000 --> 00:01:44,000
So I will also go ahead and do this and I'll write hugging face underscore hub okay.

40
00:01:44,000 --> 00:01:48,000
And we'll also check whether it is available in the requirement dot txt or not.

41
00:01:48,000 --> 00:01:50,000
So here you can see it is not available.

42
00:01:50,000 --> 00:01:53,000
So I will go ahead and install this also.

43
00:01:53,000 --> 00:01:56,000
So let me quickly go ahead and install this.

44
00:01:56,000 --> 00:01:59,000
And this will also be important with respect to the requirement.

45
00:01:59,000 --> 00:02:02,000
So here I will talk about why we will be using this.

46
00:02:02,000 --> 00:02:04,000
But let's go ahead and do the installation okay.

47
00:02:04,000 --> 00:02:08,000
So here also you can see the requirement is already satisfied.

48
00:02:08,000 --> 00:02:14,000
Uh and I've done the installation now why hugging Face Hub will be there because this will be very much

49
00:02:14,000 --> 00:02:17,000
handy when we have to do a API call.

50
00:02:17,000 --> 00:02:18,000
Okay.

51
00:02:18,000 --> 00:02:20,000
Like how do we do an API call?

52
00:02:20,000 --> 00:02:22,000
Similarly we can use hugging face.

53
00:02:22,000 --> 00:02:27,000
Uh, we can use this hugging face hub to do the API call for all the models that are available in the

54
00:02:27,000 --> 00:02:28,000
hugging face.

55
00:02:28,000 --> 00:02:33,000
Um, now, one thing that you really need to make sure that hugging face also has a paid, paid, uh,

56
00:02:33,000 --> 00:02:34,000
plan, right?

57
00:02:34,000 --> 00:02:39,000
So there you can also create your own, uh, endpoint address, and you can actually start with that.

58
00:02:39,000 --> 00:02:40,000
I'll show you that.

59
00:02:40,000 --> 00:02:43,000
But I'll show you just one example how you can actually do it.

60
00:02:43,000 --> 00:02:46,000
But, uh, again, I don't want you all to put your card.

61
00:02:46,000 --> 00:02:48,000
And unless and until you're working in a company for the same purpose.

62
00:02:48,000 --> 00:02:49,000
Okay.

63
00:02:49,000 --> 00:02:54,000
So here, uh, first of all, what we are going to do is that we are going to import OS.

64
00:02:54,000 --> 00:02:56,000
So I'll go ahead and write import OS.

65
00:02:56,000 --> 00:03:02,000
Along with that I will say from dot env I'll be importing my load underscore dot env okay.

66
00:03:02,000 --> 00:03:05,000
And then I will go ahead and initialize load underscore dot env.

67
00:03:05,000 --> 00:03:11,000
The reason is very simple because um, if you remember in my dot env file there will be something called

68
00:03:11,000 --> 00:03:12,000
as off token.

69
00:03:12,000 --> 00:03:19,000
So we will be using this specific token in order to do the API call Okay, so here I have made sure

70
00:03:19,000 --> 00:03:22,000
that I will call all my environment variables okay.

71
00:03:22,000 --> 00:03:29,000
Now the next thing is that the first way of probably calling your, uh, any models that is available

72
00:03:29,000 --> 00:03:34,000
in the hugging face and I think, uh, uh, all the models should be accessible.

73
00:03:34,000 --> 00:03:39,000
Uh, I've tried multiple models, and I could find that, okay, it was accessible, but there may be

74
00:03:39,000 --> 00:03:43,000
scenarios that some of the model may not be accessible also through the endpoint.

75
00:03:43,000 --> 00:03:43,000
Okay.

76
00:03:43,000 --> 00:03:47,000
So let's consider one other example which is called by hugging face endpoint.

77
00:03:47,000 --> 00:03:50,000
Now how to access hugging face models with the API.

78
00:03:50,000 --> 00:03:55,000
If you want to access any hugging face model with the API, then you specifically require this hugging

79
00:03:55,000 --> 00:03:56,000
face endpoint.

80
00:03:56,000 --> 00:04:00,000
It is just like how you created grok API key and you are communicating with the grok model.

81
00:04:00,000 --> 00:04:05,000
Similarly, if you just have an hugging face API, you will be able to communicate with all the models

82
00:04:05,000 --> 00:04:05,000
over there.

83
00:04:05,000 --> 00:04:07,000
So there are two ways to use this class.

84
00:04:07,000 --> 00:04:10,000
You can specify the model with the repo ID parameter.

85
00:04:10,000 --> 00:04:11,000
Then those endpoint.

86
00:04:11,000 --> 00:04:13,000
You use the serverless API.

87
00:04:13,000 --> 00:04:16,000
So they will they don't need to have any server.

88
00:04:16,000 --> 00:04:21,000
Also, they'll use a complete serverless API, which is particularly beneficial to people using Pro

89
00:04:21,000 --> 00:04:22,000
accounts or Enterprise Hub.

90
00:04:22,000 --> 00:04:28,000
Still, regular users can already have an access to fair amount of requests by connecting with the Azure

91
00:04:28,000 --> 00:04:31,000
token in the environment right where they are executing the code.

92
00:04:32,000 --> 00:04:37,000
Now see, usually the serverless API is given to people who are having Huggingface Pro account and enterprise

93
00:04:37,000 --> 00:04:38,000
hub, right?

94
00:04:38,000 --> 00:04:43,000
And for the people who just have a free account for them, also some fair amount of request is basically

95
00:04:43,000 --> 00:04:43,000
given.

96
00:04:43,000 --> 00:04:47,000
You cannot go ahead and hit uh, 1000 request at a time, right?

97
00:04:47,000 --> 00:04:51,000
For the people who are having pro and enterprise hub, they can actually go ahead and do that 1000 request

98
00:04:51,000 --> 00:04:51,000
they want.

99
00:04:51,000 --> 00:04:51,000
Okay.

100
00:04:51,000 --> 00:04:57,000
So here what we will do is that I will try to show you how this hugging face endpoint works.

101
00:04:57,000 --> 00:05:05,000
So for this I will go ahead and right from long chain underscore hugging face okay.

102
00:05:05,000 --> 00:05:09,000
Hugging face I'm going to import hugging face.

103
00:05:09,000 --> 00:05:11,000
See there are so many options.

104
00:05:11,000 --> 00:05:14,000
Hugging face endpoint hugging face embedding hugging face pipeline.

105
00:05:14,000 --> 00:05:16,000
Okay so I will talk about each and every thing okay.

106
00:05:16,000 --> 00:05:16,000
Okay.

107
00:05:16,000 --> 00:05:21,000
Um, and then I'll see you that which will be the best one if you are just doing it in a local machine.

108
00:05:21,000 --> 00:05:25,000
So from Langston underscore hugging face import hugging face endpoint.

109
00:05:25,000 --> 00:05:29,000
Um, so here what we will do is that we will go ahead and use one of the model.

110
00:05:29,000 --> 00:05:30,000
Okay.

111
00:05:30,000 --> 00:05:33,000
Let's see some of the models that we can actually go ahead and use it okay.

112
00:05:33,000 --> 00:05:42,000
So I'll go back to my hugging face okay models let's say I want to go ahead and you can directly search

113
00:05:42,000 --> 00:05:43,000
the model name also if you want.

114
00:05:43,000 --> 00:05:45,000
Let's say I want to go ahead and do Mr..

115
00:05:45,000 --> 00:05:46,000
All okay.

116
00:05:46,000 --> 00:05:47,000
Uh Mr..

117
00:05:47,000 --> 00:05:48,000
All seven b okay.

118
00:05:48,000 --> 00:05:49,000
Let's go ahead and do this.

119
00:05:49,000 --> 00:05:50,000
Okay.

120
00:05:50,000 --> 00:05:50,000
Mr..

121
00:05:50,000 --> 00:05:51,000
All seven B instruct.

122
00:05:51,000 --> 00:05:53,000
So I am going to use this specific model.

123
00:05:53,000 --> 00:05:54,000
Right.

124
00:05:54,000 --> 00:06:00,000
So now here all I have to do is that in I'll just create a variable which is called as repo underscore

125
00:06:00,000 --> 00:06:00,000
ID.

126
00:06:00,000 --> 00:06:03,000
And I'll initialize this particular model name okay.

127
00:06:03,000 --> 00:06:07,000
So this is the path of the model that we are specifically going to use.

128
00:06:07,000 --> 00:06:07,000
Okay.

129
00:06:07,000 --> 00:06:10,000
Now if I want to call this LM model.

130
00:06:10,000 --> 00:06:14,000
Now if you want to know more about this model you can go ahead and see this this Mr..

131
00:06:14,000 --> 00:06:18,000
Seven B instruct large language model is a instruct fine tuned version of Mr..

132
00:06:18,000 --> 00:06:19,000
Seven B okay.

133
00:06:19,000 --> 00:06:22,000
It has the following changes compared to this this this.

134
00:06:22,000 --> 00:06:23,000
It recommends this this.

135
00:06:23,000 --> 00:06:24,000
And what kind of task you will be able to do.

136
00:06:24,000 --> 00:06:25,000
Text generation.

137
00:06:25,000 --> 00:06:26,000
See.

138
00:06:26,000 --> 00:06:28,000
Uh hey my name is Clara.

139
00:06:28,000 --> 00:06:28,000
How are you?

140
00:06:28,000 --> 00:06:29,000
Hey, Clara.

141
00:06:29,000 --> 00:06:30,000
I'm just a program.

142
00:06:30,000 --> 00:06:33,000
Uh, tell me about yourself.

143
00:06:33,000 --> 00:06:36,000
Okay, so it is a text generation LM model.

144
00:06:36,000 --> 00:06:40,000
So if I go ahead and click on send, I should be able to get the answer right.

145
00:06:40,000 --> 00:06:43,000
See, as a computer programmer, I don't have any personal expense.

146
00:06:43,000 --> 00:06:48,000
So if I really want to just use this specific model, uh, through this hugging face, uh, end point,

147
00:06:48,000 --> 00:06:54,000
all I have to do is that get give this repo ID, and then we will go ahead and create our LM.

148
00:06:54,000 --> 00:06:56,000
And here I will call this Huggingface endpoint.

149
00:06:56,000 --> 00:06:57,000
I will initialize it.

150
00:06:57,000 --> 00:07:01,000
First of all I need to give my repo id as my parameter.

151
00:07:01,000 --> 00:07:04,000
So let me just go ahead and write repo ID is equal to repo id okay.

152
00:07:04,000 --> 00:07:11,000
The next thing that I will be saying that hey there will we will set some max length parameter for the

153
00:07:11,000 --> 00:07:11,000
tokens.

154
00:07:11,000 --> 00:07:14,000
Let's say I'm going to set it to 150 okay.

155
00:07:14,000 --> 00:07:17,000
Now once I set it to 150 next I will go ahead and set my temperature.

156
00:07:17,000 --> 00:07:19,000
Like, how do I set for other.

157
00:07:20,000 --> 00:07:23,000
Uh, other other LM models like this.

158
00:07:23,000 --> 00:07:24,000
And finally I will give my token.

159
00:07:24,000 --> 00:07:28,000
And now this token will be very important and will play a very important role.

160
00:07:28,000 --> 00:07:32,000
Now in the ENB, I have actually created a token which is called as TF underscore token.

161
00:07:32,000 --> 00:07:33,000
Right.

162
00:07:33,000 --> 00:07:34,000
And how do I create this token?

163
00:07:34,000 --> 00:07:38,000
I have to just go over here, go to the settings button okay.

164
00:07:38,000 --> 00:07:42,000
In the settings button I will be having this particular access tokens right.

165
00:07:42,000 --> 00:07:44,000
So I will go ahead and take this access token.

166
00:07:44,000 --> 00:07:48,000
You can go ahead and create a new token and you can actually use it right.

167
00:07:48,000 --> 00:07:51,000
So we will specifically be using this particular token.

168
00:07:51,000 --> 00:07:54,000
So here I will have pasted this same token over here.

169
00:07:54,000 --> 00:07:56,000
I will just go ahead and click on this okay.

170
00:07:56,000 --> 00:07:58,000
And go to my page.

171
00:07:58,000 --> 00:08:00,000
And here I have to call that particular token.

172
00:08:00,000 --> 00:08:06,000
So for that I will be using OS dot get env right and I'll paste it over here.

173
00:08:06,000 --> 00:08:08,000
So this basically becomes my LM model.

174
00:08:08,000 --> 00:08:11,000
See now I have downloaded it right.

175
00:08:11,000 --> 00:08:13,000
Not downloaded I'm accessing that particular API.

176
00:08:13,000 --> 00:08:14,000
Right.

177
00:08:14,000 --> 00:08:17,000
So here it says that token has not been saved to the grid credential path.

178
00:08:17,000 --> 00:08:22,000
So and so now it has been saved to my and it is showing login successful.

179
00:08:22,000 --> 00:08:26,000
So finally once the API is authenticated the API key is authenticated.

180
00:08:26,000 --> 00:08:28,000
Then only will be able to do the access.

181
00:08:28,000 --> 00:08:31,000
So finally here you can see hugging face endpoint repo ID Mr..

182
00:08:31,000 --> 00:08:33,000
All this this this is there.

183
00:08:33,000 --> 00:08:33,000
Okay.

184
00:08:34,000 --> 00:08:39,000
Now the next thing what we are basically going to do, just use this LM and how we usually invoke with

185
00:08:39,000 --> 00:08:43,000
the help of hugging face, we will go ahead and write lm dot invoke.

186
00:08:43,000 --> 00:08:47,000
And let's say that I ask a question what is machine learning okay.

187
00:08:48,000 --> 00:08:49,000
And I go ahead and execute it.

188
00:08:50,000 --> 00:08:55,000
So if I just go ahead and ask LM dot invoke what is machine learning now that is going to interact with

189
00:08:55,000 --> 00:08:58,000
the Mistral that is available in the hugging face, right.

190
00:08:58,000 --> 00:09:00,000
Um, by using this hugging face endpoint.

191
00:09:01,000 --> 00:09:01,000
Right.

192
00:09:01,000 --> 00:09:05,000
Similarly, I can go ahead and ask LM dot invoke.

193
00:09:07,000 --> 00:09:10,000
And here let me just go ahead and write what is generative AI.

194
00:09:10,000 --> 00:09:11,000
Okay.

195
00:09:11,000 --> 00:09:13,000
I'm just going to ask another question.

196
00:09:13,000 --> 00:09:16,000
What is generative AI?

197
00:09:17,000 --> 00:09:18,000
done?

198
00:09:18,000 --> 00:09:18,000
Now?

199
00:09:18,000 --> 00:09:23,000
If I go ahead and execute this again, I'll be able to see what is the response that I'm getting.

200
00:09:23,000 --> 00:09:25,000
Generative AI refers to the type of artificial intelligence.

201
00:09:25,000 --> 00:09:26,000
All these things are there.

202
00:09:26,000 --> 00:09:28,000
Let's try with other model.

203
00:09:28,000 --> 00:09:31,000
You may be thinking Krish, how many models will be accessible if you are lucky?

204
00:09:31,000 --> 00:09:35,000
I have been lucky all the time and I was able to see multiple models.

205
00:09:35,000 --> 00:09:36,000
Let's see some more models.

206
00:09:36,000 --> 00:09:39,000
Okay, so I'll go and select models.

207
00:09:39,000 --> 00:09:42,000
Let's go ahead with Google Gamma two okay.

208
00:09:42,000 --> 00:09:44,000
I don't know whether this is a complete new model.

209
00:09:44,000 --> 00:09:48,000
And it has recently come into uh it has been announced by Google.

210
00:09:48,000 --> 00:09:49,000
Okay.

211
00:09:49,000 --> 00:09:51,000
I'm recording today at seven seven 2024.

212
00:09:51,000 --> 00:09:56,000
So um, let's see whether we will be able to access this model or not.

213
00:09:56,000 --> 00:10:01,000
So here, instead of writing this repo ID, let me do let me copy this entirely.

214
00:10:01,000 --> 00:10:03,000
Paste it over here.

215
00:10:03,000 --> 00:10:03,000
Okay.

216
00:10:03,000 --> 00:10:06,000
Now I will just go ahead and call this specific model.

217
00:10:06,000 --> 00:10:09,000
And this model needs to be just put up over here itself.

218
00:10:09,000 --> 00:10:10,000
Okay.

219
00:10:10,000 --> 00:10:13,000
Now here let me just go ahead and execute it.

220
00:10:13,000 --> 00:10:16,000
So login successful Google gamma model is also accessible.

221
00:10:16,000 --> 00:10:17,000
That's amazing.

222
00:10:17,000 --> 00:10:26,000
Now let me just go ahead and search for LM dot invoke and let me write what is machine learning okay.

223
00:10:27,000 --> 00:10:29,000
And I will just go ahead and execute it.

224
00:10:29,000 --> 00:10:33,000
So here I'm getting an error saying that the model okay.

225
00:10:33,000 --> 00:10:35,000
It is too large to be loaded automatically.

226
00:10:35,000 --> 00:10:37,000
So it is not we are not able to access it.

227
00:10:37,000 --> 00:10:40,000
So for this we need to create a dedicated endpoint okay.

228
00:10:40,000 --> 00:10:44,000
And uh there are scenarios where you cannot use some of the models.

229
00:10:44,000 --> 00:10:44,000
Right.

230
00:10:44,000 --> 00:10:46,000
These are some of the disadvantages over here.

231
00:10:46,000 --> 00:10:48,000
And obviously the size is very huge.

232
00:10:48,000 --> 00:10:50,000
So you are not able to upload it okay.

233
00:10:50,000 --> 00:10:54,000
Uh the, the uh huggingface default spaces are only not able to upload it.

234
00:10:54,000 --> 00:10:55,000
Now, let me do one thing.

235
00:10:55,000 --> 00:10:58,000
Let me just use the same LM model over here.

236
00:10:58,000 --> 00:11:01,000
So this will basically be my LM model.

237
00:11:01,000 --> 00:11:05,000
And I will show you with the help of hugging face endpoint, can we create a rag application kind of

238
00:11:05,000 --> 00:11:11,000
thing where we can integrate with, um, where we can also integrate with prompt template.

239
00:11:11,000 --> 00:11:11,000
Right.

240
00:11:11,000 --> 00:11:13,000
So now this is my LM model.

241
00:11:13,000 --> 00:11:23,000
Now what I will do I will quickly go ahead and write from long chain import prompt template.

242
00:11:24,000 --> 00:11:26,000
Along with that I'll also import lm chain.

243
00:11:26,000 --> 00:11:26,000
Right.

244
00:11:26,000 --> 00:11:28,000
We have discussed already about this.

245
00:11:28,000 --> 00:11:31,000
Let's say uh I will just go ahead and create a template.

246
00:11:31,000 --> 00:11:37,000
I'll say, hey, um, let's make a simple question over here, something like this.

247
00:11:37,000 --> 00:11:37,000
Okay.

248
00:11:38,000 --> 00:11:41,000
I'll say, hey, this is my question.

249
00:11:42,000 --> 00:11:43,000
Okay.

250
00:11:44,000 --> 00:11:45,000
Question.

251
00:11:45,000 --> 00:11:47,000
And here I'm basically going to write my answer.

252
00:11:47,000 --> 00:11:53,000
My answer is like let's think step by step.

253
00:11:54,000 --> 00:11:55,000
I'm just adding this prompt okay.

254
00:11:56,000 --> 00:11:59,000
Just to make it a little bit curious okay.

255
00:12:00,000 --> 00:12:02,000
So this is basically becomes my prompt.

256
00:12:02,000 --> 00:12:04,000
Now I'll go ahead and create my prompt templates.

257
00:12:04,000 --> 00:12:07,000
So I will just go ahead and define this.

258
00:12:07,000 --> 00:12:09,000
And I will go ahead and write my template.

259
00:12:10,000 --> 00:12:14,000
And then finally I will also go ahead with input variables.

260
00:12:14,000 --> 00:12:16,000
So input variables is nothing.

261
00:12:16,000 --> 00:12:18,000
But it is your question okay.

262
00:12:19,000 --> 00:12:25,000
And then I can go ahead and just display this prompt prompt okay.

263
00:12:25,000 --> 00:12:26,000
So once I execute it.

264
00:12:26,000 --> 00:12:28,000
So here you can see input variable is question template.

265
00:12:28,000 --> 00:12:30,000
This this question is this answer.

266
00:12:30,000 --> 00:12:34,000
Let's think let's think step by step okay.

267
00:12:35,000 --> 00:12:35,000
Perfect.

268
00:12:35,000 --> 00:12:37,000
So this basically becomes my prompt okay.

269
00:12:37,000 --> 00:12:40,000
Now here uh I have to give question as an input.

270
00:12:40,000 --> 00:12:41,000
Right.

271
00:12:41,000 --> 00:12:44,000
So first of all what I will do I will go ahead and create my chain.

272
00:12:44,000 --> 00:12:46,000
So you know how to create a chain right.

273
00:12:46,000 --> 00:12:47,000
LM underscore chain.

274
00:12:47,000 --> 00:12:48,000
Let's see.

275
00:12:48,000 --> 00:12:51,000
And I will be initializing to my LM chain.

276
00:12:52,000 --> 00:12:54,000
And here I will write LM is equal to LM.

277
00:12:54,000 --> 00:12:56,000
And finally prompt is equal to.

278
00:12:57,000 --> 00:12:58,000
It's nothing but prompt okay.

279
00:12:58,000 --> 00:13:00,000
Whatever prompt template we have defined.

280
00:13:00,000 --> 00:13:03,000
Now if I just go ahead and write lm dot invoke.

281
00:13:03,000 --> 00:13:08,000
And inside this I'll give the I'll give my question okay.

282
00:13:08,000 --> 00:13:12,000
Now instead of giving this question I will write something like this.

283
00:13:12,000 --> 00:13:14,000
Uh question.

284
00:13:15,000 --> 00:13:15,000
Um.

285
00:13:15,000 --> 00:13:15,000
Mhm.

286
00:13:19,000 --> 00:13:19,000
Question.

287
00:13:19,000 --> 00:13:20,000
Colon.

288
00:13:23,000 --> 00:13:25,000
What is machine learning?

289
00:13:30,000 --> 00:13:30,000
Okay.

290
00:13:30,000 --> 00:13:31,000
I'll execute it.

291
00:13:31,000 --> 00:13:33,000
I'm getting an error.

292
00:13:33,000 --> 00:13:35,000
Class dictionary must be a prompt value or list of.

293
00:13:35,000 --> 00:13:39,000
Okay I should not be giving in the form of dictionary.

294
00:13:39,000 --> 00:13:42,000
Instead I can just directly go ahead and write this particular question.

295
00:13:42,000 --> 00:13:48,000
Okay, so the question will be, um, what is the uh.

296
00:13:48,000 --> 00:13:53,000
Or I'll just write who won the World Cup.

297
00:13:54,000 --> 00:13:56,000
Who won the Cricket World Cup?

298
00:13:57,000 --> 00:14:04,000
Cricket World Cup 20 2011 okay, I'm just seeing the previous information.

299
00:14:04,000 --> 00:14:10,000
So once I executed it, start thinking the question along with that what will be the text?

300
00:14:10,000 --> 00:14:16,000
So here you can see the 2011 was the 10th World Cup which was held in Indian subcontinent for February

301
00:14:16,000 --> 00:14:16,000
9th.

302
00:14:16,000 --> 00:14:21,000
To this India on 2nd April, the final was played in Wankhede Stadium.

303
00:14:21,000 --> 00:14:24,000
The tournament was won by India who defeated Sri Lanka by six wickets.

304
00:14:24,000 --> 00:14:29,000
All this information is nicely, completely given over here, Right.

305
00:14:29,000 --> 00:14:31,000
So this is good enough right now.

306
00:14:31,000 --> 00:14:35,000
You can go ahead and try whichever models that you want, but always make sure that that model is accessible.

307
00:14:35,000 --> 00:14:36,000
Right.

308
00:14:36,000 --> 00:14:37,000
At least it should be accessible.

309
00:14:38,000 --> 00:14:39,000
Uh, yeah.

310
00:14:39,000 --> 00:14:45,000
Uh, this was uh, mostly about the hugging face, uh, hugging face endpoint.

311
00:14:45,000 --> 00:14:46,000
Again, there are ways.

312
00:14:46,000 --> 00:14:47,000
There is.

313
00:14:47,000 --> 00:14:50,000
Let me just go through this particular way and show it to you.

314
00:14:50,000 --> 00:14:56,000
Uh, but what I feel is that by using hugging face endpoint, you will be able to do most of your task.

315
00:14:56,000 --> 00:14:57,000
Right?

316
00:14:57,000 --> 00:15:02,000
So if I go back to the documentation over here, you'll also be able to see I've already shown you how

317
00:15:02,000 --> 00:15:05,000
to properly load any, uh, embedding techniques.

318
00:15:05,000 --> 00:15:07,000
Also, you can also use this specific embedding.

319
00:15:07,000 --> 00:15:08,000
Right.

320
00:15:08,000 --> 00:15:12,000
So in order to use this you can also use this hugging face embedding if you want right from Langston

321
00:15:12,000 --> 00:15:15,000
underscore community dot embeddings and all.

322
00:15:15,000 --> 00:15:16,000
You can probably use it.

323
00:15:16,000 --> 00:15:17,000
right.

324
00:15:17,000 --> 00:15:19,000
And similarly huggingface embeddings also.

325
00:15:19,000 --> 00:15:24,000
So here you can see VGG models are hugging face are the best open source model BG model is created by

326
00:15:24,000 --> 00:15:25,000
Beijing Academy of this.

327
00:15:25,000 --> 00:15:30,000
It's a private non uh non-private organization engaged in AI research and development.

328
00:15:30,000 --> 00:15:33,000
You can also go ahead and see some examples with respect to this and executed.

329
00:15:33,000 --> 00:15:35,000
Let's see some examples over here.

330
00:15:35,000 --> 00:15:40,000
So I will just go ahead and click this over here.

331
00:15:40,000 --> 00:15:40,000
See.

332
00:15:40,000 --> 00:15:42,000
So easy it is.

333
00:15:42,000 --> 00:15:43,000
That's it.

334
00:15:43,000 --> 00:15:48,000
How you basically call this hugging face embeddings right from Lang chain underscore community.

335
00:15:48,000 --> 00:15:49,000
You just give the model name.

336
00:15:49,000 --> 00:15:53,000
Let's execute this Lang chain documentation is really powerful.

337
00:15:53,000 --> 00:15:57,000
You should definitely know how to probably read all these things.

338
00:15:57,000 --> 00:16:00,000
So here I will go ahead and copy and paste it.

339
00:16:00,000 --> 00:16:03,000
And let me just go ahead and execute this also.

340
00:16:03,000 --> 00:16:06,000
So it will basically creates a 384 embedding.

341
00:16:06,000 --> 00:16:06,000
Right.

342
00:16:06,000 --> 00:16:11,000
So if I just go and search for this one this is getting executed.

343
00:16:11,000 --> 00:16:11,000
Let's see.

344
00:16:13,000 --> 00:16:13,000
Okay.

345
00:16:14,000 --> 00:16:18,000
Uh, this has got executed okay.

346
00:16:18,000 --> 00:16:21,000
Now if I go ahead and execute this.

347
00:16:21,000 --> 00:16:24,000
So this is my embedding for this particular text.

348
00:16:24,000 --> 00:16:25,000
Right.

349
00:16:25,000 --> 00:16:29,000
So this is also an open source embedding which you can actually use it right in your projects.

350
00:16:29,000 --> 00:16:31,000
We have used some other embedding over there.

351
00:16:31,000 --> 00:16:31,000
Right.

352
00:16:31,000 --> 00:16:36,000
If you probably go ahead and see right what all embedding techniques we had actually used.

353
00:16:36,000 --> 00:16:39,000
So over here okay.

354
00:16:39,000 --> 00:16:43,000
Long chain embeddings and hugging face embedding.

355
00:16:43,000 --> 00:16:43,000
Right.

356
00:16:43,000 --> 00:16:46,000
We use something called as all mini lm s l6 v2.

357
00:16:47,000 --> 00:16:47,000
Right.

358
00:16:47,000 --> 00:16:50,000
So hugging face sentence transformer is the python for state of art.

359
00:16:50,000 --> 00:16:51,000
We have seen this.

360
00:16:51,000 --> 00:16:55,000
And here also I have actually shown you right with respect to the embedding.

361
00:16:55,000 --> 00:17:02,000
Now, uh, in hugging face, uh, there is also very important one library which I will also talk about

362
00:17:02,000 --> 00:17:04,000
it, which is called as chatting hugging face.

363
00:17:04,000 --> 00:17:11,000
Now here you will be able to see that see in hugging face you can create your own endpoint URL, right.

364
00:17:11,000 --> 00:17:17,000
So in order to create an endpoint URL, what you have to do is that just go ahead and search for creating

365
00:17:17,000 --> 00:17:22,000
an endpoint in hugging face, okay.

366
00:17:24,000 --> 00:17:27,000
Once you do this, you just go ahead and click on this inference endpoint.

367
00:17:28,000 --> 00:17:32,000
Now here uh with respect to this inference endpoint right.

368
00:17:32,000 --> 00:17:35,000
Let's say it says that deploy a first model.

369
00:17:35,000 --> 00:17:41,000
If you click over here okay you'll be able to see that you can create your endpoint address, but at

370
00:17:41,000 --> 00:17:44,000
the end of the day you need to put your credit card and all.

371
00:17:44,000 --> 00:17:45,000
So that is the reason why I'm not showing.

372
00:17:45,000 --> 00:17:50,000
You see right now if I just go ahead and click on endpoint, is this our serverless endpoint which I

373
00:17:50,000 --> 00:17:55,000
was able to access it I was able to access version 0.2, version 0.3, version 0.3.

374
00:17:55,000 --> 00:17:55,000
Right.

375
00:17:55,000 --> 00:17:56,000
So many number of requests I did.

376
00:17:57,000 --> 00:18:02,000
But if you want a dedicated endpoint wherein you will be able to access everything.

377
00:18:02,000 --> 00:18:05,000
So for that some charges will definitely be there.

378
00:18:05,000 --> 00:18:05,000
Right?

379
00:18:05,000 --> 00:18:08,000
So for that you need to probably go ahead and add your credit card.

380
00:18:08,000 --> 00:18:09,000
Right.

381
00:18:09,000 --> 00:18:13,000
You have to probably use this for paid services okay.

382
00:18:13,000 --> 00:18:16,000
But if you are interested just go ahead and use this.

383
00:18:16,000 --> 00:18:21,000
But I would again suggest unless and until you're working in a company, uh, don't put your money over

384
00:18:21,000 --> 00:18:26,000
here because other than that, hugging face endpoint actually helps you to probably work with almost

385
00:18:26,000 --> 00:18:28,000
most of the LM models that are available.

386
00:18:28,000 --> 00:18:31,000
Other than that, you can also have grok API that you can use it.

387
00:18:31,000 --> 00:18:35,000
So I hope, uh, you are able to understand this.

388
00:18:35,000 --> 00:18:42,000
Uh, and now you can just understand how easy it really becomes to work with this right now.

389
00:18:42,000 --> 00:18:47,000
In my next video, I will take up any one example, and I will try to implement an end to end project

390
00:18:47,000 --> 00:18:48,000
with the hugging face endpoint itself.

391
00:18:48,000 --> 00:18:49,000
Right?

392
00:18:49,000 --> 00:18:51,000
So yes, uh, this was it from my side.

393
00:18:51,000 --> 00:18:52,000
I hope you liked this particular video.

394
00:18:52,000 --> 00:18:53,000
I will see you all in the next video.

395
00:18:53,000 --> 00:18:54,000
Thank you.

