ramortegui
commited on
Deploy app
Browse files- QuestionAnswerHitchhikers.ipynb +0 -1814
- app.py +97 -3
- requirements.txt +2 -1
QuestionAnswerHitchhikers.ipynb
DELETED
@@ -1,1814 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"cells": [
|
3 |
-
{
|
4 |
-
"cell_type": "markdown",
|
5 |
-
"metadata": {
|
6 |
-
"id": "kEKghJQ2pmYH"
|
7 |
-
},
|
8 |
-
"source": [
|
9 |
-
"### The Basics of LangChain\n",
|
10 |
-
"\n",
|
11 |
-
"In this notebook we'll explore exactly what LangChain is doing - and implement a straightforward example that lets us ask questions of a document!\n",
|
12 |
-
"\n",
|
13 |
-
"First things first, let's get our dependencies all set!"
|
14 |
-
]
|
15 |
-
},
|
16 |
-
{
|
17 |
-
"cell_type": "code",
|
18 |
-
"execution_count": 1,
|
19 |
-
"metadata": {
|
20 |
-
"colab": {
|
21 |
-
"base_uri": "https://localhost:8080/"
|
22 |
-
},
|
23 |
-
"id": "fXsYHTgvnCM2",
|
24 |
-
"outputId": "afc63224-9a9a-4adb-dc3a-1248b8de55a7"
|
25 |
-
},
|
26 |
-
"outputs": [
|
27 |
-
{
|
28 |
-
"output_type": "stream",
|
29 |
-
"name": "stdout",
|
30 |
-
"text": [
|
31 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m72.0/72.0 kB\u001b[0m \u001b[31m1.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
32 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m892.2/892.2 kB\u001b[0m \u001b[31m15.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
33 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m32.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
34 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m90.0/90.0 kB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
35 |
-
"\u001b[2K \u001b[90mβββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m114.5/114.5 kB\u001b[0m \u001b[31m958.0 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
36 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m268.8/268.8 kB\u001b[0m \u001b[31m11.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
37 |
-
"\u001b[2K \u001b[90mβββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m149.6/149.6 kB\u001b[0m \u001b[31m9.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
38 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m49.1/49.1 kB\u001b[0m \u001b[31m2.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
39 |
-
"\u001b[?25h"
|
40 |
-
]
|
41 |
-
}
|
42 |
-
],
|
43 |
-
"source": [
|
44 |
-
"!pip install openai langchain -q"
|
45 |
-
]
|
46 |
-
},
|
47 |
-
{
|
48 |
-
"cell_type": "markdown",
|
49 |
-
"metadata": {
|
50 |
-
"id": "T0sLjfy8p3jf"
|
51 |
-
},
|
52 |
-
"source": [
|
53 |
-
"You'll need to have an OpenAI API key for this next part - see [this](https://www.onmsft.com/how-to/how-to-get-an-openai-api-key/) if you haven't already set one up!"
|
54 |
-
]
|
55 |
-
},
|
56 |
-
{
|
57 |
-
"cell_type": "code",
|
58 |
-
"execution_count": 2,
|
59 |
-
"metadata": {
|
60 |
-
"id": "0TTosnCHnGHG"
|
61 |
-
},
|
62 |
-
"outputs": [],
|
63 |
-
"source": [
|
64 |
-
"import os \n",
|
65 |
-
"import openai\n",
|
66 |
-
"\n",
|
67 |
-
"\n",
|
68 |
-
"openai.api_key = os.environ['OPENAI_API_KEY']"
|
69 |
-
]
|
70 |
-
},
|
71 |
-
{
|
72 |
-
"cell_type": "markdown",
|
73 |
-
"metadata": {
|
74 |
-
"id": "15M3Jx6SBXcO"
|
75 |
-
},
|
76 |
-
"source": [
|
77 |
-
"#### Helper Functions (run this cell)"
|
78 |
-
]
|
79 |
-
},
|
80 |
-
{
|
81 |
-
"cell_type": "code",
|
82 |
-
"execution_count": 3,
|
83 |
-
"metadata": {
|
84 |
-
"id": "k3SBzWBUpQ21"
|
85 |
-
},
|
86 |
-
"outputs": [],
|
87 |
-
"source": [
|
88 |
-
"from IPython.display import display, Markdown\n",
|
89 |
-
"\n",
|
90 |
-
"def disp_markdown(text: str) -> None:\n",
|
91 |
-
" display(Markdown(text))"
|
92 |
-
]
|
93 |
-
},
|
94 |
-
{
|
95 |
-
"cell_type": "markdown",
|
96 |
-
"metadata": {
|
97 |
-
"id": "fU4LWrv-BayH"
|
98 |
-
},
|
99 |
-
"source": [
|
100 |
-
"### Our First LangChain ChatModel"
|
101 |
-
]
|
102 |
-
},
|
103 |
-
{
|
104 |
-
"cell_type": "markdown",
|
105 |
-
"metadata": {
|
106 |
-
"id": "p-M-VQhQOC1c"
|
107 |
-
},
|
108 |
-
"source": [
|
109 |
-
"\n",
|
110 |
-
"\n",
|
111 |
-
"---\n",
|
112 |
-
"\n",
|
113 |
-
"\n",
|
114 |
-
"<div class=\"warn\">Note: Information on OpenAI's <a href=https://openai.com/pricing>pricing</a> and <a href=https://openai.com/policies/usage-policies>usage policies.</a></div>\n",
|
115 |
-
"\n",
|
116 |
-
"\n",
|
117 |
-
"\n",
|
118 |
-
"---\n",
|
119 |
-
"\n"
|
120 |
-
]
|
121 |
-
},
|
122 |
-
{
|
123 |
-
"cell_type": "markdown",
|
124 |
-
"metadata": {
|
125 |
-
"id": "XVkfqk4NOFWS"
|
126 |
-
},
|
127 |
-
"source": [
|
128 |
-
"Now that we're set-up with OpenAI's API - we can begin making our first ChatModel!\n",
|
129 |
-
"\n",
|
130 |
-
"There's a few important things to consider when we're using LangChain's ChatModel that are outlined [here](https://python.langchain.com/en/latest/modules/models/chat.html)\n",
|
131 |
-
"\n",
|
132 |
-
"Let's begin by initializing the model with OpenAI's `gpt-3.5-turbo` (ChatGPT) model.\n",
|
133 |
-
"\n",
|
134 |
-
"We're not going to be leveraging the [streaming](https://python.langchain.com/en/latest/modules/models/chat/examples/streaming.html) capabilities in this Notebook - just the basics to get us started!"
|
135 |
-
]
|
136 |
-
},
|
137 |
-
{
|
138 |
-
"cell_type": "code",
|
139 |
-
"execution_count": 4,
|
140 |
-
"metadata": {
|
141 |
-
"id": "tNscLft_nxBb"
|
142 |
-
},
|
143 |
-
"outputs": [],
|
144 |
-
"source": [
|
145 |
-
"from langchain.chat_models import ChatOpenAI\n",
|
146 |
-
"from langchain.schema import HumanMessage\n",
|
147 |
-
"\n",
|
148 |
-
"chat_model = ChatOpenAI(model_name=\"gpt-3.5-turbo\")"
|
149 |
-
]
|
150 |
-
},
|
151 |
-
{
|
152 |
-
"cell_type": "markdown",
|
153 |
-
"metadata": {
|
154 |
-
"id": "vzGhlpwUPyU9"
|
155 |
-
},
|
156 |
-
"source": [
|
157 |
-
"If we look at the [Chat completions](https://platform.openai.com/docs/guides/chat) documentation for OpenAI's chat models - we'll see that there are a few specific fields we'll need to concern ourselves with:\n",
|
158 |
-
"\n",
|
159 |
-
"`role`\n",
|
160 |
-
"- This refers to one of three \"roles\" that interact with the model in specific ways.\n",
|
161 |
-
"- The `system` role is an optional role that can be used to guide the model toward a specific task. Examples of `system` messages might be: \n",
|
162 |
-
" - You are an expert in Python, please answer questions as though we were in a peer coding session.\n",
|
163 |
-
" - You are the world's leading expert in stamps.\n",
|
164 |
-
"\n",
|
165 |
-
" These messages help us \"prime\" the model to be more aligned with our desired task!\n",
|
166 |
-
"\n",
|
167 |
-
"- The `user` role represents, well, the user!\n",
|
168 |
-
"- The `assistant` role lets us act in the place of the model's outputs. We can (and will) leverage this for some few-shot prompt engineering!\n",
|
169 |
-
"\n",
|
170 |
-
"Each of these roles has a class in LangChain to make it nice and easy for us to use! \n",
|
171 |
-
"\n",
|
172 |
-
"Let's look at an example."
|
173 |
-
]
|
174 |
-
},
|
175 |
-
{
|
176 |
-
"cell_type": "code",
|
177 |
-
"execution_count": 5,
|
178 |
-
"metadata": {
|
179 |
-
"id": "dM7lciZtoPEp"
|
180 |
-
},
|
181 |
-
"outputs": [],
|
182 |
-
"source": [
|
183 |
-
"from langchain.schema import (\n",
|
184 |
-
" AIMessage, \n",
|
185 |
-
" HumanMessage,\n",
|
186 |
-
" SystemMessage\n",
|
187 |
-
")\n",
|
188 |
-
"\n",
|
189 |
-
"# The SystemMessage is associated with the system role\n",
|
190 |
-
"system_message = SystemMessage(content=\"You are a food critic.\")\n",
|
191 |
-
"\n",
|
192 |
-
"# The HumanMessage is associated with the user role\n",
|
193 |
-
"user_message = HumanMessage(content=\"Do you think Kraft Dinner constitues fine dining?\")\n",
|
194 |
-
"\n",
|
195 |
-
"# The AIMessage is associated with the assistant role\n",
|
196 |
-
"assistant_message = AIMessage(content=\"Egads! No, it most certainly does not!\")"
|
197 |
-
]
|
198 |
-
},
|
199 |
-
{
|
200 |
-
"cell_type": "markdown",
|
201 |
-
"metadata": {
|
202 |
-
"id": "dSx5HBgjSUvB"
|
203 |
-
},
|
204 |
-
"source": [
|
205 |
-
"Now that we have those messages set-up, let's send them to `gpt-3.5-turbo` with a new user message and see how it does!\n",
|
206 |
-
"\n",
|
207 |
-
"It's easy enough to do this - the ChatOpenAI model accepts a list of inputs!"
|
208 |
-
]
|
209 |
-
},
|
210 |
-
{
|
211 |
-
"cell_type": "code",
|
212 |
-
"execution_count": 6,
|
213 |
-
"metadata": {
|
214 |
-
"colab": {
|
215 |
-
"base_uri": "https://localhost:8080/"
|
216 |
-
},
|
217 |
-
"id": "LwDLOYOKSTpG",
|
218 |
-
"outputId": "42393ba8-2670-4002-ea6f-608d40e8bb4e"
|
219 |
-
},
|
220 |
-
"outputs": [
|
221 |
-
{
|
222 |
-
"output_type": "execute_result",
|
223 |
-
"data": {
|
224 |
-
"text/plain": [
|
225 |
-
"AIMessage(content=\"While Red Lobster is a popular seafood chain restaurant, it is not generally considered fine dining. Fine dining typically involves higher quality ingredients, more complex and refined cooking techniques, and a higher level of service and ambiance. However, this doesn't mean that Red Lobster isn't delicious or enjoyable in its own right!\", additional_kwargs={}, example=False)"
|
226 |
-
]
|
227 |
-
},
|
228 |
-
"metadata": {},
|
229 |
-
"execution_count": 6
|
230 |
-
}
|
231 |
-
],
|
232 |
-
"source": [
|
233 |
-
"second_user_message = HumanMessage(content=\"What about Red Lobster, surely that is fine dining!\")\n",
|
234 |
-
"\n",
|
235 |
-
"# create the list of prompts\n",
|
236 |
-
"list_of_prompts = [\n",
|
237 |
-
" system_message,\n",
|
238 |
-
" user_message,\n",
|
239 |
-
" assistant_message,\n",
|
240 |
-
" second_user_message\n",
|
241 |
-
"]\n",
|
242 |
-
"\n",
|
243 |
-
"# we can just call our chat_model on the list of prompts!\n",
|
244 |
-
"chat_model(list_of_prompts)"
|
245 |
-
]
|
246 |
-
},
|
247 |
-
{
|
248 |
-
"cell_type": "markdown",
|
249 |
-
"metadata": {
|
250 |
-
"id": "pZMYJDWXTkMq"
|
251 |
-
},
|
252 |
-
"source": [
|
253 |
-
"Great! That's inline with what we expected to see!"
|
254 |
-
]
|
255 |
-
},
|
256 |
-
{
|
257 |
-
"cell_type": "markdown",
|
258 |
-
"metadata": {
|
259 |
-
"id": "8DUNhabQUB8f"
|
260 |
-
},
|
261 |
-
"source": [
|
262 |
-
"### PromptTemplates\n",
|
263 |
-
"\n",
|
264 |
-
"Next stop, we'll discuss a few templates. This allows us to easily interact with our model by not having to redo work we've already completed!"
|
265 |
-
]
|
266 |
-
},
|
267 |
-
{
|
268 |
-
"cell_type": "code",
|
269 |
-
"execution_count": 7,
|
270 |
-
"metadata": {
|
271 |
-
"id": "74vpojywT0-4"
|
272 |
-
},
|
273 |
-
"outputs": [],
|
274 |
-
"source": [
|
275 |
-
"from langchain.prompts.chat import (\n",
|
276 |
-
" ChatPromptTemplate,\n",
|
277 |
-
" SystemMessagePromptTemplate,\n",
|
278 |
-
" HumanMessagePromptTemplate\n",
|
279 |
-
")\n",
|
280 |
-
"\n",
|
281 |
-
"# we can signify variables we want access to by wrapping them in {}\n",
|
282 |
-
"system_prompt_template = \"You are an expert in {SUBJECT}, and you're currently feeling {MOOD}\"\n",
|
283 |
-
"system_prompt_template = SystemMessagePromptTemplate.from_template(system_prompt_template)\n",
|
284 |
-
"\n",
|
285 |
-
"user_prompt_template = \"{CONTENT}\"\n",
|
286 |
-
"user_prompt_template = HumanMessagePromptTemplate.from_template(user_prompt_template)\n",
|
287 |
-
"\n",
|
288 |
-
"# put them together into a ChatPromptTemplate\n",
|
289 |
-
"chat_prompt = ChatPromptTemplate.from_messages([system_prompt_template, user_prompt_template])"
|
290 |
-
]
|
291 |
-
},
|
292 |
-
{
|
293 |
-
"cell_type": "markdown",
|
294 |
-
"metadata": {
|
295 |
-
"id": "a-nbEW-kV_na"
|
296 |
-
},
|
297 |
-
"source": [
|
298 |
-
"Now that we have our `chat_prompt` set-up with the templates - let's see how we can easily format them with our content!\n",
|
299 |
-
"\n",
|
300 |
-
"NOTE: `disp_markdown` is just a helper function to display the formatted markdown response."
|
301 |
-
]
|
302 |
-
},
|
303 |
-
{
|
304 |
-
"cell_type": "code",
|
305 |
-
"execution_count": 8,
|
306 |
-
"metadata": {
|
307 |
-
"colab": {
|
308 |
-
"base_uri": "https://localhost:8080/",
|
309 |
-
"height": 337
|
310 |
-
},
|
311 |
-
"id": "P4vd-W2FV7Xq",
|
312 |
-
"outputId": "d3ac1698-1617-4fff-ec55-39dc606b920c"
|
313 |
-
},
|
314 |
-
"outputs": [
|
315 |
-
{
|
316 |
-
"output_type": "display_data",
|
317 |
-
"data": {
|
318 |
-
"text/plain": [
|
319 |
-
"<IPython.core.display.Markdown object>"
|
320 |
-
],
|
321 |
-
"text/markdown": "Hello! There are many types of fine cheeses, and it really depends on personal preference. However, some of the most popular and highly regarded cheeses include:\n\n1. Parmigiano-Reggiano: A hard, aged Italian cheese with a nutty, sharp flavor.\n\n2. Brie: A soft, buttery cheese from France with a mild, creamy flavor.\n\n3. Gouda: A semi-hard cheese from the Netherlands with a smooth, caramel-like flavor.\n\n4. Roquefort: A creamy blue cheese from France with a tangy, salty flavor.\n\n5. Cheddar: A firm, sharp cheese from England with a rich, nutty flavor.\n\n6. ComtΓ©: A hard, nutty cheese from France with a sweet and fruity flavor.\n\n7. Manchego: A firm, sharp cheese from Spain with a nutty, tangy flavor.\n\n8. Gorgonzola: A creamy blue cheese from Italy with a sharp, tangy flavor.\n\n9. Camembert: A soft, creamy cheese from France with a mild, slightly sweet flavor.\n\n10. Feta: A crumbly cheese from Greece with a salty, tangy flavor.\n\nI hope this helps! Let me know if you have any other questions."
|
322 |
-
},
|
323 |
-
"metadata": {}
|
324 |
-
}
|
325 |
-
],
|
326 |
-
"source": [
|
327 |
-
"# note the method `to_messages()`, that's what converts our formatted prompt into \n",
|
328 |
-
"formatted_chat_prompt = chat_prompt.format_prompt(SUBJECT=\"cheeses\", MOOD=\"quite tired\", CONTENT=\"Hi, what are the finest cheeses?\").to_messages()\n",
|
329 |
-
"\n",
|
330 |
-
"disp_markdown(chat_model(formatted_chat_prompt).content)"
|
331 |
-
]
|
332 |
-
},
|
333 |
-
{
|
334 |
-
"cell_type": "markdown",
|
335 |
-
"metadata": {
|
336 |
-
"id": "hHehNFjAXbU_"
|
337 |
-
},
|
338 |
-
"source": [
|
339 |
-
"### Putting the Chain in LangChain\n",
|
340 |
-
"\n",
|
341 |
-
"In essense, a chain is exactly as it sounds - it helps us chain actions together.\n",
|
342 |
-
"\n",
|
343 |
-
"Let's take a look at an example."
|
344 |
-
]
|
345 |
-
},
|
346 |
-
{
|
347 |
-
"cell_type": "code",
|
348 |
-
"execution_count": 9,
|
349 |
-
"metadata": {
|
350 |
-
"colab": {
|
351 |
-
"base_uri": "https://localhost:8080/",
|
352 |
-
"height": 151
|
353 |
-
},
|
354 |
-
"id": "lTzw4ZMoWX0X",
|
355 |
-
"outputId": "3cd50d75-e822-4bcf-c90d-ef5736b0f86d"
|
356 |
-
},
|
357 |
-
"outputs": [
|
358 |
-
{
|
359 |
-
"output_type": "display_data",
|
360 |
-
"data": {
|
361 |
-
"text/plain": [
|
362 |
-
"<IPython.core.display.Markdown object>"
|
363 |
-
],
|
364 |
-
"text/markdown": "As an AI language model, I do not have emotions, so I cannot feel angry about anything. However, I can provide you with an objective answer to your question. \n\nThe 1967 Chevrolet Impala is widely considered as one of the most iconic and desirable classic cars of all time. It was a highly successful model for Chevrolet, with over a million units sold in that year alone. The 67 Impala is known for its sleek and stylish design, powerful V8 engines, and comfortable interiors.\n\nIn terms of reliability, the 67 Impala is generally considered to be a solid and dependable vehicle, with many still in use today. However, as with any classic car, maintenance and repairs can be costly and time-consuming.\n\nOverall, if you're looking for a classic car that is both stylish and reliable, the 1967 Chevrolet Impala is definitely a good choice."
|
365 |
-
},
|
366 |
-
"metadata": {}
|
367 |
-
}
|
368 |
-
],
|
369 |
-
"source": [
|
370 |
-
"from langchain.chains import LLMChain\n",
|
371 |
-
"\n",
|
372 |
-
"chain = LLMChain(llm=chat_model, prompt=chat_prompt)\n",
|
373 |
-
"\n",
|
374 |
-
"disp_markdown(chain.run(SUBJECT=\"classic cars\", MOOD=\"angry\", CONTENT=\"Is the 67 Chevrolet Impala a good vehicle?\"))"
|
375 |
-
]
|
376 |
-
},
|
377 |
-
{
|
378 |
-
"cell_type": "markdown",
|
379 |
-
"metadata": {
|
380 |
-
"id": "Md5XYaAj_t51"
|
381 |
-
},
|
382 |
-
"source": [
|
383 |
-
"### Incorporate A Local Document\n",
|
384 |
-
"\n",
|
385 |
-
"Now that we've got our first chain running, let's talk about how we can leverage our own document!\n",
|
386 |
-
"\n",
|
387 |
-
"First off, we'll need a document!\n",
|
388 |
-
"\n",
|
389 |
-
"For this example, we'll be using Douglas Adam's Hitchker's Guide to the Galaxy - though you can substitute this for any particular document, as long as it's in a text file."
|
390 |
-
]
|
391 |
-
},
|
392 |
-
{
|
393 |
-
"cell_type": "code",
|
394 |
-
"execution_count": 10,
|
395 |
-
"metadata": {
|
396 |
-
"colab": {
|
397 |
-
"base_uri": "https://localhost:8080/"
|
398 |
-
},
|
399 |
-
"id": "l4SJNvP_KXk9",
|
400 |
-
"outputId": "fe34c58e-c643-467f-ddef-83dd54f52966"
|
401 |
-
},
|
402 |
-
"outputs": [
|
403 |
-
{
|
404 |
-
"output_type": "stream",
|
405 |
-
"name": "stdout",
|
406 |
-
"text": [
|
407 |
-
"--2023-05-24 04:10:52-- https://erki.lap.ee/failid/raamatud/guide1.txt\n",
|
408 |
-
"Resolving erki.lap.ee (erki.lap.ee)... 185.158.177.102\n",
|
409 |
-
"Connecting to erki.lap.ee (erki.lap.ee)|185.158.177.102|:443... connected.\n",
|
410 |
-
"HTTP request sent, awaiting response... 200 OK\n",
|
411 |
-
"Length: 291862 (285K) [text/plain]\n",
|
412 |
-
"Saving to: βguide1.txtβ\n",
|
413 |
-
"\n",
|
414 |
-
"guide1.txt 100%[===================>] 285.02K 581KB/s in 0.5s \n",
|
415 |
-
"\n",
|
416 |
-
"2023-05-24 04:10:54 (581 KB/s) - βguide1.txtβ saved [291862/291862]\n",
|
417 |
-
"\n"
|
418 |
-
]
|
419 |
-
}
|
420 |
-
],
|
421 |
-
"source": [
|
422 |
-
"!wget https://erki.lap.ee/failid/raamatud/guide1.txt"
|
423 |
-
]
|
424 |
-
},
|
425 |
-
{
|
426 |
-
"cell_type": "code",
|
427 |
-
"execution_count": 28,
|
428 |
-
"metadata": {
|
429 |
-
"id": "HX00sL92LATv",
|
430 |
-
"colab": {
|
431 |
-
"base_uri": "https://localhost:8080/"
|
432 |
-
},
|
433 |
-
"outputId": "fed1c197-8f52-46b8-90c1-174f484154fe"
|
434 |
-
},
|
435 |
-
"outputs": [
|
436 |
-
{
|
437 |
-
"output_type": "stream",
|
438 |
-
"name": "stdout",
|
439 |
-
"text": [
|
440 |
-
"284403\n"
|
441 |
-
]
|
442 |
-
}
|
443 |
-
],
|
444 |
-
"source": [
|
445 |
-
"with open(\"guide1.txt\") as f:\n",
|
446 |
-
" hitchhikersguide = f.read()\n",
|
447 |
-
"\n",
|
448 |
-
"print(len(hitchhikersguide))"
|
449 |
-
]
|
450 |
-
},
|
451 |
-
{
|
452 |
-
"cell_type": "markdown",
|
453 |
-
"metadata": {
|
454 |
-
"id": "5PdfLcOlKcjH"
|
455 |
-
},
|
456 |
-
"source": [
|
457 |
-
"Next we'll want to split our text into appropirately sized chunks. \n",
|
458 |
-
"\n",
|
459 |
-
"We're going to be using the [CharacterTextSplitter](https://python.langchain.com/en/latest/modules/indexes/text_splitters/examples/character_text_splitter.html) from LangChain today.\n",
|
460 |
-
"\n",
|
461 |
-
"The size of these chunks will depend heavily on a number of factors relating to which LLM you're using, what the max context size is, and more. \n",
|
462 |
-
"\n",
|
463 |
-
"You can also choose to have the chunks overlap to avoid potentially missing any important information between chunks. As we're dealing with a novel - there's not a critical need to include overlap.\n",
|
464 |
-
"\n",
|
465 |
-
"We can also pass in the separator - this is what we'll try and separate the documents on. Be careful to understand your documents so you can be sure you use a valid separator!\n",
|
466 |
-
"\n",
|
467 |
-
"For now, we'll go with 1000 characters. "
|
468 |
-
]
|
469 |
-
},
|
470 |
-
{
|
471 |
-
"cell_type": "code",
|
472 |
-
"execution_count": 36,
|
473 |
-
"metadata": {
|
474 |
-
"id": "BSYNeLXPKZtn",
|
475 |
-
"colab": {
|
476 |
-
"base_uri": "https://localhost:8080/"
|
477 |
-
},
|
478 |
-
"outputId": "6889fed8-25f5-4103-be30-dbbe14de8b6d"
|
479 |
-
},
|
480 |
-
"outputs": [
|
481 |
-
{
|
482 |
-
"output_type": "stream",
|
483 |
-
"name": "stdout",
|
484 |
-
"text": [
|
485 |
-
"293\n"
|
486 |
-
]
|
487 |
-
}
|
488 |
-
],
|
489 |
-
"source": [
|
490 |
-
"from langchain.text_splitter import CharacterTextSplitter\n",
|
491 |
-
"\n",
|
492 |
-
"text_splitter = CharacterTextSplitter( \n",
|
493 |
-
" separator = \"\\n\",\n",
|
494 |
-
" chunk_size = 1000,\n",
|
495 |
-
" chunk_overlap=0,\n",
|
496 |
-
" length_function = len,\n",
|
497 |
-
")\n",
|
498 |
-
"texts = text_splitter.split_text(hitchhikersguide)\n",
|
499 |
-
"print(len(texts))\n"
|
500 |
-
]
|
501 |
-
},
|
502 |
-
{
|
503 |
-
"cell_type": "code",
|
504 |
-
"execution_count": 37,
|
505 |
-
"metadata": {
|
506 |
-
"id": "z9w-svpbLq62"
|
507 |
-
},
|
508 |
-
"outputs": [],
|
509 |
-
"source": [
|
510 |
-
"assert len(texts) == 293"
|
511 |
-
]
|
512 |
-
},
|
513 |
-
{
|
514 |
-
"cell_type": "markdown",
|
515 |
-
"metadata": {
|
516 |
-
"id": "dQCXLq-ML_aN"
|
517 |
-
},
|
518 |
-
"source": [
|
519 |
-
"Now that we've split our document into more manageable sized chunks. We'll need to embed those documents!\n",
|
520 |
-
"\n",
|
521 |
-
"For more information on embedding - please check out [this](https://platform.openai.com/docs/guides/embeddings) resource from OpenAI.\n",
|
522 |
-
"\n",
|
523 |
-
"In order to do this, we'll first need to select a method to embed - for this example we'll be using OpenAI's embedding - but you're free to use whatever you'd like. \n",
|
524 |
-
"\n",
|
525 |
-
"You just need to ensure you're using consistent embeddings as they don't play well with others."
|
526 |
-
]
|
527 |
-
},
|
528 |
-
{
|
529 |
-
"cell_type": "code",
|
530 |
-
"execution_count": 38,
|
531 |
-
"metadata": {
|
532 |
-
"id": "VigAmqxaMd5a"
|
533 |
-
},
|
534 |
-
"outputs": [],
|
535 |
-
"source": [
|
536 |
-
"from langchain.embeddings.openai import OpenAIEmbeddings\n",
|
537 |
-
"\n",
|
538 |
-
"os.environ[\"OPENAI_API_KEY\"] = openai.api_key\n",
|
539 |
-
"\n",
|
540 |
-
"embeddings = OpenAIEmbeddings()"
|
541 |
-
]
|
542 |
-
},
|
543 |
-
{
|
544 |
-
"cell_type": "markdown",
|
545 |
-
"metadata": {
|
546 |
-
"id": "uEN_IgzqOBNs"
|
547 |
-
},
|
548 |
-
"source": [
|
549 |
-
"Now that we've set up how we want to embed our document - we'll need to embed it. \n",
|
550 |
-
"\n",
|
551 |
-
"For this week we'll be glossing over the technical details of this process - as we'll get more into next week.\n",
|
552 |
-
"\n",
|
553 |
-
"Just know that we're converting our text into an easily queryable format!\n",
|
554 |
-
"\n",
|
555 |
-
"We're going to leverage ChromaDB for this example, so we'll want to install that dependency. "
|
556 |
-
]
|
557 |
-
},
|
558 |
-
{
|
559 |
-
"cell_type": "code",
|
560 |
-
"execution_count": 39,
|
561 |
-
"metadata": {
|
562 |
-
"colab": {
|
563 |
-
"base_uri": "https://localhost:8080/"
|
564 |
-
},
|
565 |
-
"id": "Y-ZuzHPCOjLc",
|
566 |
-
"outputId": "b46496e7-14d4-484e-a2a4-500a65099ae5"
|
567 |
-
},
|
568 |
-
"outputs": [
|
569 |
-
{
|
570 |
-
"output_type": "stream",
|
571 |
-
"name": "stdout",
|
572 |
-
"text": [
|
573 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m86.6/86.6 kB\u001b[0m \u001b[31m3.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
574 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m1.7/1.7 MB\u001b[0m \u001b[31m26.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
575 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m62.6/62.6 kB\u001b[0m \u001b[31m6.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
576 |
-
"\u001b[?25h Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
|
577 |
-
" Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
|
578 |
-
" Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
|
579 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m922.7/922.7 kB\u001b[0m \u001b[31m14.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
580 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m57.0/57.0 kB\u001b[0m \u001b[31m5.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
581 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m6.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
582 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m5.0/5.0 MB\u001b[0m \u001b[31m76.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
583 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m7.8/7.8 MB\u001b[0m \u001b[31m80.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
584 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m2.7/2.7 MB\u001b[0m \u001b[31m82.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
585 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββοΏ½οΏ½οΏ½βββββββββ\u001b[0m \u001b[32m1.3/1.3 MB\u001b[0m \u001b[31m62.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
586 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m67.0/67.0 kB\u001b[0m \u001b[31m6.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
587 |
-
"\u001b[2K \u001b[90mβββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m46.0/46.0 kB\u001b[0m \u001b[31m260.6 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
588 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m5.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
589 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m414.1/414.1 kB\u001b[0m \u001b[31m25.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
590 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m4.1/4.1 MB\u001b[0m \u001b[31m53.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
591 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m1.3/1.3 MB\u001b[0m \u001b[31m53.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
592 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m129.9/129.9 kB\u001b[0m \u001b[31m11.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
593 |
-
"\u001b[2K \u001b[90mββββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m86.8/86.8 kB\u001b[0m \u001b[31m8.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
594 |
-
"\u001b[?25h Building wheel for hnswlib (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
|
595 |
-
"\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
|
596 |
-
"google-colab 1.0.0 requires requests==2.27.1, but you have requests 2.31.0 which is incompatible.\u001b[0m\u001b[31m\n",
|
597 |
-
"\u001b[0m"
|
598 |
-
]
|
599 |
-
}
|
600 |
-
],
|
601 |
-
"source": [
|
602 |
-
"!pip install chromadb tiktoken -q"
|
603 |
-
]
|
604 |
-
},
|
605 |
-
{
|
606 |
-
"cell_type": "code",
|
607 |
-
"execution_count": 41,
|
608 |
-
"metadata": {
|
609 |
-
"id": "ql7jqj7TONDE"
|
610 |
-
},
|
611 |
-
"outputs": [],
|
612 |
-
"source": [
|
613 |
-
"from langchain.vectorstores import Chroma\n",
|
614 |
-
"\n",
|
615 |
-
"docsearch = Chroma.from_texts(texts, embeddings, metadatas=[{\"source\": str(i)} for i in range(len(texts))]).as_retriever()"
|
616 |
-
]
|
617 |
-
},
|
618 |
-
{
|
619 |
-
"cell_type": "markdown",
|
620 |
-
"metadata": {
|
621 |
-
"id": "kfn0R64lPb7n"
|
622 |
-
},
|
623 |
-
"source": [
|
624 |
-
"Now that we have our documents embedded we're free to query them with natural language! Let's see this in action!"
|
625 |
-
]
|
626 |
-
},
|
627 |
-
{
|
628 |
-
"cell_type": "code",
|
629 |
-
"execution_count": 42,
|
630 |
-
"metadata": {
|
631 |
-
"id": "ubZwxCHvQzsT"
|
632 |
-
},
|
633 |
-
"outputs": [],
|
634 |
-
"source": [
|
635 |
-
"query = \"What makes towels important?\"\n",
|
636 |
-
"docs = docsearch.get_relevant_documents(query)\n"
|
637 |
-
]
|
638 |
-
},
|
639 |
-
{
|
640 |
-
"cell_type": "code",
|
641 |
-
"execution_count": 43,
|
642 |
-
"metadata": {
|
643 |
-
"colab": {
|
644 |
-
"base_uri": "https://localhost:8080/"
|
645 |
-
},
|
646 |
-
"id": "w4M08F78Q3i3",
|
647 |
-
"outputId": "da545f29-95ec-46f0-b00d-0c9530400dac"
|
648 |
-
},
|
649 |
-
"outputs": [
|
650 |
-
{
|
651 |
-
"output_type": "execute_result",
|
652 |
-
"data": {
|
653 |
-
"text/plain": [
|
654 |
-
"Document(page_content=\"value - you can wrap it around you for warmth as you bound across\\nthe cold moons of Jaglan Beta; you can lie on it on the brilliant\\nmarble-sanded beaches of Santraginus V, inhaling the heady sea\\nvapours; you can sleep under it beneath the stars which shine so\\nredly on the desert world of Kakrafoon; use it to sail a mini\\nraft down the slow heavy river Moth; wet it for use in hand-to-\\nhand-combat; wrap it round your head to ward off noxious fumes or\\nto avoid the gaze of the Ravenous Bugblatter Beast of Traal (a\\nmindboggingly stupid animal, it assumes that if you can't see it,\\nit can't see you - daft as a bush, but very ravenous); you can\\nwave your towel in emergencies as a distress signal, and of\\ncourse dry yourself off with it if it still seems to be clean\\nenough.\\n \\nMore importantly, a towel has immense psychological value. For\\nsome reason, if a strag (strag: non-hitch hiker) discovers that a\\nhitch hiker has his towel with him, he will automatically assume\", metadata={'source': '36'})"
|
655 |
-
]
|
656 |
-
},
|
657 |
-
"metadata": {},
|
658 |
-
"execution_count": 43
|
659 |
-
}
|
660 |
-
],
|
661 |
-
"source": [
|
662 |
-
"docs[0]"
|
663 |
-
]
|
664 |
-
},
|
665 |
-
{
|
666 |
-
"cell_type": "markdown",
|
667 |
-
"metadata": {
|
668 |
-
"id": "-8W9ZmNaRRBX"
|
669 |
-
},
|
670 |
-
"source": [
|
671 |
-
"Finally, we're able to combine what we've done so far into a chain! We're going to leverage the `load_qa_chain` to quickly integrate our queryable documents with an LLM.\n",
|
672 |
-
"\n",
|
673 |
-
"There are 4 major methods of building this chain, they can be found [here](https://docs.langchain.com/docs/components/chains/index_related_chains)!\n",
|
674 |
-
"\n",
|
675 |
-
"For this example we'll be using the `stuff` chain type."
|
676 |
-
]
|
677 |
-
},
|
678 |
-
{
|
679 |
-
"cell_type": "code",
|
680 |
-
"execution_count": 50,
|
681 |
-
"metadata": {
|
682 |
-
"colab": {
|
683 |
-
"base_uri": "https://localhost:8080/",
|
684 |
-
"height": 89
|
685 |
-
},
|
686 |
-
"id": "S7vAWKiFSVj_",
|
687 |
-
"outputId": "04951906-a4f0-4321-a471-c91113a9bfa6"
|
688 |
-
},
|
689 |
-
"outputs": [
|
690 |
-
{
|
691 |
-
"output_type": "execute_result",
|
692 |
-
"data": {
|
693 |
-
"text/plain": [
|
694 |
-
"' Towels have immense psychological value. For some reason, if a strag discovers that a hitch hiker has his towel with him, he will automatically assume that he is also in possession of a toothbrush, face flannel, soap, tin of biscuits, flask, compass, map, ball of string, gnat spray, wet weather gear, space suit etc., etc. Furthermore, the strag will then happily lend the hitch hiker any of these or a dozen other items that the hitch hiker might accidentally have \"lost\". What the strag will think is that any man who can hitch the length and breadth of the galaxy, rough it, slum it, struggle against terrible odds, win through, and still knows where his towel is is clearly a man to be reckoned with.'"
|
695 |
-
],
|
696 |
-
"application/vnd.google.colaboratory.intrinsic+json": {
|
697 |
-
"type": "string"
|
698 |
-
}
|
699 |
-
},
|
700 |
-
"metadata": {},
|
701 |
-
"execution_count": 50
|
702 |
-
}
|
703 |
-
],
|
704 |
-
"source": [
|
705 |
-
"from langchain.chains.question_answering import load_qa_chain\n",
|
706 |
-
"from langchain.llms import OpenAI\n",
|
707 |
-
"\n",
|
708 |
-
"query = \"What makes towels important?\"\n",
|
709 |
-
"chain = load_qa_chain(OpenAI(temperature=0), chain_type=\"stuff\")\n",
|
710 |
-
"\n",
|
711 |
-
"chain.run(input_documents=docs, question=query)\n",
|
712 |
-
"\n"
|
713 |
-
]
|
714 |
-
},
|
715 |
-
{
|
716 |
-
"cell_type": "markdown",
|
717 |
-
"metadata": {
|
718 |
-
"id": "fMxm7pdwUs5K"
|
719 |
-
},
|
720 |
-
"source": [
|
721 |
-
"Now that we have this set-up, we'll want to package it into an app and pass it to a Hugging Face Space!\n",
|
722 |
-
"\n",
|
723 |
-
"You can find instruction on how to do that in the GitHub Repository!"
|
724 |
-
]
|
725 |
-
},
|
726 |
-
{
|
727 |
-
"cell_type": "code",
|
728 |
-
"source": [
|
729 |
-
"\n",
|
730 |
-
"!pip install huggingface-hub"
|
731 |
-
],
|
732 |
-
"metadata": {
|
733 |
-
"colab": {
|
734 |
-
"base_uri": "https://localhost:8080/"
|
735 |
-
},
|
736 |
-
"id": "CgmNVPvZCbI1",
|
737 |
-
"outputId": "0a73cd73-4061-4568-eefb-952aa146bbf0"
|
738 |
-
},
|
739 |
-
"execution_count": 47,
|
740 |
-
"outputs": [
|
741 |
-
{
|
742 |
-
"output_type": "stream",
|
743 |
-
"name": "stdout",
|
744 |
-
"text": [
|
745 |
-
"Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n",
|
746 |
-
"Collecting huggingface-hub\n",
|
747 |
-
" Downloading huggingface_hub-0.14.1-py3-none-any.whl (224 kB)\n",
|
748 |
-
"\u001b[2K \u001b[90mβββββββββββββββββββββββββββββββββββββββ\u001b[0m \u001b[32m224.5/224.5 kB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
|
749 |
-
"\u001b[?25hRequirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub) (3.12.0)\n",
|
750 |
-
"Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from huggingface-hub) (2023.4.0)\n",
|
751 |
-
"Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from huggingface-hub) (2.31.0)\n",
|
752 |
-
"Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub) (4.65.0)\n",
|
753 |
-
"Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub) (6.0)\n",
|
754 |
-
"Requirement already satisfied: typing-extensions>=3.7.4.3 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub) (4.5.0)\n",
|
755 |
-
"Requirement already satisfied: packaging>=20.9 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub) (23.1)\n",
|
756 |
-
"Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface-hub) (2.0.12)\n",
|
757 |
-
"Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface-hub) (3.4)\n",
|
758 |
-
"Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface-hub) (1.26.15)\n",
|
759 |
-
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests->huggingface-hub) (2022.12.7)\n",
|
760 |
-
"Installing collected packages: huggingface-hub\n",
|
761 |
-
"Successfully installed huggingface-hub-0.14.1\n"
|
762 |
-
]
|
763 |
-
}
|
764 |
-
]
|
765 |
-
},
|
766 |
-
{
|
767 |
-
"cell_type": "code",
|
768 |
-
"source": [
|
769 |
-
"\n",
|
770 |
-
"from huggingface_hub import notebook_login\n",
|
771 |
-
"\n",
|
772 |
-
"notebook_login()"
|
773 |
-
],
|
774 |
-
"metadata": {
|
775 |
-
"colab": {
|
776 |
-
"base_uri": "https://localhost:8080/",
|
777 |
-
"height": 145,
|
778 |
-
"referenced_widgets": [
|
779 |
-
"2fe330c24d2d40ba93365a52a57e29d1",
|
780 |
-
"268a18d98b4242b181f23ba957f57b1a",
|
781 |
-
"9003c494665d4c20908f7a0ca4186976",
|
782 |
-
"485beb78cc1f44769019de52bc9fd692",
|
783 |
-
"1567bb68e4e84d77a293ef071042f2a2",
|
784 |
-
"803198c528e144a2b5eaded3a4e725d2",
|
785 |
-
"71b69c083f8b4211a5f4e9aa69dcd02d",
|
786 |
-
"276c4910aa344c84b8ba77de9ec2768d",
|
787 |
-
"59b34cbe909348a19bf119c3f07857b1",
|
788 |
-
"3c33deffb5be40a1875f9a1dc3b4873a",
|
789 |
-
"c6b48ba4a8c5460bb1e7b8d49729ed9c",
|
790 |
-
"03016ae2b61d4beda6ff6608bf542903",
|
791 |
-
"e59332126d5d43d28e7fe14a496f9e5c",
|
792 |
-
"3b13cbcb43d44fb3b758bec8dca94645",
|
793 |
-
"23c80aca07c74f87881b192df4988b3e",
|
794 |
-
"99f35b341b88438ca7800736c43efc70",
|
795 |
-
"58683e96f29940ce82ab53b5b1c29459",
|
796 |
-
"c902160b81fa4c73ac410724821571e7",
|
797 |
-
"8e125a3a4624409199245f4016587427",
|
798 |
-
"fb60783247c244b8bb7b68f1a435f5b0",
|
799 |
-
"8f5ef5a5d7404d05afba9fb2031f0fb1",
|
800 |
-
"39b605a50adf4f93973c99a81cc3710b",
|
801 |
-
"137f43688bf9477387cc8646cc3c3497",
|
802 |
-
"fb2e425b5abd4e8db50b960d584d0620",
|
803 |
-
"91ff0c59b5914b8891bdfff546d360e6",
|
804 |
-
"fa43c262e2084116ac27aa4efd90e3e6",
|
805 |
-
"303bae99ec8841e9a9208dfe9b9617e4",
|
806 |
-
"d1cc3d09c0d441d780a4acbf4a402094",
|
807 |
-
"aec5e61cc1524d5dae60f735b906a3c0",
|
808 |
-
"cb955b6cb2854c6ba28be277be1dbe57",
|
809 |
-
"22f406e10d0a4cbabe6ffefd37f9791c",
|
810 |
-
"523f9443764a460cb2ea30897480da5c"
|
811 |
-
]
|
812 |
-
},
|
813 |
-
"id": "GHq2MiNSBtLv",
|
814 |
-
"outputId": "1dc76f77-e99a-4368-88e2-f8939246d108"
|
815 |
-
},
|
816 |
-
"execution_count": 48,
|
817 |
-
"outputs": [
|
818 |
-
{
|
819 |
-
"output_type": "display_data",
|
820 |
-
"data": {
|
821 |
-
"text/plain": [
|
822 |
-
"VBox(children=(HTML(value='<center> <img\\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.svβ¦"
|
823 |
-
],
|
824 |
-
"application/vnd.jupyter.widget-view+json": {
|
825 |
-
"version_major": 2,
|
826 |
-
"version_minor": 0,
|
827 |
-
"model_id": "2fe330c24d2d40ba93365a52a57e29d1"
|
828 |
-
}
|
829 |
-
},
|
830 |
-
"metadata": {}
|
831 |
-
}
|
832 |
-
]
|
833 |
-
}
|
834 |
-
],
|
835 |
-
"metadata": {
|
836 |
-
"colab": {
|
837 |
-
"provenance": []
|
838 |
-
},
|
839 |
-
"kernelspec": {
|
840 |
-
"display_name": "Python 3",
|
841 |
-
"name": "python3"
|
842 |
-
},
|
843 |
-
"language_info": {
|
844 |
-
"name": "python"
|
845 |
-
},
|
846 |
-
"gpuClass": "standard",
|
847 |
-
"widgets": {
|
848 |
-
"application/vnd.jupyter.widget-state+json": {
|
849 |
-
"2fe330c24d2d40ba93365a52a57e29d1": {
|
850 |
-
"model_module": "@jupyter-widgets/controls",
|
851 |
-
"model_name": "VBoxModel",
|
852 |
-
"model_module_version": "1.5.0",
|
853 |
-
"state": {
|
854 |
-
"_dom_classes": [],
|
855 |
-
"_model_module": "@jupyter-widgets/controls",
|
856 |
-
"_model_module_version": "1.5.0",
|
857 |
-
"_model_name": "VBoxModel",
|
858 |
-
"_view_count": null,
|
859 |
-
"_view_module": "@jupyter-widgets/controls",
|
860 |
-
"_view_module_version": "1.5.0",
|
861 |
-
"_view_name": "VBoxView",
|
862 |
-
"box_style": "",
|
863 |
-
"children": [
|
864 |
-
"IPY_MODEL_8f5ef5a5d7404d05afba9fb2031f0fb1",
|
865 |
-
"IPY_MODEL_39b605a50adf4f93973c99a81cc3710b",
|
866 |
-
"IPY_MODEL_137f43688bf9477387cc8646cc3c3497",
|
867 |
-
"IPY_MODEL_fb2e425b5abd4e8db50b960d584d0620"
|
868 |
-
],
|
869 |
-
"layout": "IPY_MODEL_71b69c083f8b4211a5f4e9aa69dcd02d"
|
870 |
-
}
|
871 |
-
},
|
872 |
-
"268a18d98b4242b181f23ba957f57b1a": {
|
873 |
-
"model_module": "@jupyter-widgets/controls",
|
874 |
-
"model_name": "HTMLModel",
|
875 |
-
"model_module_version": "1.5.0",
|
876 |
-
"state": {
|
877 |
-
"_dom_classes": [],
|
878 |
-
"_model_module": "@jupyter-widgets/controls",
|
879 |
-
"_model_module_version": "1.5.0",
|
880 |
-
"_model_name": "HTMLModel",
|
881 |
-
"_view_count": null,
|
882 |
-
"_view_module": "@jupyter-widgets/controls",
|
883 |
-
"_view_module_version": "1.5.0",
|
884 |
-
"_view_name": "HTMLView",
|
885 |
-
"description": "",
|
886 |
-
"description_tooltip": null,
|
887 |
-
"layout": "IPY_MODEL_276c4910aa344c84b8ba77de9ec2768d",
|
888 |
-
"placeholder": "β",
|
889 |
-
"style": "IPY_MODEL_59b34cbe909348a19bf119c3f07857b1",
|
890 |
-
"value": "<center> <img\nsrc=https://huggingface.co/front/assets/huggingface_logo-noborder.svg\nalt='Hugging Face'> <br> Copy a token from <a\nhref=\"https://huggingface.co/settings/tokens\" target=\"_blank\">your Hugging Face\ntokens page</a> and paste it below. <br> Immediately click login after copying\nyour token or it might be stored in plain text in this notebook file. </center>"
|
891 |
-
}
|
892 |
-
},
|
893 |
-
"9003c494665d4c20908f7a0ca4186976": {
|
894 |
-
"model_module": "@jupyter-widgets/controls",
|
895 |
-
"model_name": "PasswordModel",
|
896 |
-
"model_module_version": "1.5.0",
|
897 |
-
"state": {
|
898 |
-
"_dom_classes": [],
|
899 |
-
"_model_module": "@jupyter-widgets/controls",
|
900 |
-
"_model_module_version": "1.5.0",
|
901 |
-
"_model_name": "PasswordModel",
|
902 |
-
"_view_count": null,
|
903 |
-
"_view_module": "@jupyter-widgets/controls",
|
904 |
-
"_view_module_version": "1.5.0",
|
905 |
-
"_view_name": "PasswordView",
|
906 |
-
"continuous_update": true,
|
907 |
-
"description": "Token:",
|
908 |
-
"description_tooltip": null,
|
909 |
-
"disabled": false,
|
910 |
-
"layout": "IPY_MODEL_3c33deffb5be40a1875f9a1dc3b4873a",
|
911 |
-
"placeholder": "β",
|
912 |
-
"style": "IPY_MODEL_c6b48ba4a8c5460bb1e7b8d49729ed9c",
|
913 |
-
"value": ""
|
914 |
-
}
|
915 |
-
},
|
916 |
-
"485beb78cc1f44769019de52bc9fd692": {
|
917 |
-
"model_module": "@jupyter-widgets/controls",
|
918 |
-
"model_name": "CheckboxModel",
|
919 |
-
"model_module_version": "1.5.0",
|
920 |
-
"state": {
|
921 |
-
"_dom_classes": [],
|
922 |
-
"_model_module": "@jupyter-widgets/controls",
|
923 |
-
"_model_module_version": "1.5.0",
|
924 |
-
"_model_name": "CheckboxModel",
|
925 |
-
"_view_count": null,
|
926 |
-
"_view_module": "@jupyter-widgets/controls",
|
927 |
-
"_view_module_version": "1.5.0",
|
928 |
-
"_view_name": "CheckboxView",
|
929 |
-
"description": "Add token as git credential?",
|
930 |
-
"description_tooltip": null,
|
931 |
-
"disabled": false,
|
932 |
-
"indent": true,
|
933 |
-
"layout": "IPY_MODEL_03016ae2b61d4beda6ff6608bf542903",
|
934 |
-
"style": "IPY_MODEL_e59332126d5d43d28e7fe14a496f9e5c",
|
935 |
-
"value": true
|
936 |
-
}
|
937 |
-
},
|
938 |
-
"1567bb68e4e84d77a293ef071042f2a2": {
|
939 |
-
"model_module": "@jupyter-widgets/controls",
|
940 |
-
"model_name": "ButtonModel",
|
941 |
-
"model_module_version": "1.5.0",
|
942 |
-
"state": {
|
943 |
-
"_dom_classes": [],
|
944 |
-
"_model_module": "@jupyter-widgets/controls",
|
945 |
-
"_model_module_version": "1.5.0",
|
946 |
-
"_model_name": "ButtonModel",
|
947 |
-
"_view_count": null,
|
948 |
-
"_view_module": "@jupyter-widgets/controls",
|
949 |
-
"_view_module_version": "1.5.0",
|
950 |
-
"_view_name": "ButtonView",
|
951 |
-
"button_style": "",
|
952 |
-
"description": "Login",
|
953 |
-
"disabled": false,
|
954 |
-
"icon": "",
|
955 |
-
"layout": "IPY_MODEL_3b13cbcb43d44fb3b758bec8dca94645",
|
956 |
-
"style": "IPY_MODEL_23c80aca07c74f87881b192df4988b3e",
|
957 |
-
"tooltip": ""
|
958 |
-
}
|
959 |
-
},
|
960 |
-
"803198c528e144a2b5eaded3a4e725d2": {
|
961 |
-
"model_module": "@jupyter-widgets/controls",
|
962 |
-
"model_name": "HTMLModel",
|
963 |
-
"model_module_version": "1.5.0",
|
964 |
-
"state": {
|
965 |
-
"_dom_classes": [],
|
966 |
-
"_model_module": "@jupyter-widgets/controls",
|
967 |
-
"_model_module_version": "1.5.0",
|
968 |
-
"_model_name": "HTMLModel",
|
969 |
-
"_view_count": null,
|
970 |
-
"_view_module": "@jupyter-widgets/controls",
|
971 |
-
"_view_module_version": "1.5.0",
|
972 |
-
"_view_name": "HTMLView",
|
973 |
-
"description": "",
|
974 |
-
"description_tooltip": null,
|
975 |
-
"layout": "IPY_MODEL_99f35b341b88438ca7800736c43efc70",
|
976 |
-
"placeholder": "β",
|
977 |
-
"style": "IPY_MODEL_58683e96f29940ce82ab53b5b1c29459",
|
978 |
-
"value": "\n<b>Pro Tip:</b> If you don't already have one, you can create a dedicated\n'notebooks' token with 'write' access, that you can then easily reuse for all\nnotebooks. </center>"
|
979 |
-
}
|
980 |
-
},
|
981 |
-
"71b69c083f8b4211a5f4e9aa69dcd02d": {
|
982 |
-
"model_module": "@jupyter-widgets/base",
|
983 |
-
"model_name": "LayoutModel",
|
984 |
-
"model_module_version": "1.2.0",
|
985 |
-
"state": {
|
986 |
-
"_model_module": "@jupyter-widgets/base",
|
987 |
-
"_model_module_version": "1.2.0",
|
988 |
-
"_model_name": "LayoutModel",
|
989 |
-
"_view_count": null,
|
990 |
-
"_view_module": "@jupyter-widgets/base",
|
991 |
-
"_view_module_version": "1.2.0",
|
992 |
-
"_view_name": "LayoutView",
|
993 |
-
"align_content": null,
|
994 |
-
"align_items": "center",
|
995 |
-
"align_self": null,
|
996 |
-
"border": null,
|
997 |
-
"bottom": null,
|
998 |
-
"display": "flex",
|
999 |
-
"flex": null,
|
1000 |
-
"flex_flow": "column",
|
1001 |
-
"grid_area": null,
|
1002 |
-
"grid_auto_columns": null,
|
1003 |
-
"grid_auto_flow": null,
|
1004 |
-
"grid_auto_rows": null,
|
1005 |
-
"grid_column": null,
|
1006 |
-
"grid_gap": null,
|
1007 |
-
"grid_row": null,
|
1008 |
-
"grid_template_areas": null,
|
1009 |
-
"grid_template_columns": null,
|
1010 |
-
"grid_template_rows": null,
|
1011 |
-
"height": null,
|
1012 |
-
"justify_content": null,
|
1013 |
-
"justify_items": null,
|
1014 |
-
"left": null,
|
1015 |
-
"margin": null,
|
1016 |
-
"max_height": null,
|
1017 |
-
"max_width": null,
|
1018 |
-
"min_height": null,
|
1019 |
-
"min_width": null,
|
1020 |
-
"object_fit": null,
|
1021 |
-
"object_position": null,
|
1022 |
-
"order": null,
|
1023 |
-
"overflow": null,
|
1024 |
-
"overflow_x": null,
|
1025 |
-
"overflow_y": null,
|
1026 |
-
"padding": null,
|
1027 |
-
"right": null,
|
1028 |
-
"top": null,
|
1029 |
-
"visibility": null,
|
1030 |
-
"width": "50%"
|
1031 |
-
}
|
1032 |
-
},
|
1033 |
-
"276c4910aa344c84b8ba77de9ec2768d": {
|
1034 |
-
"model_module": "@jupyter-widgets/base",
|
1035 |
-
"model_name": "LayoutModel",
|
1036 |
-
"model_module_version": "1.2.0",
|
1037 |
-
"state": {
|
1038 |
-
"_model_module": "@jupyter-widgets/base",
|
1039 |
-
"_model_module_version": "1.2.0",
|
1040 |
-
"_model_name": "LayoutModel",
|
1041 |
-
"_view_count": null,
|
1042 |
-
"_view_module": "@jupyter-widgets/base",
|
1043 |
-
"_view_module_version": "1.2.0",
|
1044 |
-
"_view_name": "LayoutView",
|
1045 |
-
"align_content": null,
|
1046 |
-
"align_items": null,
|
1047 |
-
"align_self": null,
|
1048 |
-
"border": null,
|
1049 |
-
"bottom": null,
|
1050 |
-
"display": null,
|
1051 |
-
"flex": null,
|
1052 |
-
"flex_flow": null,
|
1053 |
-
"grid_area": null,
|
1054 |
-
"grid_auto_columns": null,
|
1055 |
-
"grid_auto_flow": null,
|
1056 |
-
"grid_auto_rows": null,
|
1057 |
-
"grid_column": null,
|
1058 |
-
"grid_gap": null,
|
1059 |
-
"grid_row": null,
|
1060 |
-
"grid_template_areas": null,
|
1061 |
-
"grid_template_columns": null,
|
1062 |
-
"grid_template_rows": null,
|
1063 |
-
"height": null,
|
1064 |
-
"justify_content": null,
|
1065 |
-
"justify_items": null,
|
1066 |
-
"left": null,
|
1067 |
-
"margin": null,
|
1068 |
-
"max_height": null,
|
1069 |
-
"max_width": null,
|
1070 |
-
"min_height": null,
|
1071 |
-
"min_width": null,
|
1072 |
-
"object_fit": null,
|
1073 |
-
"object_position": null,
|
1074 |
-
"order": null,
|
1075 |
-
"overflow": null,
|
1076 |
-
"overflow_x": null,
|
1077 |
-
"overflow_y": null,
|
1078 |
-
"padding": null,
|
1079 |
-
"right": null,
|
1080 |
-
"top": null,
|
1081 |
-
"visibility": null,
|
1082 |
-
"width": null
|
1083 |
-
}
|
1084 |
-
},
|
1085 |
-
"59b34cbe909348a19bf119c3f07857b1": {
|
1086 |
-
"model_module": "@jupyter-widgets/controls",
|
1087 |
-
"model_name": "DescriptionStyleModel",
|
1088 |
-
"model_module_version": "1.5.0",
|
1089 |
-
"state": {
|
1090 |
-
"_model_module": "@jupyter-widgets/controls",
|
1091 |
-
"_model_module_version": "1.5.0",
|
1092 |
-
"_model_name": "DescriptionStyleModel",
|
1093 |
-
"_view_count": null,
|
1094 |
-
"_view_module": "@jupyter-widgets/base",
|
1095 |
-
"_view_module_version": "1.2.0",
|
1096 |
-
"_view_name": "StyleView",
|
1097 |
-
"description_width": ""
|
1098 |
-
}
|
1099 |
-
},
|
1100 |
-
"3c33deffb5be40a1875f9a1dc3b4873a": {
|
1101 |
-
"model_module": "@jupyter-widgets/base",
|
1102 |
-
"model_name": "LayoutModel",
|
1103 |
-
"model_module_version": "1.2.0",
|
1104 |
-
"state": {
|
1105 |
-
"_model_module": "@jupyter-widgets/base",
|
1106 |
-
"_model_module_version": "1.2.0",
|
1107 |
-
"_model_name": "LayoutModel",
|
1108 |
-
"_view_count": null,
|
1109 |
-
"_view_module": "@jupyter-widgets/base",
|
1110 |
-
"_view_module_version": "1.2.0",
|
1111 |
-
"_view_name": "LayoutView",
|
1112 |
-
"align_content": null,
|
1113 |
-
"align_items": null,
|
1114 |
-
"align_self": null,
|
1115 |
-
"border": null,
|
1116 |
-
"bottom": null,
|
1117 |
-
"display": null,
|
1118 |
-
"flex": null,
|
1119 |
-
"flex_flow": null,
|
1120 |
-
"grid_area": null,
|
1121 |
-
"grid_auto_columns": null,
|
1122 |
-
"grid_auto_flow": null,
|
1123 |
-
"grid_auto_rows": null,
|
1124 |
-
"grid_column": null,
|
1125 |
-
"grid_gap": null,
|
1126 |
-
"grid_row": null,
|
1127 |
-
"grid_template_areas": null,
|
1128 |
-
"grid_template_columns": null,
|
1129 |
-
"grid_template_rows": null,
|
1130 |
-
"height": null,
|
1131 |
-
"justify_content": null,
|
1132 |
-
"justify_items": null,
|
1133 |
-
"left": null,
|
1134 |
-
"margin": null,
|
1135 |
-
"max_height": null,
|
1136 |
-
"max_width": null,
|
1137 |
-
"min_height": null,
|
1138 |
-
"min_width": null,
|
1139 |
-
"object_fit": null,
|
1140 |
-
"object_position": null,
|
1141 |
-
"order": null,
|
1142 |
-
"overflow": null,
|
1143 |
-
"overflow_x": null,
|
1144 |
-
"overflow_y": null,
|
1145 |
-
"padding": null,
|
1146 |
-
"right": null,
|
1147 |
-
"top": null,
|
1148 |
-
"visibility": null,
|
1149 |
-
"width": null
|
1150 |
-
}
|
1151 |
-
},
|
1152 |
-
"c6b48ba4a8c5460bb1e7b8d49729ed9c": {
|
1153 |
-
"model_module": "@jupyter-widgets/controls",
|
1154 |
-
"model_name": "DescriptionStyleModel",
|
1155 |
-
"model_module_version": "1.5.0",
|
1156 |
-
"state": {
|
1157 |
-
"_model_module": "@jupyter-widgets/controls",
|
1158 |
-
"_model_module_version": "1.5.0",
|
1159 |
-
"_model_name": "DescriptionStyleModel",
|
1160 |
-
"_view_count": null,
|
1161 |
-
"_view_module": "@jupyter-widgets/base",
|
1162 |
-
"_view_module_version": "1.2.0",
|
1163 |
-
"_view_name": "StyleView",
|
1164 |
-
"description_width": ""
|
1165 |
-
}
|
1166 |
-
},
|
1167 |
-
"03016ae2b61d4beda6ff6608bf542903": {
|
1168 |
-
"model_module": "@jupyter-widgets/base",
|
1169 |
-
"model_name": "LayoutModel",
|
1170 |
-
"model_module_version": "1.2.0",
|
1171 |
-
"state": {
|
1172 |
-
"_model_module": "@jupyter-widgets/base",
|
1173 |
-
"_model_module_version": "1.2.0",
|
1174 |
-
"_model_name": "LayoutModel",
|
1175 |
-
"_view_count": null,
|
1176 |
-
"_view_module": "@jupyter-widgets/base",
|
1177 |
-
"_view_module_version": "1.2.0",
|
1178 |
-
"_view_name": "LayoutView",
|
1179 |
-
"align_content": null,
|
1180 |
-
"align_items": null,
|
1181 |
-
"align_self": null,
|
1182 |
-
"border": null,
|
1183 |
-
"bottom": null,
|
1184 |
-
"display": null,
|
1185 |
-
"flex": null,
|
1186 |
-
"flex_flow": null,
|
1187 |
-
"grid_area": null,
|
1188 |
-
"grid_auto_columns": null,
|
1189 |
-
"grid_auto_flow": null,
|
1190 |
-
"grid_auto_rows": null,
|
1191 |
-
"grid_column": null,
|
1192 |
-
"grid_gap": null,
|
1193 |
-
"grid_row": null,
|
1194 |
-
"grid_template_areas": null,
|
1195 |
-
"grid_template_columns": null,
|
1196 |
-
"grid_template_rows": null,
|
1197 |
-
"height": null,
|
1198 |
-
"justify_content": null,
|
1199 |
-
"justify_items": null,
|
1200 |
-
"left": null,
|
1201 |
-
"margin": null,
|
1202 |
-
"max_height": null,
|
1203 |
-
"max_width": null,
|
1204 |
-
"min_height": null,
|
1205 |
-
"min_width": null,
|
1206 |
-
"object_fit": null,
|
1207 |
-
"object_position": null,
|
1208 |
-
"order": null,
|
1209 |
-
"overflow": null,
|
1210 |
-
"overflow_x": null,
|
1211 |
-
"overflow_y": null,
|
1212 |
-
"padding": null,
|
1213 |
-
"right": null,
|
1214 |
-
"top": null,
|
1215 |
-
"visibility": null,
|
1216 |
-
"width": null
|
1217 |
-
}
|
1218 |
-
},
|
1219 |
-
"e59332126d5d43d28e7fe14a496f9e5c": {
|
1220 |
-
"model_module": "@jupyter-widgets/controls",
|
1221 |
-
"model_name": "DescriptionStyleModel",
|
1222 |
-
"model_module_version": "1.5.0",
|
1223 |
-
"state": {
|
1224 |
-
"_model_module": "@jupyter-widgets/controls",
|
1225 |
-
"_model_module_version": "1.5.0",
|
1226 |
-
"_model_name": "DescriptionStyleModel",
|
1227 |
-
"_view_count": null,
|
1228 |
-
"_view_module": "@jupyter-widgets/base",
|
1229 |
-
"_view_module_version": "1.2.0",
|
1230 |
-
"_view_name": "StyleView",
|
1231 |
-
"description_width": ""
|
1232 |
-
}
|
1233 |
-
},
|
1234 |
-
"3b13cbcb43d44fb3b758bec8dca94645": {
|
1235 |
-
"model_module": "@jupyter-widgets/base",
|
1236 |
-
"model_name": "LayoutModel",
|
1237 |
-
"model_module_version": "1.2.0",
|
1238 |
-
"state": {
|
1239 |
-
"_model_module": "@jupyter-widgets/base",
|
1240 |
-
"_model_module_version": "1.2.0",
|
1241 |
-
"_model_name": "LayoutModel",
|
1242 |
-
"_view_count": null,
|
1243 |
-
"_view_module": "@jupyter-widgets/base",
|
1244 |
-
"_view_module_version": "1.2.0",
|
1245 |
-
"_view_name": "LayoutView",
|
1246 |
-
"align_content": null,
|
1247 |
-
"align_items": null,
|
1248 |
-
"align_self": null,
|
1249 |
-
"border": null,
|
1250 |
-
"bottom": null,
|
1251 |
-
"display": null,
|
1252 |
-
"flex": null,
|
1253 |
-
"flex_flow": null,
|
1254 |
-
"grid_area": null,
|
1255 |
-
"grid_auto_columns": null,
|
1256 |
-
"grid_auto_flow": null,
|
1257 |
-
"grid_auto_rows": null,
|
1258 |
-
"grid_column": null,
|
1259 |
-
"grid_gap": null,
|
1260 |
-
"grid_row": null,
|
1261 |
-
"grid_template_areas": null,
|
1262 |
-
"grid_template_columns": null,
|
1263 |
-
"grid_template_rows": null,
|
1264 |
-
"height": null,
|
1265 |
-
"justify_content": null,
|
1266 |
-
"justify_items": null,
|
1267 |
-
"left": null,
|
1268 |
-
"margin": null,
|
1269 |
-
"max_height": null,
|
1270 |
-
"max_width": null,
|
1271 |
-
"min_height": null,
|
1272 |
-
"min_width": null,
|
1273 |
-
"object_fit": null,
|
1274 |
-
"object_position": null,
|
1275 |
-
"order": null,
|
1276 |
-
"overflow": null,
|
1277 |
-
"overflow_x": null,
|
1278 |
-
"overflow_y": null,
|
1279 |
-
"padding": null,
|
1280 |
-
"right": null,
|
1281 |
-
"top": null,
|
1282 |
-
"visibility": null,
|
1283 |
-
"width": null
|
1284 |
-
}
|
1285 |
-
},
|
1286 |
-
"23c80aca07c74f87881b192df4988b3e": {
|
1287 |
-
"model_module": "@jupyter-widgets/controls",
|
1288 |
-
"model_name": "ButtonStyleModel",
|
1289 |
-
"model_module_version": "1.5.0",
|
1290 |
-
"state": {
|
1291 |
-
"_model_module": "@jupyter-widgets/controls",
|
1292 |
-
"_model_module_version": "1.5.0",
|
1293 |
-
"_model_name": "ButtonStyleModel",
|
1294 |
-
"_view_count": null,
|
1295 |
-
"_view_module": "@jupyter-widgets/base",
|
1296 |
-
"_view_module_version": "1.2.0",
|
1297 |
-
"_view_name": "StyleView",
|
1298 |
-
"button_color": null,
|
1299 |
-
"font_weight": ""
|
1300 |
-
}
|
1301 |
-
},
|
1302 |
-
"99f35b341b88438ca7800736c43efc70": {
|
1303 |
-
"model_module": "@jupyter-widgets/base",
|
1304 |
-
"model_name": "LayoutModel",
|
1305 |
-
"model_module_version": "1.2.0",
|
1306 |
-
"state": {
|
1307 |
-
"_model_module": "@jupyter-widgets/base",
|
1308 |
-
"_model_module_version": "1.2.0",
|
1309 |
-
"_model_name": "LayoutModel",
|
1310 |
-
"_view_count": null,
|
1311 |
-
"_view_module": "@jupyter-widgets/base",
|
1312 |
-
"_view_module_version": "1.2.0",
|
1313 |
-
"_view_name": "LayoutView",
|
1314 |
-
"align_content": null,
|
1315 |
-
"align_items": null,
|
1316 |
-
"align_self": null,
|
1317 |
-
"border": null,
|
1318 |
-
"bottom": null,
|
1319 |
-
"display": null,
|
1320 |
-
"flex": null,
|
1321 |
-
"flex_flow": null,
|
1322 |
-
"grid_area": null,
|
1323 |
-
"grid_auto_columns": null,
|
1324 |
-
"grid_auto_flow": null,
|
1325 |
-
"grid_auto_rows": null,
|
1326 |
-
"grid_column": null,
|
1327 |
-
"grid_gap": null,
|
1328 |
-
"grid_row": null,
|
1329 |
-
"grid_template_areas": null,
|
1330 |
-
"grid_template_columns": null,
|
1331 |
-
"grid_template_rows": null,
|
1332 |
-
"height": null,
|
1333 |
-
"justify_content": null,
|
1334 |
-
"justify_items": null,
|
1335 |
-
"left": null,
|
1336 |
-
"margin": null,
|
1337 |
-
"max_height": null,
|
1338 |
-
"max_width": null,
|
1339 |
-
"min_height": null,
|
1340 |
-
"min_width": null,
|
1341 |
-
"object_fit": null,
|
1342 |
-
"object_position": null,
|
1343 |
-
"order": null,
|
1344 |
-
"overflow": null,
|
1345 |
-
"overflow_x": null,
|
1346 |
-
"overflow_y": null,
|
1347 |
-
"padding": null,
|
1348 |
-
"right": null,
|
1349 |
-
"top": null,
|
1350 |
-
"visibility": null,
|
1351 |
-
"width": null
|
1352 |
-
}
|
1353 |
-
},
|
1354 |
-
"58683e96f29940ce82ab53b5b1c29459": {
|
1355 |
-
"model_module": "@jupyter-widgets/controls",
|
1356 |
-
"model_name": "DescriptionStyleModel",
|
1357 |
-
"model_module_version": "1.5.0",
|
1358 |
-
"state": {
|
1359 |
-
"_model_module": "@jupyter-widgets/controls",
|
1360 |
-
"_model_module_version": "1.5.0",
|
1361 |
-
"_model_name": "DescriptionStyleModel",
|
1362 |
-
"_view_count": null,
|
1363 |
-
"_view_module": "@jupyter-widgets/base",
|
1364 |
-
"_view_module_version": "1.2.0",
|
1365 |
-
"_view_name": "StyleView",
|
1366 |
-
"description_width": ""
|
1367 |
-
}
|
1368 |
-
},
|
1369 |
-
"c902160b81fa4c73ac410724821571e7": {
|
1370 |
-
"model_module": "@jupyter-widgets/controls",
|
1371 |
-
"model_name": "LabelModel",
|
1372 |
-
"model_module_version": "1.5.0",
|
1373 |
-
"state": {
|
1374 |
-
"_dom_classes": [],
|
1375 |
-
"_model_module": "@jupyter-widgets/controls",
|
1376 |
-
"_model_module_version": "1.5.0",
|
1377 |
-
"_model_name": "LabelModel",
|
1378 |
-
"_view_count": null,
|
1379 |
-
"_view_module": "@jupyter-widgets/controls",
|
1380 |
-
"_view_module_version": "1.5.0",
|
1381 |
-
"_view_name": "LabelView",
|
1382 |
-
"description": "",
|
1383 |
-
"description_tooltip": null,
|
1384 |
-
"layout": "IPY_MODEL_8e125a3a4624409199245f4016587427",
|
1385 |
-
"placeholder": "β",
|
1386 |
-
"style": "IPY_MODEL_fb60783247c244b8bb7b68f1a435f5b0",
|
1387 |
-
"value": "Connecting..."
|
1388 |
-
}
|
1389 |
-
},
|
1390 |
-
"8e125a3a4624409199245f4016587427": {
|
1391 |
-
"model_module": "@jupyter-widgets/base",
|
1392 |
-
"model_name": "LayoutModel",
|
1393 |
-
"model_module_version": "1.2.0",
|
1394 |
-
"state": {
|
1395 |
-
"_model_module": "@jupyter-widgets/base",
|
1396 |
-
"_model_module_version": "1.2.0",
|
1397 |
-
"_model_name": "LayoutModel",
|
1398 |
-
"_view_count": null,
|
1399 |
-
"_view_module": "@jupyter-widgets/base",
|
1400 |
-
"_view_module_version": "1.2.0",
|
1401 |
-
"_view_name": "LayoutView",
|
1402 |
-
"align_content": null,
|
1403 |
-
"align_items": null,
|
1404 |
-
"align_self": null,
|
1405 |
-
"border": null,
|
1406 |
-
"bottom": null,
|
1407 |
-
"display": null,
|
1408 |
-
"flex": null,
|
1409 |
-
"flex_flow": null,
|
1410 |
-
"grid_area": null,
|
1411 |
-
"grid_auto_columns": null,
|
1412 |
-
"grid_auto_flow": null,
|
1413 |
-
"grid_auto_rows": null,
|
1414 |
-
"grid_column": null,
|
1415 |
-
"grid_gap": null,
|
1416 |
-
"grid_row": null,
|
1417 |
-
"grid_template_areas": null,
|
1418 |
-
"grid_template_columns": null,
|
1419 |
-
"grid_template_rows": null,
|
1420 |
-
"height": null,
|
1421 |
-
"justify_content": null,
|
1422 |
-
"justify_items": null,
|
1423 |
-
"left": null,
|
1424 |
-
"margin": null,
|
1425 |
-
"max_height": null,
|
1426 |
-
"max_width": null,
|
1427 |
-
"min_height": null,
|
1428 |
-
"min_width": null,
|
1429 |
-
"object_fit": null,
|
1430 |
-
"object_position": null,
|
1431 |
-
"order": null,
|
1432 |
-
"overflow": null,
|
1433 |
-
"overflow_x": null,
|
1434 |
-
"overflow_y": null,
|
1435 |
-
"padding": null,
|
1436 |
-
"right": null,
|
1437 |
-
"top": null,
|
1438 |
-
"visibility": null,
|
1439 |
-
"width": null
|
1440 |
-
}
|
1441 |
-
},
|
1442 |
-
"fb60783247c244b8bb7b68f1a435f5b0": {
|
1443 |
-
"model_module": "@jupyter-widgets/controls",
|
1444 |
-
"model_name": "DescriptionStyleModel",
|
1445 |
-
"model_module_version": "1.5.0",
|
1446 |
-
"state": {
|
1447 |
-
"_model_module": "@jupyter-widgets/controls",
|
1448 |
-
"_model_module_version": "1.5.0",
|
1449 |
-
"_model_name": "DescriptionStyleModel",
|
1450 |
-
"_view_count": null,
|
1451 |
-
"_view_module": "@jupyter-widgets/base",
|
1452 |
-
"_view_module_version": "1.2.0",
|
1453 |
-
"_view_name": "StyleView",
|
1454 |
-
"description_width": ""
|
1455 |
-
}
|
1456 |
-
},
|
1457 |
-
"8f5ef5a5d7404d05afba9fb2031f0fb1": {
|
1458 |
-
"model_module": "@jupyter-widgets/controls",
|
1459 |
-
"model_name": "LabelModel",
|
1460 |
-
"model_module_version": "1.5.0",
|
1461 |
-
"state": {
|
1462 |
-
"_dom_classes": [],
|
1463 |
-
"_model_module": "@jupyter-widgets/controls",
|
1464 |
-
"_model_module_version": "1.5.0",
|
1465 |
-
"_model_name": "LabelModel",
|
1466 |
-
"_view_count": null,
|
1467 |
-
"_view_module": "@jupyter-widgets/controls",
|
1468 |
-
"_view_module_version": "1.5.0",
|
1469 |
-
"_view_name": "LabelView",
|
1470 |
-
"description": "",
|
1471 |
-
"description_tooltip": null,
|
1472 |
-
"layout": "IPY_MODEL_91ff0c59b5914b8891bdfff546d360e6",
|
1473 |
-
"placeholder": "β",
|
1474 |
-
"style": "IPY_MODEL_fa43c262e2084116ac27aa4efd90e3e6",
|
1475 |
-
"value": "Token is valid."
|
1476 |
-
}
|
1477 |
-
},
|
1478 |
-
"39b605a50adf4f93973c99a81cc3710b": {
|
1479 |
-
"model_module": "@jupyter-widgets/controls",
|
1480 |
-
"model_name": "LabelModel",
|
1481 |
-
"model_module_version": "1.5.0",
|
1482 |
-
"state": {
|
1483 |
-
"_dom_classes": [],
|
1484 |
-
"_model_module": "@jupyter-widgets/controls",
|
1485 |
-
"_model_module_version": "1.5.0",
|
1486 |
-
"_model_name": "LabelModel",
|
1487 |
-
"_view_count": null,
|
1488 |
-
"_view_module": "@jupyter-widgets/controls",
|
1489 |
-
"_view_module_version": "1.5.0",
|
1490 |
-
"_view_name": "LabelView",
|
1491 |
-
"description": "",
|
1492 |
-
"description_tooltip": null,
|
1493 |
-
"layout": "IPY_MODEL_303bae99ec8841e9a9208dfe9b9617e4",
|
1494 |
-
"placeholder": "β",
|
1495 |
-
"style": "IPY_MODEL_d1cc3d09c0d441d780a4acbf4a402094",
|
1496 |
-
"value": "Your token has been saved in your configured git credential helpers (store)."
|
1497 |
-
}
|
1498 |
-
},
|
1499 |
-
"137f43688bf9477387cc8646cc3c3497": {
|
1500 |
-
"model_module": "@jupyter-widgets/controls",
|
1501 |
-
"model_name": "LabelModel",
|
1502 |
-
"model_module_version": "1.5.0",
|
1503 |
-
"state": {
|
1504 |
-
"_dom_classes": [],
|
1505 |
-
"_model_module": "@jupyter-widgets/controls",
|
1506 |
-
"_model_module_version": "1.5.0",
|
1507 |
-
"_model_name": "LabelModel",
|
1508 |
-
"_view_count": null,
|
1509 |
-
"_view_module": "@jupyter-widgets/controls",
|
1510 |
-
"_view_module_version": "1.5.0",
|
1511 |
-
"_view_name": "LabelView",
|
1512 |
-
"description": "",
|
1513 |
-
"description_tooltip": null,
|
1514 |
-
"layout": "IPY_MODEL_aec5e61cc1524d5dae60f735b906a3c0",
|
1515 |
-
"placeholder": "β",
|
1516 |
-
"style": "IPY_MODEL_cb955b6cb2854c6ba28be277be1dbe57",
|
1517 |
-
"value": "Your token has been saved to /root/.cache/huggingface/token"
|
1518 |
-
}
|
1519 |
-
},
|
1520 |
-
"fb2e425b5abd4e8db50b960d584d0620": {
|
1521 |
-
"model_module": "@jupyter-widgets/controls",
|
1522 |
-
"model_name": "LabelModel",
|
1523 |
-
"model_module_version": "1.5.0",
|
1524 |
-
"state": {
|
1525 |
-
"_dom_classes": [],
|
1526 |
-
"_model_module": "@jupyter-widgets/controls",
|
1527 |
-
"_model_module_version": "1.5.0",
|
1528 |
-
"_model_name": "LabelModel",
|
1529 |
-
"_view_count": null,
|
1530 |
-
"_view_module": "@jupyter-widgets/controls",
|
1531 |
-
"_view_module_version": "1.5.0",
|
1532 |
-
"_view_name": "LabelView",
|
1533 |
-
"description": "",
|
1534 |
-
"description_tooltip": null,
|
1535 |
-
"layout": "IPY_MODEL_22f406e10d0a4cbabe6ffefd37f9791c",
|
1536 |
-
"placeholder": "β",
|
1537 |
-
"style": "IPY_MODEL_523f9443764a460cb2ea30897480da5c",
|
1538 |
-
"value": "Login successful"
|
1539 |
-
}
|
1540 |
-
},
|
1541 |
-
"91ff0c59b5914b8891bdfff546d360e6": {
|
1542 |
-
"model_module": "@jupyter-widgets/base",
|
1543 |
-
"model_name": "LayoutModel",
|
1544 |
-
"model_module_version": "1.2.0",
|
1545 |
-
"state": {
|
1546 |
-
"_model_module": "@jupyter-widgets/base",
|
1547 |
-
"_model_module_version": "1.2.0",
|
1548 |
-
"_model_name": "LayoutModel",
|
1549 |
-
"_view_count": null,
|
1550 |
-
"_view_module": "@jupyter-widgets/base",
|
1551 |
-
"_view_module_version": "1.2.0",
|
1552 |
-
"_view_name": "LayoutView",
|
1553 |
-
"align_content": null,
|
1554 |
-
"align_items": null,
|
1555 |
-
"align_self": null,
|
1556 |
-
"border": null,
|
1557 |
-
"bottom": null,
|
1558 |
-
"display": null,
|
1559 |
-
"flex": null,
|
1560 |
-
"flex_flow": null,
|
1561 |
-
"grid_area": null,
|
1562 |
-
"grid_auto_columns": null,
|
1563 |
-
"grid_auto_flow": null,
|
1564 |
-
"grid_auto_rows": null,
|
1565 |
-
"grid_column": null,
|
1566 |
-
"grid_gap": null,
|
1567 |
-
"grid_row": null,
|
1568 |
-
"grid_template_areas": null,
|
1569 |
-
"grid_template_columns": null,
|
1570 |
-
"grid_template_rows": null,
|
1571 |
-
"height": null,
|
1572 |
-
"justify_content": null,
|
1573 |
-
"justify_items": null,
|
1574 |
-
"left": null,
|
1575 |
-
"margin": null,
|
1576 |
-
"max_height": null,
|
1577 |
-
"max_width": null,
|
1578 |
-
"min_height": null,
|
1579 |
-
"min_width": null,
|
1580 |
-
"object_fit": null,
|
1581 |
-
"object_position": null,
|
1582 |
-
"order": null,
|
1583 |
-
"overflow": null,
|
1584 |
-
"overflow_x": null,
|
1585 |
-
"overflow_y": null,
|
1586 |
-
"padding": null,
|
1587 |
-
"right": null,
|
1588 |
-
"top": null,
|
1589 |
-
"visibility": null,
|
1590 |
-
"width": null
|
1591 |
-
}
|
1592 |
-
},
|
1593 |
-
"fa43c262e2084116ac27aa4efd90e3e6": {
|
1594 |
-
"model_module": "@jupyter-widgets/controls",
|
1595 |
-
"model_name": "DescriptionStyleModel",
|
1596 |
-
"model_module_version": "1.5.0",
|
1597 |
-
"state": {
|
1598 |
-
"_model_module": "@jupyter-widgets/controls",
|
1599 |
-
"_model_module_version": "1.5.0",
|
1600 |
-
"_model_name": "DescriptionStyleModel",
|
1601 |
-
"_view_count": null,
|
1602 |
-
"_view_module": "@jupyter-widgets/base",
|
1603 |
-
"_view_module_version": "1.2.0",
|
1604 |
-
"_view_name": "StyleView",
|
1605 |
-
"description_width": ""
|
1606 |
-
}
|
1607 |
-
},
|
1608 |
-
"303bae99ec8841e9a9208dfe9b9617e4": {
|
1609 |
-
"model_module": "@jupyter-widgets/base",
|
1610 |
-
"model_name": "LayoutModel",
|
1611 |
-
"model_module_version": "1.2.0",
|
1612 |
-
"state": {
|
1613 |
-
"_model_module": "@jupyter-widgets/base",
|
1614 |
-
"_model_module_version": "1.2.0",
|
1615 |
-
"_model_name": "LayoutModel",
|
1616 |
-
"_view_count": null,
|
1617 |
-
"_view_module": "@jupyter-widgets/base",
|
1618 |
-
"_view_module_version": "1.2.0",
|
1619 |
-
"_view_name": "LayoutView",
|
1620 |
-
"align_content": null,
|
1621 |
-
"align_items": null,
|
1622 |
-
"align_self": null,
|
1623 |
-
"border": null,
|
1624 |
-
"bottom": null,
|
1625 |
-
"display": null,
|
1626 |
-
"flex": null,
|
1627 |
-
"flex_flow": null,
|
1628 |
-
"grid_area": null,
|
1629 |
-
"grid_auto_columns": null,
|
1630 |
-
"grid_auto_flow": null,
|
1631 |
-
"grid_auto_rows": null,
|
1632 |
-
"grid_column": null,
|
1633 |
-
"grid_gap": null,
|
1634 |
-
"grid_row": null,
|
1635 |
-
"grid_template_areas": null,
|
1636 |
-
"grid_template_columns": null,
|
1637 |
-
"grid_template_rows": null,
|
1638 |
-
"height": null,
|
1639 |
-
"justify_content": null,
|
1640 |
-
"justify_items": null,
|
1641 |
-
"left": null,
|
1642 |
-
"margin": null,
|
1643 |
-
"max_height": null,
|
1644 |
-
"max_width": null,
|
1645 |
-
"min_height": null,
|
1646 |
-
"min_width": null,
|
1647 |
-
"object_fit": null,
|
1648 |
-
"object_position": null,
|
1649 |
-
"order": null,
|
1650 |
-
"overflow": null,
|
1651 |
-
"overflow_x": null,
|
1652 |
-
"overflow_y": null,
|
1653 |
-
"padding": null,
|
1654 |
-
"right": null,
|
1655 |
-
"top": null,
|
1656 |
-
"visibility": null,
|
1657 |
-
"width": null
|
1658 |
-
}
|
1659 |
-
},
|
1660 |
-
"d1cc3d09c0d441d780a4acbf4a402094": {
|
1661 |
-
"model_module": "@jupyter-widgets/controls",
|
1662 |
-
"model_name": "DescriptionStyleModel",
|
1663 |
-
"model_module_version": "1.5.0",
|
1664 |
-
"state": {
|
1665 |
-
"_model_module": "@jupyter-widgets/controls",
|
1666 |
-
"_model_module_version": "1.5.0",
|
1667 |
-
"_model_name": "DescriptionStyleModel",
|
1668 |
-
"_view_count": null,
|
1669 |
-
"_view_module": "@jupyter-widgets/base",
|
1670 |
-
"_view_module_version": "1.2.0",
|
1671 |
-
"_view_name": "StyleView",
|
1672 |
-
"description_width": ""
|
1673 |
-
}
|
1674 |
-
},
|
1675 |
-
"aec5e61cc1524d5dae60f735b906a3c0": {
|
1676 |
-
"model_module": "@jupyter-widgets/base",
|
1677 |
-
"model_name": "LayoutModel",
|
1678 |
-
"model_module_version": "1.2.0",
|
1679 |
-
"state": {
|
1680 |
-
"_model_module": "@jupyter-widgets/base",
|
1681 |
-
"_model_module_version": "1.2.0",
|
1682 |
-
"_model_name": "LayoutModel",
|
1683 |
-
"_view_count": null,
|
1684 |
-
"_view_module": "@jupyter-widgets/base",
|
1685 |
-
"_view_module_version": "1.2.0",
|
1686 |
-
"_view_name": "LayoutView",
|
1687 |
-
"align_content": null,
|
1688 |
-
"align_items": null,
|
1689 |
-
"align_self": null,
|
1690 |
-
"border": null,
|
1691 |
-
"bottom": null,
|
1692 |
-
"display": null,
|
1693 |
-
"flex": null,
|
1694 |
-
"flex_flow": null,
|
1695 |
-
"grid_area": null,
|
1696 |
-
"grid_auto_columns": null,
|
1697 |
-
"grid_auto_flow": null,
|
1698 |
-
"grid_auto_rows": null,
|
1699 |
-
"grid_column": null,
|
1700 |
-
"grid_gap": null,
|
1701 |
-
"grid_row": null,
|
1702 |
-
"grid_template_areas": null,
|
1703 |
-
"grid_template_columns": null,
|
1704 |
-
"grid_template_rows": null,
|
1705 |
-
"height": null,
|
1706 |
-
"justify_content": null,
|
1707 |
-
"justify_items": null,
|
1708 |
-
"left": null,
|
1709 |
-
"margin": null,
|
1710 |
-
"max_height": null,
|
1711 |
-
"max_width": null,
|
1712 |
-
"min_height": null,
|
1713 |
-
"min_width": null,
|
1714 |
-
"object_fit": null,
|
1715 |
-
"object_position": null,
|
1716 |
-
"order": null,
|
1717 |
-
"overflow": null,
|
1718 |
-
"overflow_x": null,
|
1719 |
-
"overflow_y": null,
|
1720 |
-
"padding": null,
|
1721 |
-
"right": null,
|
1722 |
-
"top": null,
|
1723 |
-
"visibility": null,
|
1724 |
-
"width": null
|
1725 |
-
}
|
1726 |
-
},
|
1727 |
-
"cb955b6cb2854c6ba28be277be1dbe57": {
|
1728 |
-
"model_module": "@jupyter-widgets/controls",
|
1729 |
-
"model_name": "DescriptionStyleModel",
|
1730 |
-
"model_module_version": "1.5.0",
|
1731 |
-
"state": {
|
1732 |
-
"_model_module": "@jupyter-widgets/controls",
|
1733 |
-
"_model_module_version": "1.5.0",
|
1734 |
-
"_model_name": "DescriptionStyleModel",
|
1735 |
-
"_view_count": null,
|
1736 |
-
"_view_module": "@jupyter-widgets/base",
|
1737 |
-
"_view_module_version": "1.2.0",
|
1738 |
-
"_view_name": "StyleView",
|
1739 |
-
"description_width": ""
|
1740 |
-
}
|
1741 |
-
},
|
1742 |
-
"22f406e10d0a4cbabe6ffefd37f9791c": {
|
1743 |
-
"model_module": "@jupyter-widgets/base",
|
1744 |
-
"model_name": "LayoutModel",
|
1745 |
-
"model_module_version": "1.2.0",
|
1746 |
-
"state": {
|
1747 |
-
"_model_module": "@jupyter-widgets/base",
|
1748 |
-
"_model_module_version": "1.2.0",
|
1749 |
-
"_model_name": "LayoutModel",
|
1750 |
-
"_view_count": null,
|
1751 |
-
"_view_module": "@jupyter-widgets/base",
|
1752 |
-
"_view_module_version": "1.2.0",
|
1753 |
-
"_view_name": "LayoutView",
|
1754 |
-
"align_content": null,
|
1755 |
-
"align_items": null,
|
1756 |
-
"align_self": null,
|
1757 |
-
"border": null,
|
1758 |
-
"bottom": null,
|
1759 |
-
"display": null,
|
1760 |
-
"flex": null,
|
1761 |
-
"flex_flow": null,
|
1762 |
-
"grid_area": null,
|
1763 |
-
"grid_auto_columns": null,
|
1764 |
-
"grid_auto_flow": null,
|
1765 |
-
"grid_auto_rows": null,
|
1766 |
-
"grid_column": null,
|
1767 |
-
"grid_gap": null,
|
1768 |
-
"grid_row": null,
|
1769 |
-
"grid_template_areas": null,
|
1770 |
-
"grid_template_columns": null,
|
1771 |
-
"grid_template_rows": null,
|
1772 |
-
"height": null,
|
1773 |
-
"justify_content": null,
|
1774 |
-
"justify_items": null,
|
1775 |
-
"left": null,
|
1776 |
-
"margin": null,
|
1777 |
-
"max_height": null,
|
1778 |
-
"max_width": null,
|
1779 |
-
"min_height": null,
|
1780 |
-
"min_width": null,
|
1781 |
-
"object_fit": null,
|
1782 |
-
"object_position": null,
|
1783 |
-
"order": null,
|
1784 |
-
"overflow": null,
|
1785 |
-
"overflow_x": null,
|
1786 |
-
"overflow_y": null,
|
1787 |
-
"padding": null,
|
1788 |
-
"right": null,
|
1789 |
-
"top": null,
|
1790 |
-
"visibility": null,
|
1791 |
-
"width": null
|
1792 |
-
}
|
1793 |
-
},
|
1794 |
-
"523f9443764a460cb2ea30897480da5c": {
|
1795 |
-
"model_module": "@jupyter-widgets/controls",
|
1796 |
-
"model_name": "DescriptionStyleModel",
|
1797 |
-
"model_module_version": "1.5.0",
|
1798 |
-
"state": {
|
1799 |
-
"_model_module": "@jupyter-widgets/controls",
|
1800 |
-
"_model_module_version": "1.5.0",
|
1801 |
-
"_model_name": "DescriptionStyleModel",
|
1802 |
-
"_view_count": null,
|
1803 |
-
"_view_module": "@jupyter-widgets/base",
|
1804 |
-
"_view_module_version": "1.2.0",
|
1805 |
-
"_view_name": "StyleView",
|
1806 |
-
"description_width": ""
|
1807 |
-
}
|
1808 |
-
}
|
1809 |
-
}
|
1810 |
-
}
|
1811 |
-
},
|
1812 |
-
"nbformat": 4,
|
1813 |
-
"nbformat_minor": 0
|
1814 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.py
CHANGED
@@ -1,7 +1,101 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
iface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import os
|
3 |
+
import openai
|
4 |
|
|
|
|
|
5 |
|
6 |
+
openai.api_key = os.environ['OPENAI_API_KEY']
|
7 |
+
|
8 |
+
from langchain.chat_models import ChatOpenAI
|
9 |
+
from langchain.schema import HumanMessage
|
10 |
+
|
11 |
+
|
12 |
+
from langchain.prompts.chat import (
|
13 |
+
ChatPromptTemplate,
|
14 |
+
SystemMessagePromptTemplate,
|
15 |
+
HumanMessagePromptTemplate
|
16 |
+
)
|
17 |
+
|
18 |
+
from langchain.schema import (
|
19 |
+
AIMessage,
|
20 |
+
HumanMessage,
|
21 |
+
SystemMessage
|
22 |
+
)
|
23 |
+
|
24 |
+
from langchain.chains import LLMChain
|
25 |
+
|
26 |
+
from langchain.text_splitter import CharacterTextSplitter
|
27 |
+
|
28 |
+
from langchain.embeddings.openai import OpenAIEmbeddings
|
29 |
+
|
30 |
+
from langchain.vectorstores import Chroma
|
31 |
+
|
32 |
+
from langchain.chains.question_answering import load_qa_chain
|
33 |
+
|
34 |
+
from langchain.llms import OpenAI
|
35 |
+
|
36 |
+
chat_model = ChatOpenAI(model_name="gpt-3.5-turbo")
|
37 |
+
|
38 |
+
# The SystemMessage is associated with the system role
|
39 |
+
system_message = SystemMessage(content="You are a food critic.")
|
40 |
+
|
41 |
+
# The HumanMessage is associated with the user role
|
42 |
+
user_message = HumanMessage(content="Do you think Kraft Dinner constitues fine dining?")
|
43 |
+
|
44 |
+
# The AIMessage is associated with the assistant role
|
45 |
+
assistant_message = AIMessage(content="Egads! No, it most certainly does not!")
|
46 |
+
|
47 |
+
|
48 |
+
isecond_user_message = HumanMessage(content="What about Red Lobster, surely that is fine dining!")
|
49 |
+
|
50 |
+
# create the list of prompts
|
51 |
+
list_of_prompts = [
|
52 |
+
system_message,
|
53 |
+
user_message,
|
54 |
+
assistant_message,
|
55 |
+
second_user_message
|
56 |
+
]
|
57 |
+
|
58 |
+
# we can just call our chat_model on the list of prompts!
|
59 |
+
chat_model(list_of_prompts)
|
60 |
+
|
61 |
+
|
62 |
+
# we can signify variables we want access to by wrapping them in {}
|
63 |
+
system_prompt_template = "You are an expert in {SUBJECT}, and you're currently feeling {MOOD}"
|
64 |
+
system_prompt_template = SystemMessagePromptTemplate.from_template(system_prompt_template)
|
65 |
+
|
66 |
+
user_prompt_template = "{CONTENT}"
|
67 |
+
user_prompt_template = HumanMessagePromptTemplate.from_template(user_prompt_template)
|
68 |
+
|
69 |
+
# put them together into a ChatPromptTemplate
|
70 |
+
chat_prompt = ChatPromptTemplate.from_messages([system_prompt_template, user_prompt_template])
|
71 |
+
|
72 |
+
|
73 |
+
chain = LLMChain(llm=chat_model, prompt=chat_prompt)
|
74 |
+
|
75 |
+
with open("guide1.txt") as f:
|
76 |
+
hitchhikersguide = f.read()
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
text_splitter = CharacterTextSplitter(
|
81 |
+
separator = "\n",
|
82 |
+
chunk_size = 1000,
|
83 |
+
chunk_overlap=0,
|
84 |
+
length_function = len,
|
85 |
+
)
|
86 |
+
|
87 |
+
texts = text_splitter.split_text(hitchhikersguide)
|
88 |
+
|
89 |
+
embeddings = OpenAIEmbeddings()
|
90 |
+
|
91 |
+
docsearch = Chroma.from_texts(texts, embeddings, metadatas=[{"source": str(i)} for i in range(len(texts))]).as_retriever()
|
92 |
+
|
93 |
+
|
94 |
+
chain = load_qa_chain(OpenAI(temperature=0), chain_type="stuff")
|
95 |
+
|
96 |
+
def query(query):
|
97 |
+
return chain.run(input_documents=docs, question=query)
|
98 |
+
|
99 |
+
|
100 |
+
iface = gr.Interface(fn=query, inputs="text", outputs="text")
|
101 |
iface.launch()
|
requirements.txt
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
openai
|
2 |
langchain
|
3 |
openai
|
4 |
-
|
|
|
|
1 |
openai
|
2 |
langchain
|
3 |
openai
|
4 |
+
chromadb
|
5 |
+
tiktoken
|