AlaFalaki commited on
Commit
4dcbb03
β€’
1 Parent(s): aeeba33

Created using Colab

Browse files
notebooks/Larger_Context_Larger_N.ipynb CHANGED
@@ -4,7 +4,7 @@
4
  "metadata": {
5
  "colab": {
6
  "provenance": [],
7
- "authorship_tag": "ABX9TyOywIfWGtoPk+CbHWvxkiSH",
8
  "include_colab_link": true
9
  },
10
  "kernelspec": {
@@ -37,11 +37,67 @@
37
  },
38
  {
39
  "cell_type": "code",
40
- "execution_count": null,
41
  "metadata": {
42
- "id": "I-hKKV6GEkro"
 
 
 
 
43
  },
44
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  "source": [
46
  "!pip install -q llama-index==0.10.37 openai==1.30.1 tiktoken==0.7.0 chromadb==0.5.0 llama-index-llms-gemini==0.1.10 llama-index-vector-stores-chroma==0.1.7"
47
  ]
@@ -58,7 +114,7 @@
58
  "metadata": {
59
  "id": "5UZDtKWJWZ3c"
60
  },
61
- "execution_count": null,
62
  "outputs": []
63
  },
64
  {
@@ -80,7 +136,7 @@
80
  "metadata": {
81
  "id": "dFvjEffurv6T"
82
  },
83
- "execution_count": null,
84
  "outputs": []
85
  },
86
  {
@@ -102,29 +158,29 @@
102
  "base_uri": "https://localhost:8080/"
103
  },
104
  "id": "_oi1avNUhhYd",
105
- "outputId": "f1c3c907-d4fe-47a6-bcc8-b2d09b54317c"
106
  },
107
- "execution_count": null,
108
  "outputs": [
109
  {
110
  "output_type": "stream",
111
  "name": "stdout",
112
  "text": [
113
- "--2024-06-05 18:22:24-- https://github.com/AlaFalaki/tutorial_notebooks/raw/main/data/vectorstore.zip\n",
114
- "Resolving github.com (github.com)... 140.82.121.3\n",
115
- "Connecting to github.com (github.com)|140.82.121.3|:443... connected.\n",
116
  "HTTP request sent, awaiting response... 302 Found\n",
117
  "Location: https://raw.githubusercontent.com/AlaFalaki/tutorial_notebooks/main/data/vectorstore.zip [following]\n",
118
- "--2024-06-05 18:22:24-- https://raw.githubusercontent.com/AlaFalaki/tutorial_notebooks/main/data/vectorstore.zip\n",
119
- "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.111.133, 185.199.109.133, 185.199.110.133, ...\n",
120
- "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected.\n",
121
  "HTTP request sent, awaiting response... 200 OK\n",
122
  "Length: 1479982 (1.4M) [application/zip]\n",
123
  "Saving to: β€˜vectorstore.zip’\n",
124
  "\n",
125
- "vectorstore.zip 100%[===================>] 1.41M --.-KB/s in 0.03s \n",
126
  "\n",
127
- "2024-06-05 18:22:24 (54.1 MB/s) - β€˜vectorstore.zip’ saved [1479982/1479982]\n",
128
  "\n"
129
  ]
130
  }
@@ -140,9 +196,9 @@
140
  "base_uri": "https://localhost:8080/"
141
  },
142
  "id": "8BM4sU-bWZ0l",
143
- "outputId": "6aa613b0-9f4f-4873-eb02-f1d9566ebeb8"
144
  },
145
- "execution_count": null,
146
  "outputs": [
147
  {
148
  "output_type": "stream",
@@ -174,7 +230,7 @@
174
  "metadata": {
175
  "id": "VikY0MnrWZyC"
176
  },
177
- "execution_count": null,
178
  "outputs": []
179
  },
180
  {
@@ -188,85 +244,61 @@
188
  "metadata": {
189
  "id": "o87JiKrUWZvG"
190
  },
191
- "execution_count": null,
192
  "outputs": []
193
  },
194
  {
195
  "cell_type": "code",
196
  "source": [
197
- "query_engine = index.as_query_engine()\n",
198
  "\n",
199
- "res = query_engine.query(\"How many parameters LLaMA2 model has?\")"
200
- ],
201
- "metadata": {
202
- "id": "-H8c-pUpqu7W"
203
- },
204
- "execution_count": null,
205
- "outputs": []
206
- },
207
- {
208
- "cell_type": "code",
209
- "source": [
210
- "res.response"
211
- ],
212
- "metadata": {
213
- "colab": {
214
- "base_uri": "https://localhost:8080/",
215
- "height": 35
216
- },
217
- "id": "Cg36kDnZvuX0",
218
- "outputId": "7c36f9a1-fbb8-4531-c976-75de9ff89ec6"
219
- },
220
- "execution_count": null,
221
- "outputs": [
222
- {
223
- "output_type": "execute_result",
224
- "data": {
225
- "text/plain": [
226
- "'The Llama 2 model has four different model sizes: 7 billion, 13 billion, 34 billion, and 70 billion parameters.'"
227
- ],
228
- "application/vnd.google.colaboratory.intrinsic+json": {
229
- "type": "string"
230
- }
231
- },
232
- "metadata": {},
233
- "execution_count": 66
234
- }
235
- ]
236
- },
237
- {
238
- "cell_type": "code",
239
- "source": [
240
- "# Show the retrieved nodes\n",
241
- "for src in res.source_nodes:\n",
242
- " print(\"Node ID\\t\", src.node_id)\n",
243
- " print(\"Title\\t\", src.metadata['title'])\n",
244
- " print(\"Text\\t\", src.text)\n",
245
- " print(\"Score\\t\", src.score)\n",
246
  " print(\"-_\"*20)"
247
  ],
248
  "metadata": {
 
249
  "colab": {
250
  "base_uri": "https://localhost:8080/"
251
  },
252
- "id": "-b1dQAQkrL4X",
253
- "outputId": "7a2c99f1-3b0a-4635-e866-842f4ebc7b35"
254
  },
255
- "execution_count": null,
256
  "outputs": [
257
  {
258
  "output_type": "stream",
259
  "name": "stdout",
260
  "text": [
261
- "Node ID\t d6f533e5-fef8-469c-a313-def19fd38efe\n",
262
- "Title\t Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\n",
263
- "Text\t I. Llama 2: Revolutionizing Commercial Use Unlike its predecessor Llama 1, which was limited to research use, Llama 2 represents a major advancement as an open-source commercial model. Businesses can now integrate Llama 2 into products to create AI-powered applications. Availability on Azure and AWS facilitates fine-tuning and adoption. However, restrictions apply to prevent exploitation. Companies with over 700 million active daily users cannot use Llama 2. Additionally, its output cannot be used to improve other language models. II. Llama 2 Model Flavors Llama 2 is available in four different model sizes: 7 billion, 13 billion, 34 billion, and 70 billion parameters. While 7B, 13B, and 70B have already been released, the 34B model is still awaited. The pretrained variant, trained on a whopping 2 trillion tokens, boasts a context window of 4096 tokens, twice the size of its predecessor Llama 1. Meta also released a Llama 2 fine-tuned model for chat applications that was trained on over 1 million human annotations. Such extensive training comes at a cost, with the 70B model taking a staggering 1720320 GPU hours to train. The context window's length determines the amount of content the model can process at once, making Llama 2 a powerful language model in terms of scale and efficiency. III. Safety Considerations: A Top Priority for Meta Meta's commitment to safety and alignment shines through in Llama 2's design. The model demonstrates exceptionally low AI safety violation percentages, surpassing even ChatGPT in safety benchmarks. Finding the right balance between helpfulness and safety when optimizing a model poses significant challenges. While a highly helpful model may be capable of answering any question, including sensitive ones like \"How do I build a bomb?\", it also raises concerns about potential misuse. Thus, striking the perfect equilibrium between providing useful information and ensuring safety is paramount. However, prioritizing safety to an extreme extent can lead to a model that struggles to effectively address a diverse range of questions. This limitation could hinder the model's practical applicability and user experience. Thus, achieving\n",
264
- "Score\t 0.7078549032318474\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
  "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
266
- "Node ID\t 2f3b7c34-8fd0-4134-af38-ef1b77e32cd8\n",
267
- "Title\t Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\n",
268
- "Text\t The model demonstrates exceptionally low AI safety violation percentages, surpassing even ChatGPT in safety benchmarks. Finding the right balance between helpfulness and safety when optimizing a model poses significant challenges. While a highly helpful model may be capable of answering any question, including sensitive ones like \"How do I build a bomb?\", it also raises concerns about potential misuse. Thus, striking the perfect equilibrium between providing useful information and ensuring safety is paramount. However, prioritizing safety to an extreme extent can lead to a model that struggles to effectively address a diverse range of questions. This limitation could hinder the model's practical applicability and user experience. Thus, achieving an optimum balance that allows the model to be both helpful and safe is of utmost importance. To strike the right balance between helpfulness and safety, Meta employed two reward models - one for helpfulness and another for safety - to optimize the model's responses. The 34B parameter model has reported higher safety violations than other variants, possibly contributing to the delay in its release. IV. Helpfulness Comparison: Llama 2 Outperforms Competitors Llama 2 emerges as a strong contender in the open-source language model arena, outperforming its competitors in most categories. The 70B parameter model outperforms all other open-source models, while the 7B and 34B models outshine Falcon in all categories and MPT in all categories except coding. Despite being smaller, Llam a2's performance rivals that of Chat GPT 3.5, a significantly larger closed-source model. While GPT 4 and PalM-2-L, with their larger size, outperform Llama 2, this is expected due to their capacity for handling complex language tasks. Llama 2's impressive ability to compete with larger models highlights its efficiency and potential in the market. However, Llama 2 does face challenges in coding and math problems, where models like Chat GPT 4 excel, given their significantly larger size. Chat GPT 4 performed significantly better than Llama 2 for coding (HumanEval benchmark)and math problem tasks (GSM8k benchmark). Open-source AI technologies, like Llama 2, continue to advance, offering\n",
269
- "Score\t 0.7026792232112851\n",
270
  "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n"
271
  ]
272
  }
 
4
  "metadata": {
5
  "colab": {
6
  "provenance": [],
7
+ "authorship_tag": "ABX9TyO54/MUoEirbXFWGbR7On3U",
8
  "include_colab_link": true
9
  },
10
  "kernelspec": {
 
37
  },
38
  {
39
  "cell_type": "code",
40
+ "execution_count": 1,
41
  "metadata": {
42
+ "id": "I-hKKV6GEkro",
43
+ "colab": {
44
+ "base_uri": "https://localhost:8080/"
45
+ },
46
+ "outputId": "ae3ff694-3b58-427f-f0c9-29e855c4efca"
47
  },
48
+ "outputs": [
49
+ {
50
+ "output_type": "stream",
51
+ "name": "stdout",
52
+ "text": [
53
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m320.6/320.6 kB\u001b[0m \u001b[31m3.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
54
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m8.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
55
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m526.8/526.8 kB\u001b[0m \u001b[31m10.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
56
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m15.4/15.4 MB\u001b[0m \u001b[31m20.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
57
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.0/2.0 MB\u001b[0m \u001b[31m26.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
58
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.6/75.6 kB\u001b[0m \u001b[31m5.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
59
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.4/2.4 MB\u001b[0m \u001b[31m20.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
60
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m92.0/92.0 kB\u001b[0m \u001b[31m6.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
61
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m62.4/62.4 kB\u001b[0m \u001b[31m3.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
62
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m41.3/41.3 kB\u001b[0m \u001b[31m2.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
63
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.8/6.8 MB\u001b[0m \u001b[31m40.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
64
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m59.9/59.9 kB\u001b[0m \u001b[31m4.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
65
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m107.0/107.0 kB\u001b[0m \u001b[31m7.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
66
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.3/67.3 kB\u001b[0m \u001b[31m4.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
67
+ "\u001b[?25h Installing build dependencies ... \u001b[?25l\u001b[?25hdone\n",
68
+ " Getting requirements to build wheel ... \u001b[?25l\u001b[?25hdone\n",
69
+ " Preparing metadata (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
70
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m283.7/283.7 kB\u001b[0m \u001b[31m14.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
71
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━���\u001b[0m \u001b[32m1.7/1.7 MB\u001b[0m \u001b[31m56.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
72
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.6/67.6 kB\u001b[0m \u001b[31m7.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
73
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m142.5/142.5 kB\u001b[0m \u001b[31m2.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
74
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4.5/4.5 MB\u001b[0m \u001b[31m54.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
75
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m71.9/71.9 kB\u001b[0m \u001b[31m6.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
76
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m53.6/53.6 kB\u001b[0m \u001b[31m5.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
77
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m77.9/77.9 kB\u001b[0m \u001b[31m9.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
78
+ "\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",
79
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m141.9/141.9 kB\u001b[0m \u001b[31m14.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
80
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m290.4/290.4 kB\u001b[0m \u001b[31m27.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
81
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m46.0/46.0 kB\u001b[0m \u001b[31m5.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
82
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m52.5/52.5 kB\u001b[0m \u001b[31m4.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
83
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m130.5/130.5 kB\u001b[0m \u001b[31m14.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
84
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m341.4/341.4 kB\u001b[0m \u001b[31m26.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
85
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m3.4/3.4 MB\u001b[0m \u001b[31m67.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
86
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.2/1.2 MB\u001b[0m \u001b[31m59.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
87
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m130.2/130.2 kB\u001b[0m \u001b[31m14.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
88
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m307.7/307.7 kB\u001b[0m \u001b[31m22.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
89
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m47.2/47.2 kB\u001b[0m \u001b[31m5.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
90
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m86.8/86.8 kB\u001b[0m \u001b[31m8.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
91
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.2/49.2 kB\u001b[0m \u001b[31m5.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
92
+ "\u001b[?25h Building wheel for pypika (pyproject.toml) ... \u001b[?25l\u001b[?25hdone\n",
93
+ "\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",
94
+ "imageio 2.31.6 requires pillow<10.1.0,>=8.3.2, but you have pillow 10.3.0 which is incompatible.\n",
95
+ "spacy 3.7.4 requires typer<0.10.0,>=0.3.0, but you have typer 0.12.3 which is incompatible.\n",
96
+ "weasel 0.3.4 requires typer<0.10.0,>=0.3.0, but you have typer 0.12.3 which is incompatible.\u001b[0m\u001b[31m\n",
97
+ "\u001b[0m"
98
+ ]
99
+ }
100
+ ],
101
  "source": [
102
  "!pip install -q llama-index==0.10.37 openai==1.30.1 tiktoken==0.7.0 chromadb==0.5.0 llama-index-llms-gemini==0.1.10 llama-index-vector-stores-chroma==0.1.7"
103
  ]
 
114
  "metadata": {
115
  "id": "5UZDtKWJWZ3c"
116
  },
117
+ "execution_count": 3,
118
  "outputs": []
119
  },
120
  {
 
136
  "metadata": {
137
  "id": "dFvjEffurv6T"
138
  },
139
+ "execution_count": 4,
140
  "outputs": []
141
  },
142
  {
 
158
  "base_uri": "https://localhost:8080/"
159
  },
160
  "id": "_oi1avNUhhYd",
161
+ "outputId": "4e4bd6d7-884d-43a3-d322-9e979114860e"
162
  },
163
+ "execution_count": 5,
164
  "outputs": [
165
  {
166
  "output_type": "stream",
167
  "name": "stdout",
168
  "text": [
169
+ "--2024-06-07 16:54:00-- https://github.com/AlaFalaki/tutorial_notebooks/raw/main/data/vectorstore.zip\n",
170
+ "Resolving github.com (github.com)... 140.82.114.4\n",
171
+ "Connecting to github.com (github.com)|140.82.114.4|:443... connected.\n",
172
  "HTTP request sent, awaiting response... 302 Found\n",
173
  "Location: https://raw.githubusercontent.com/AlaFalaki/tutorial_notebooks/main/data/vectorstore.zip [following]\n",
174
+ "--2024-06-07 16:54:01-- https://raw.githubusercontent.com/AlaFalaki/tutorial_notebooks/main/data/vectorstore.zip\n",
175
+ "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.109.133, 185.199.110.133, 185.199.111.133, ...\n",
176
+ "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.109.133|:443... connected.\n",
177
  "HTTP request sent, awaiting response... 200 OK\n",
178
  "Length: 1479982 (1.4M) [application/zip]\n",
179
  "Saving to: β€˜vectorstore.zip’\n",
180
  "\n",
181
+ "vectorstore.zip 100%[===================>] 1.41M --.-KB/s in 0.07s \n",
182
  "\n",
183
+ "2024-06-07 16:54:01 (21.4 MB/s) - β€˜vectorstore.zip’ saved [1479982/1479982]\n",
184
  "\n"
185
  ]
186
  }
 
196
  "base_uri": "https://localhost:8080/"
197
  },
198
  "id": "8BM4sU-bWZ0l",
199
+ "outputId": "2dcb0bdc-d9ca-451f-cdb6-fa04c64ddb8d"
200
  },
201
+ "execution_count": 6,
202
  "outputs": [
203
  {
204
  "output_type": "stream",
 
230
  "metadata": {
231
  "id": "VikY0MnrWZyC"
232
  },
233
+ "execution_count": 7,
234
  "outputs": []
235
  },
236
  {
 
244
  "metadata": {
245
  "id": "o87JiKrUWZvG"
246
  },
247
+ "execution_count": 8,
248
  "outputs": []
249
  },
250
  {
251
  "cell_type": "code",
252
  "source": [
253
+ "for i in [2, 4, 6, 8, 10, 15, 20, 25, 30]:\n",
254
  "\n",
255
+ " query_engine = index.as_query_engine(similarity_top_k=i)\n",
256
+ "\n",
257
+ " res = query_engine.query(\"How many parameters LLaMA2 model has?\")\n",
258
+ "\n",
259
+ " print(f\"top_{i} results:\")\n",
260
+ " print(\"\\t\", res.response)\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  " print(\"-_\"*20)"
262
  ],
263
  "metadata": {
264
+ "id": "-H8c-pUpqu7W",
265
  "colab": {
266
  "base_uri": "https://localhost:8080/"
267
  },
268
+ "outputId": "0b7f036b-f70e-40cd-92f5-4027fbd51fa3"
 
269
  },
270
+ "execution_count": 9,
271
  "outputs": [
272
  {
273
  "output_type": "stream",
274
  "name": "stdout",
275
  "text": [
276
+ "top_2 results:\n",
277
+ "\t The Llama 2 model is available in four different sizes: 7 billion, 13 billion, 34 billion, and 70 billion parameters.\n",
278
+ "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
279
+ "top_4 results:\n",
280
+ "\t The Llama 2 model is available in four different sizes: 7 billion, 13 billion, 34 billion, and 70 billion parameters.\n",
281
+ "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
282
+ "top_6 results:\n",
283
+ "\t The Llama 2 model comes in four different sizes with varying parameter counts: 7 billion, 13 billion, 34 billion, and 70 billion parameters.\n",
284
+ "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
285
+ "top_8 results:\n",
286
+ "\t The LLaMA2 model has parameter sizes of 7 billion, 13 billion, 34 billion, and 70 billion.\n",
287
+ "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
288
+ "top_10 results:\n",
289
+ "\t The LLaMA2 model has four different sizes of parameters: 7 billion, 13 billion, 34 billion, and 70 billion.\n",
290
+ "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
291
+ "top_15 results:\n",
292
+ "\t The LLaMA2 model has 7 billion parameters.\n",
293
+ "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
294
+ "top_20 results:\n",
295
+ "\t The LLaMA2 model has 7 billion parameters.\n",
296
+ "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
297
+ "top_25 results:\n",
298
+ "\t The LLaMA2 model has 7 billion parameters.\n",
299
  "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
300
+ "top_30 results:\n",
301
+ "\t The LLaMA2 model has 7 billion parameters.\n",
 
 
302
  "-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n"
303
  ]
304
  }