Spaces:
Sleeping
Sleeping
File size: 95,515 Bytes
5d7ba1e b425c81 8f4d593 b425c81 755b36e b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 a393007 b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 755b36e b425c81 755b36e b425c81 08b8fbf b425c81 8f4d593 b425c81 08b8fbf b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 08b8fbf b425c81 8f4d593 b425c81 08b8fbf b425c81 08b8fbf b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 5d7ba1e b425c81 5d7ba1e b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 5d7ba1e b425c81 08b8fbf 5d7ba1e b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 08b8fbf b425c81 08b8fbf b425c81 5d7ba1e b425c81 5d7ba1e b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 a393007 b425c81 8f4d593 b425c81 08b8fbf b425c81 8f4d593 b425c81 08b8fbf b425c81 08b8fbf b425c81 5d7ba1e b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 08b8fbf b425c81 8f4d593 b425c81 08b8fbf b425c81 755b36e b425c81 08b8fbf 8f4d593 08b8fbf 8f4d593 08b8fbf b425c81 8f4d593 b425c81 8f4d593 b425c81 8f4d593 b425c81 8f4d593 b425c81 8f4d593 b425c81 08b8fbf b425c81 a393007 b425c81 755b36e b425c81 5d7ba1e b425c81 755b36e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 5d7ba1e b425c81 755b36e b425c81 5d7ba1e b425c81 5d7ba1e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "view-in-github"
},
"source": [
"<a href=\"https://colab.research.google.com/github/towardsai/ai-tutor-rag-system/blob/main/notebooks/05-Improve_Prompts_%2B_Add_Source.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "5BGJ3fxhOk2V"
},
"source": [
"# Install Packages and Setup Variables"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "QPJzr-I9XQ7l",
"outputId": "809b17a0-5b45-4e3c-9d3f-72ad8b0e0d9d"
},
"outputs": [],
"source": [
"!pip install -q llama-index==0.10.9 openai==1.12.0 cohere==4.47 tiktoken==0.6.0 chromadb==0.4.22"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"id": "riuXwpSPcvWC"
},
"outputs": [],
"source": [
"import os\n",
"\n",
"# Set the \"OPENAI_API_KEY\" in the Python environment. Will be used by OpenAI client later.\n",
"os.environ[\"OPENAI_API_KEY\"] = \"<YOUR_OPENAI_KEY>\""
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"id": "km-KQOrgr3VB"
},
"outputs": [],
"source": [
"# Allows running asyncio in environments with an existing event loop, like Jupyter notebooks.\n",
"\n",
"import nest_asyncio\n",
"\n",
"nest_asyncio.apply()"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "Bkgi2OrYzF7q"
},
"source": [
"# Load a Model"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"id": "9oGT6crooSSj"
},
"outputs": [],
"source": [
"from llama_index.llms.openai import OpenAI\n",
"\n",
"llm = OpenAI(temperature=0.9, model=\"gpt-3.5-turbo-0125\", max_tokens=512)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "0BwVuJXlzHVL"
},
"source": [
"# Create a VectoreStore"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"id": "SQP87lHczHKc"
},
"outputs": [],
"source": [
"import chromadb\n",
"\n",
"# create client and a new collection\n",
"# chromadb.EphemeralClient saves data in-memory.\n",
"chroma_client = chromadb.PersistentClient(path=\"./mini-llama-articles\")\n",
"chroma_collection = chroma_client.create_collection(\"mini-llama-articles\")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"id": "zAaGcYMJzHAN"
},
"outputs": [],
"source": [
"from llama_index.vector_stores.chroma import ChromaVectorStore\n",
"\n",
"# Define a storage context object using the created vector database.\n",
"vector_store = ChromaVectorStore(chroma_collection=chroma_collection)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "I9JbAzFcjkpn"
},
"source": [
"# Load the Dataset (CSV)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "_Tif8-JoRH68"
},
"source": [
"## Download"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "4fQaa1LN1mXL"
},
"source": [
"The dataset includes several articles from the TowardsAI blog, which provide an in-depth explanation of the LLaMA2 model."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "fQtpDvUzKNzI",
"outputId": "f170fb33-8edc-4993-8025-b2bc5c0d0e99"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" % Total % Received % Xferd Average Speed Time Time Time Current\n",
" Dload Upload Total Spent Left Speed\n",
"100 169k 100 169k 0 0 743k 0 --:--:-- --:--:-- --:--:-- 743k\n"
]
}
],
"source": [
"!curl -o ./mini-dataset.csv https://raw.githubusercontent.com/AlaFalaki/tutorial_notebooks/main/data/mini-llama-articles.csv"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "zk-4alIxROo8"
},
"source": [
"## Load the Articles"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "_WER5lt0N7c5",
"outputId": "521f21f1-c84d-4e1b-9983-8ea17e80ea6c"
},
"outputs": [
{
"data": {
"text/plain": [
"14"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import csv\n",
"\n",
"rows = []\n",
"\n",
"# Load the file as a JSON\n",
"with open(\"./mini-dataset.csv\", mode=\"r\", encoding=\"utf-8\") as file:\n",
" csv_reader = csv.reader(file)\n",
"\n",
" for idx, row in enumerate(csv_reader):\n",
" if idx == 0:\n",
" continue\n",
" # Skip header row\n",
" rows.append(row)\n",
"\n",
"# The number of characters in the dataset.\n",
"len(rows)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "wxEStggPdxYs"
},
"source": [
"# Convert to Document obj"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"id": "lFvW_886dxKX"
},
"outputs": [],
"source": [
"from llama_index.core import Document\n",
"from llama_index.core.schema import TextNode\n",
"\n",
"# Convert the chunks to Document objects so the LlamaIndex framework can process them.\n",
"documents = [\n",
" Document(\n",
" text=row[1], metadata={\"title\": row[0], \"url\": row[2], \"source_name\": row[3]}, \n",
" )\n",
" for row in rows\n",
"]\n",
"# By default, the node/chunks ids are set to random uuids. To ensure same id's per run, we manually set them.\n",
"for idx, doc in enumerate(documents):\n",
" doc.id_ = f\"doc_{idx}\""
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Njoc3XEVkKkf",
"outputId": "8dec6077-4301-44ed-ad9b-95d943e00af6"
},
"outputs": [
{
"data": {
"text/plain": [
"Document(id_='doc_0', embedding=None, metadata={'title': \"Beyond GPT-4: What's New?\", 'url': 'https://pub.towardsai.net/beyond-gpt-4-whats-new-cbd61a448eb9#dda8', 'source_name': 'towards_ai'}, excluded_embed_metadata_keys=[], excluded_llm_metadata_keys=[], relationships={}, text='LLM Variants and Meta\\'s Open Source Before shedding light on four major trends, I\\'d share the latest Meta\\'s Llama 2 and Code Llama. Meta\\'s Llama 2 represents a sophisticated evolution in LLMs. This suite spans models pretrained and fine-tuned across a parameter spectrum of 7 billion to 70 billion. A specialized derivative, Llama 2-Chat, has been engineered explicitly for dialogue-centric applications. Benchmarking revealed Llama 2\\'s superior performance over most extant open-source chat models. Human-centric evaluations, focusing on safety and utility metrics, positioned Llama 2-Chat as a potential contender against proprietary, closed-source counterparts. The development trajectory of Llama 2 emphasized rigorous fine-tuning methodologies. Meta\\'s transparent delineation of these processes aims to catalyze community-driven advancements in LLMs, underscoring a commitment to collaborative and responsible AI development. Code Llama is built on top of Llama 2 and is available in three models: Code Llama, the foundational code model;Codel Llama - Python specialized for Python;and Code Llama - Instruct, which is fine-tuned for understanding natural language instructions. Based on its benchmark testing, Code Llama outperformed state-of-the-art publicly available LLMs (except GPT-4) on code tasks. Llama 2, Llama 2-Chat, and Code Llama are key steps in LLM development but still have a way to go compared to GPT-4. Meta\\'s open access and commitment to improving these models promise transparent and faster LLM progress in the future. Please refer to the LLM and Llama variants below: From LLMs to Multimodal LLMs, like OpenAI\\'s ChatGPT (GPT-3.5), primarily focus on understanding and generating human language. They\\'ve been instrumental in tasks like text generation, translation, and even creative writing. However, their scope is limited to text. Enter multimodal models like GPT-4. These are a new breed of AI models that can understand and generate not just text, but also images, sounds, and potentially other types of data. The term \"multimodal\" refers to their ability to process multiple modes or types of data simultaneously. This is a game-changer. Imagine an AI that can not only read a description of a dress but also visualize it or even design it! Multimodal AI models are moving us towards more holistic AI systems. These systems can potentially understand our world in a more comprehensive manner, bridging the gap between different forms of data and providing richer, more integrated solutions. As we stand on the cusp of this new era, it\\'s exciting to envision the myriad of applications and innovations that Multimodal models will bring to the table. The future of AI looks more integrated and versatile than ever before. From Connections to Vector DB The AI landscape is witnessing a fascinating transition: from Language Model (LLM) connections or integrations, e.g., LangChain and LlamaIndex, to the rise of Vector Databases (Vector DB) such as Weaviate, Milvus, Pinecone, Chroma, and Vespa.ai. But what\\'s driving this shift, and why does it matter? LLM connections, like the LlamaIndex, primarily focus on linking and understanding vast amounts of external data. They\\'ve been pivotal in creating semantic connections, enabling more intuitive search experiences, and enhancing data accessibility. However, as the volume and variety of data grow, the need for more advanced storage and retrieval mechanisms becomes evident. This is where Vector DBs come into play. Unlike traditional databases that store data in rows and columns, Vector DBs store data in high-dimensional space, allowing for more efficient and accurate similarity searches. Tools like Weaviate and Milvus are designed to handle massive datasets, making them ideal for tasks like image recognition, recommendation systems, and more. The rise of Vector DBs represents a broader trend in AI: the quest for more efficient, scalable, and versatile data handling solutions. As we navigate this evolution, it\\'s clear that the combination of LLMs and Vector DBs will redefine how we store, access, and understand data in the AI-driven future. From Agents to OS The AI realm is abuzz with innovations, and one of the most intriguing shifts we\\'re witnessing is the transition from LLM agents to using LLMs as Operating Systems (OS). Let\\'s delve into this evolution and its implications. LLM agents, like AutoGPT, AgentGPT, BabyAGI, and HuggingGPT, have been groundbreaking in automating tasks based on user requests. These agents leverage the power of Language Models (LLMs) to understand and execute commands, making them invaluable in tasks ranging from content generation to data analysis. Their adaptability and intelligence have made them a staple in many AI toolkits. However, the vision for AI doesn\\'t stop there. The concept of LLM as an OS is emerging as the next big thing. Imagine an operating system where the core is a language model, orchestrating everything around it. Such a system would not just execute tasks but would understand context, anticipate needs, and offer solutions in real time. It\\'s like turning the LLM into the brain of the digital ecosystem, making devices and applications more intuitive and responsive than ever. The move towards LLM as OS signifies a paradigm shift in how we perceive and utilize AI. It\\'s not just about automation anymore; it\\'s about creating a seamless, intelligent interface between humans and technology. As we stand on the brink of this transformation, the potential for LLM-driven OS to revolutionize our digital interactions is immense. From Fine-tuning to Plugins The world of LLMs is undergoing a transformative shift, moving from intricate fine-tuning processes to the more dynamic realm of plugins. Let\\'s unpack this evolution. Historically, fine-tuning has been the cornerstone of LLM optimization. There are two primary ways to fine-tune LLMs: feeding data into the LLM in real-time and directly fine-tuning on the LLM. From a technical standpoint, this involves three methods: Transfer Learning: Adapting a pre-trained model to new tasks.Sequential Fine-tuning: Refining models in stages for specific tasks.Task-specific Fine-tuning: Tailoring models for a particular function. Moreover, LLM techniques like In-context learning, Few-shot learning, and Zero-shot learning have further enhanced the model\\'s adaptability, allowing them to understand and generate content with minimal data. However, the future of LLMs is leaning towards plugins. With the introduction of tools like GPT-4 Plugins, the focus is on extending LLMs seamlessly. Instead of running LLMs as a service, they\\'re envisioned as platforms. This means integrating LLMs with various tools, enhancing their capabilities, and offering a more modular and scalable approach to AI applications. The journey from fine-tuning to plugins represents a move from static optimization to dynamic adaptability, ensuring that LLMs remain at the forefront of AI innovation. In a Nutshell The AI domain is witnessing rapid shifts, with LLMs playing a central role. Initially, the move was from LLMs to Multimodal models, expanding from text to include images and sounds. Simultaneously, the trend shifted from LLM connections, which linked external data, to Vector Databases for efficient high-dimensional storage. Another evolution saw LLM agents, which automated tasks, transitioning towards LLMs as Operating Systems. This change aims for more intuitive, context-aware devices and applications. Furthermore, the traditional fine-tuning processes of LLMs are now being replaced by dynamic plugins, turning LLMs into platforms integrated with various tools. Leading this LLM revolution are OpenAI\\'s GPT-4 and Meta\\'s LLaMA2. Their pioneering efforts are setting the stage for an AI future that\\'s more integrated, responsive, and attuned to human interactions. More Readings Harnessing the Power of LLMs in Practice: A Survey on ChatGPT and Beyond: https://arxiv.org/abs/2304.13712Sparks of Artificial General Intelligence: Early experiments with GPT-4: https://arxiv.org/abs/2303.12712GPT4All-J: https://huggingface.co/nomic-ai/gpt4all-jIntroducing Code Llama, a state-of-the-art large language model for coding: https://ai.meta.com/blog/code-llama-large-language-model-coding/Llama 2: Open Foundation and Fine-Tuned Chat Models: https://ai.meta.com/research/publications/llama-2-open-foundation-and-fine-tuned-chat-models/', start_char_idx=None, end_char_idx=None, text_template='{metadata_str}\\n\\n{content}', metadata_template='{key}: {value}', metadata_seperator='\\n')"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"documents[0]"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "S17g2RYOjmf2"
},
"source": [
"# Transforming"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"id": "STACTMUR1z9N"
},
"outputs": [],
"source": [
"from llama_index.core.node_parser import TokenTextSplitter\n",
"from llama_index.core.schema import BaseNode\n",
"import hashlib\n",
"\n",
"def deterministic_id_func(i: int, doc: BaseNode) -> str:\n",
" \"\"\"Deterministic ID function for the text splitter.\n",
" This will be used to generate a unique repeatable identifier for each node.\"\"\"\n",
" unique_identifier = doc.id_ + str(i)\n",
" hasher = hashlib.sha256()\n",
" hasher.update(unique_identifier.encode('utf-8')) \n",
" return hasher.hexdigest()\n",
"\n",
"text_splitter = TokenTextSplitter(separator=\" \", chunk_size=512, chunk_overlap=128, id_func=deterministic_id_func)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 331,
"referenced_widgets": [
"76fea2dabfea42aa8bc7ae719f2a22ee",
"6c575687c8f1468a803b88eea3d26b7b",
"c266531dafcf4624af5fe9bcbc9d8df9",
"e20a27a2f7764cb4b9537e34a3659c9a",
"bba307f545cd4533be6f0489f95b9895",
"eb057e56f0f94e4993b8ae960c78b0ad",
"2073b65c0db045aa8e86d91a4fea2e2b",
"8141417665024172a4baa78c497acb69",
"01d27fdbe86a4ca2830b9bf3ccbf1ae9",
"e4fe85a095e64d52b6a53c2a4bba8aeb",
"70e17db8fc2f490f85b7af8aa664f0c7",
"c0a70bcdf3fb4bbfb2675b8012b2ef24",
"665b9b5e85a34be8a20d40c51e57cfe0",
"b604cef3deca4847afcc459e5c8a9e0f",
"076728d713254b49935c7938d18014f2",
"be591abb84a24c4b9903087501ebb0e5",
"85f23ab21c3b404aaa146cfcaefc85d8",
"10340f8e7c8e482c8d35047a3e43ee7f",
"1095efa793804a3fb625855e715a5317",
"b43a5a6a65034a16927700e442dde52a",
"121dbf44a222434cbc57ebe6beb83e2a",
"2af0821ebb7e47988d134d4ec2776e87"
]
},
"id": "CtdsIUQ81_hT",
"outputId": "325e8cd3-ce27-4ab0-e542-cbfdb7a0debb"
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/louis/Documents/GitHub/ai-tutor-rag-system/.conda/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n",
" from .autonotebook import tqdm as notebook_tqdm\n",
"Parsing nodes: 0%| | 0/14 [00:00<?, ?it/s]"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Parsing nodes: 100%|ββββββββββ| 14/14 [00:00<00:00, 38.11it/s]\n",
"Generating embeddings: 100%|ββββββββββ| 108/108 [00:01<00:00, 75.25it/s]\n"
]
}
],
"source": [
"from llama_index.embeddings.openai import OpenAIEmbedding\n",
"from llama_index.core.ingestion import IngestionPipeline\n",
"\n",
"pipeline = IngestionPipeline(\n",
" transformations=[\n",
" text_splitter,\n",
" OpenAIEmbedding(),\n",
" ],\n",
" vector_store=vector_store\n",
")\n",
"\n",
"nodes = pipeline.run(documents=documents, show_progress=True)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"TextNode(id_='4ab5bd897f01474fc9b0049f95e31edae3ccd9e74d0f0acd3932b50a74d608b6', embedding=[-0.022741511464118958, 0.010871483013033867, -0.017776913940906525, -0.013163917697966099, 0.004405552521348, 0.013564742170274258, -0.02842337265610695, 0.025638697668910027, -0.03861978277564049, -0.02869058959186077, 0.02842337265610695, 0.028282733634114265, -0.028310861438512802, -0.014127302914857864, 0.008079776540398598, 0.01933801919221878, 0.014879727736115456, 0.0029657490085810423, 0.004658704623579979, -0.004802860785275698, -0.0027108388021588326, 8.63068999024108e-05, -0.006613602861762047, -0.01984432525932789, 0.004848569165915251, 0.026398155838251114, 0.025976235046982765, -0.028887486085295677, -0.017312802374362946, 0.001968962140381336, 0.01291076559573412, 0.014056982472538948, -0.029225021600723267, -0.00135805644094944, -0.013853054493665695, -0.017256546765565872, 0.01682056114077568, -0.0057416339404881, 0.035750724375247955, -0.010927739553153515, 0.014296070672571659, 0.007974295876920223, 0.006483510602265596, -0.030462656170129776, -0.027888940647244453, -8.394458563998342e-05, 0.022572742775082588, -0.02655285969376564, -0.025498058646917343, 0.0010969931026920676, -0.004036372061818838, 0.04545489326119423, -0.03299417719244957, 0.019858388230204582, 0.0024524126201868057, -0.004117240197956562, 0.006311226636171341, -0.0013053163420408964, 0.02604655548930168, 0.013824926689267159, -0.0024770244490355253, -0.004141852259635925, -0.017819106578826904, 0.021278854459524155, -0.010730843059718609, -0.00561505788937211, -0.030575167387723923, 0.033022306859493256, 0.008930649608373642, -0.008635304868221283, -0.0006724356790073216, 0.01545635238289833, 0.008473568595945835, -0.022910280153155327, 0.028831230476498604, 0.007833655923604965, -0.018578562885522842, -0.02040688507258892, -0.024935496971011162, 0.006392094772309065, 0.017003392800688744, 0.003584565594792366, -0.001132153207436204, 0.03456934913992882, 0.017383122816681862, -0.005024369340389967, 0.02116634137928486, -0.019155187532305717, -0.011982540600001812, -0.027087291702628136, -0.0009071289678104222, -0.0011550071649253368, 0.05105237290263176, 0.022249270230531693, -0.031644031405448914, 0.0063604507595300674, -0.01480940729379654, 0.014000726863741875, -0.020899126306176186, -0.021827351301908493, -0.025287097319960594, -0.019112994894385338, -0.018086323514580727, -0.019731812179088593, -0.015400095842778683, 0.010189378634095192, 0.01698932982981205, 0.021672645583748817, 0.0048942770808935165, 0.03127836808562279, -0.01703152246773243, 0.045567408204078674, 0.005386517383158207, -0.04013869911432266, -0.017354993149638176, 0.0065186708234250546, 0.027720171958208084, -0.010751939378678799, -0.009275217540562153, 0.022010182961821556, 0.02680601179599762, 0.02210863120853901, 0.00830480083823204, -0.00379376788623631, 0.021025702357292175, 9.32290349737741e-05, -0.016398640349507332, -0.003577533643692732, -0.020055284723639488, 0.0017799768829718232, 0.023543160408735275, 0.024190105497837067, 0.03380989283323288, 0.004201624542474747, -0.03794471174478531, 0.02441512979567051, -0.02019592560827732, -0.013227205723524094, -0.02594810724258423, -0.01770659349858761, -0.0036144517362117767, 0.02594810724258423, 0.003022005083039403, 0.013613966293632984, -0.020055284723639488, 0.017987875267863274, 0.021278854459524155, 0.014401551336050034, 0.026398155838251114, 0.0005067440215498209, 0.005400581751018763, -0.03347235545516014, -0.021967990323901176, 0.011806740425527096, 0.002165858168154955, 0.014893791638314724, 0.019225507974624634, 0.006919495295733213, -0.01608923263847828, -0.0027723689563572407, -0.014992239885032177, 0.014253878965973854, -0.013473326340317726, 0.006068622227758169, 0.0272701233625412, 0.03181280195713043, 0.02984383888542652, -0.018128514289855957, 0.0013457504101097584, -0.017903489992022514, -0.03108147159218788, 0.013234238140285015, -0.044245388358831406, 0.02099757455289364, -0.0010732600931078196, 0.011982540600001812, 0.003305043326690793, -0.005488481838256121, -0.014978175051510334, -0.020294373854994774, 0.0017544857691973448, 0.001155886217020452, 0.0035634697414934635, 0.007165615446865559, -0.02210863120853901, -0.011391852051019669, 0.0019619299564510584, 0.010646458715200424, 0.0017035037744790316, -0.010899611748754978, 0.02902812696993351, 0.01720028929412365, -0.002190470229834318, -0.023754119873046875, -0.618816614151001, -0.032122209668159485, -0.0021482782904058695, -0.03226285055279732, -0.0014064015122130513, -0.01592046394944191, -0.01878952421247959, -0.005463869776576757, -0.02334626391530037, 0.03850727155804634, -0.021067893132567406, -0.003493149532005191, 0.010449563153088093, -0.0165674090385437, 0.002985086990520358, -0.023149367421865463, 0.0019021580228582025, -0.023121239617466927, 0.019689619541168213, 0.007320319768041372, -0.011398883536458015, -0.0023627544287592173, 0.0028514789883047342, -0.007242967374622822, -0.01711590588092804, -0.0023170465137809515, -0.01265761349350214, 0.00934553798288107, 0.009514305740594864, 0.01250994112342596, -0.04587681591510773, 0.019436467438936234, 0.004739572759717703, -0.026116875931620598, 0.04058874770998955, -0.008860329166054726, -0.01150436419993639, 0.01831134781241417, -0.0053126816637814045, 0.013993694446980953, -0.02372599206864834, -0.015779824927449226, 0.013262365944683552, 0.013494421727955341, -0.01517507154494524, 0.029337534680962563, 0.02411978505551815, -0.006427254527807236, -0.021714838221669197, -0.014049950987100601, 0.0036566436756402254, -5.878318552277051e-05, 0.020772550255060196, -0.008543889038264751, 0.001970720011740923, 0.012439620681107044, 0.04013869911432266, -0.011293403804302216, 0.003962535876780748, 0.005804921966046095, -0.0010213990462943912, 0.010632394813001156, -0.032544128596782684, -0.02804364450275898, -0.02646847628057003, 0.017622210085392, 0.006578442640602589, 0.013332685455679893, 0.0073695434257388115, 0.0006047526258043945, 0.00031116630998440087, 0.027607660740613937, 0.013093597255647182, -0.016243936493992805, -0.002934104995802045, 0.01480940729379654, 0.01035111490637064, -0.00815009605139494, 0.014092142693698406, 0.03189718350768089, 0.015779824927449226, -0.01521726418286562, 0.004880213178694248, -0.009225993417203426, 0.03718525543808937, 0.01163094025105238, -0.002315288409590721, -0.011497331783175468, 0.0270591638982296, 0.011201987974345684, 0.018902035430073738, 0.012179436162114143, -0.038141608238220215, -0.032769154757261276, 0.015386031940579414, 0.021321045234799385, -0.01732686534523964, 0.012109116651117802, 0.018930163234472275, -0.03200969845056534, -0.015245391987264156, -0.016961202025413513, 0.032206594944000244, 0.008782977238297462, 0.03366925194859505, 0.02770610898733139, -0.03808535262942314, -0.008248544298112392, 0.0160470400005579, -0.03400678560137749, -0.01009796280413866, 0.0051861051470041275, -0.016061104834079742, -0.016764305531978607, 0.019183315336704254, -0.02514645829796791, -0.0013334443792700768, -0.016975264996290207, -0.003433377481997013, -0.008297768421471119, 0.0320940800011158, -0.013698350638151169, 0.009036129340529442, -0.017144033685326576, 0.01900048367679119, 0.02634189836680889, -0.008965808898210526, -0.024808920919895172, -0.014049950987100601, 0.018887972459197044, -0.014739086851477623, -0.01082225888967514, 0.012481813319027424, -0.01566731184720993, 0.003106389194726944, 0.01310766115784645, 0.044245388358831406, 0.005010304972529411, 0.007320319768041372, -0.013803830370306969, -0.026876332238316536, -0.009127545170485973, 0.01860669068992138, -0.004475872498005629, -0.03915421664714813, -0.031193984672427177, -0.01916925236582756, 0.008107904344797134, 0.007063651457428932, -0.006574926897883415, -0.014795343391597271, -0.008993937633931637, 0.009148641489446163, 0.018986418843269348, 0.0015171555569395423, -0.011820804327726364, -0.005783826112747192, -0.030068863183259964, -0.0043879724107682705, -0.01642676815390587, 0.008368088863790035, 4.3263327825115994e-05, -0.006859723012894392, 0.0019759940914809704, 0.004169980529695749, -0.010442530736327171, -0.022896215319633484, 0.028029581531882286, -0.025498058646917343, -0.021096020936965942, -0.004581352695822716, -0.03518816456198692, 0.006782371085137129, 0.011961444281041622, -0.014007758349180222, 0.02420416846871376, -0.003804316045716405, -0.00504898140206933, -0.0074961199425160885, -0.001010851003229618, 0.003296253504231572, 0.031109599396586418, 0.0004518064670264721, -0.02177109383046627, 0.0158360805362463, 0.017622210085392, 0.03760717436671257, 0.014457806944847107, -0.021053830161690712, 0.010850387625396252, 0.016511153429746628, 0.01686275377869606, -0.022994663566350937, 0.03375363349914551, -0.017214354127645493, 0.011623907834291458, 0.0070601352490484715, -0.01805819384753704, 0.013156885281205177, 0.0377478152513504, 0.00894471351057291, 0.0156251210719347, -0.016722112894058228, -0.010238602757453918, 0.010533946566283703, -0.030153246596455574, 0.012306013144552708, -0.019014548510313034, -0.010393306612968445, -0.005608025938272476, 0.003994180355221033, -0.00656437873840332, -0.008740784600377083, -0.012207564897835255, 0.0011330321431159973, 0.031475264579057693, -0.005491997580975294, 0.007183195557445288, -0.02642628364264965, 0.010674587450921535, 0.003213627263903618, 0.016919009387493134, -0.01376867014914751, 0.012678708881139755, -0.010801163502037525, 0.004704413004219532, -0.019689619541168213, 0.020378757268190384, -0.007545343600213528, -0.03144713491201401, 0.004500484559684992, 0.00932444166392088, 0.0327128991484642, 0.004528612829744816, 0.023107176646590233, -0.017833169549703598, 0.022769639268517494, 0.0011602812446653843, 0.044414158910512924, -0.005952594336122274, -0.00727812759578228, 0.003642579773440957, -4.436207746039145e-05, -0.03068768046796322, 0.012629484757781029, -0.01033001858741045, 0.038141608238220215, -0.014471870847046375, -0.017312802374362946, -0.005414645653218031, -0.036482054740190506, 0.011680164374411106, -0.0024383484851568937, 0.00471496069803834, 0.029309406876564026, -0.009830745868384838, 0.004349296446889639, 0.0031169371213763952, 0.015287583693861961, 0.0036671918351203203, -0.013086565770208836, 0.0012965262867510319, -0.0029358630999922752, 0.014978175051510334, 0.021883606910705566, -0.005231813527643681, -0.00420514028519392, -0.011427012272179127, -0.007165615446865559, -0.0137897664681077, -0.020842868834733963, -0.01005577016621828, 0.024612026289105415, -0.040532488375902176, 0.042838986963033676, 0.020856933668255806, 0.004560256842523813, 0.014725022949278355, -0.003726963885128498, 0.03170028701424599, -0.024851113557815552, -0.03752278909087181, 0.015076623298227787, -0.00843137688934803, -0.032037824392318726, -0.019577108323574066, -0.018705138936638832, 0.007657855749130249, -0.0017035037744790316, 0.00044235720997676253, -0.009092384949326515, -0.008635304868221283, -0.01237633265554905, 0.012460717000067234, 0.00033292159787379205, 0.008093840442597866, 0.015146943740546703, -0.0065995389595627785, 0.00830480083823204, -0.020983509719371796, 0.02028030902147293, 0.011834868229925632, -0.00966900959610939, -0.005361905321478844, 0.01197550818324089, -0.01579388789832592, -0.03364112228155136, 0.0001978850777959451, 0.0003425906179472804, -0.03347235545516014, 0.003646095748990774, -0.007545343600213528, 0.008157128468155861, -0.04098253697156906, 0.015822015702724457, 0.012481813319027424, 0.020603781566023827, 0.0033683315850794315, 0.019239572808146477, 0.013185014016926289, -0.008129000663757324, 0.001795798889361322, -0.010787099599838257, 0.01933801919221878, 0.04838021099567413, 0.01873326674103737, 0.0039273761212825775, 0.0011312741553410888, -0.005878758151084185, 0.003296253504231572, -0.024837050586938858, 0.0017369057750329375, 0.0009800860425457358, 0.010836322791874409, -0.0165674090385437, -0.019323956221342087, 0.018241027370095253, 0.001310590305365622, 0.04008243978023529, 0.0030817771330475807, 0.010301890783011913, -0.014239815063774586, -0.009514305740594864, -0.012974053621292114, 0.014570319093763828, -0.002651066752150655, 0.009929194115102291, 0.024358872324228287, 0.011729388497769833, -0.009739330038428307, 0.008143064565956593, 0.02847963012754917, -0.006339354440569878, -0.02168671041727066, 0.01212318055331707, 0.004612996708601713, 0.008768913336098194, 0.008614208549261093, -0.016792433336377144, 0.01146217156201601, -0.0003208353300578892, -0.0036918038967996836, 0.01391634251922369, 0.015090687200427055, 0.004380940459668636, 0.02403540164232254, 0.008192288689315319, 0.013262365944683552, 0.009619786404073238, -0.014950047247111797, -0.003923859912902117, 0.010154218412935734, -0.006958171259611845, -0.03935111314058304, 0.0036812557373195887, 0.004398520570248365, -0.04084189981222153, -0.001738663762807846, 0.028451502323150635, 0.00656437873840332, 0.0013360814191401005, -0.011019155383110046, -0.004669252783060074, -0.03513190895318985, -0.006300678476691246, -0.03051891177892685, 0.007559407968074083, -0.015315711498260498, -0.003642579773440957, -0.0036953198723495007, -0.003934408072382212, 0.0012437863042578101, -0.016511153429746628, -0.0004693864902947098, -0.01644083298742771, -0.010871483013033867, -0.05805625393986702, -0.013649126514792442, -0.0014090384356677532, -0.004268428310751915, 0.010885546915233135, -0.002598326653242111, 0.0035740176681429148, 0.021799223497509956, -0.008677496574819088, -0.02057565376162529, 0.002466476522386074, -0.019999029114842415, 0.0057416339404881, -0.023275943472981453, -0.003797283861786127, -0.020674102008342743, -0.012531036511063576, 0.022558679804205894, -0.008881425485014915, -0.014092142693698406, -0.020097477361559868, 0.0024207686074078083, 0.005583413876593113, 0.02420416846871376, 0.015990784391760826, 0.006757759023457766, 0.02330407127737999, -0.023191560059785843, -0.0009449259960092604, -0.018044130876660347, -0.019956836476922035, -0.035835109651088715, 0.0031257271766662598, 0.008550920523703098, 0.03538506105542183, 0.008515761233866215, 0.010147186927497387, -0.020645974203944206, 0.0007199017563834786, -0.014120270498096943, 0.01212318055331707, -0.0017773398431017995, 0.01248884480446577, -0.014106206595897675, 0.01186299603432417, -0.003447441617026925, -0.004848569165915251, -0.029900094494223595, 0.017003392800688744, -0.03018137440085411, 0.020392820239067078, 0.01030892226845026, 0.010140154510736465, 0.017186226323246956, 0.022657128050923347, 0.001765912864357233, -0.045398637652397156, 0.0003348993486724794, 0.001233238261193037, 0.014155430719256401, -0.003814863972365856, -0.011419979855418205, -0.0023838505148887634, -0.014570319093763828, -0.015231328085064888, 0.009099417366087437, -0.02487924136221409, 0.0063604507595300674, -0.015118815936148167, -0.004324684385210276, -0.009317409247159958, -0.01492191944271326, 0.004757152870297432, -0.02919689379632473, -0.009401793591678143, 0.029309406876564026, 0.017383122816681862, 0.031137729063630104, -0.013494421727955341, 0.010386275127530098, -0.03811347857117653, -0.016412705183029175, 0.0005243240157142282, -0.02361348085105419, -0.010744906961917877, -0.005970173981040716, 0.011722356081008911, 0.016539281234145164, 0.021785158663988113, 0.006036978214979172, 0.018283218145370483, 0.01575169712305069, -0.001937318011187017, -0.0064307707361876965, -0.009929194115102291, 0.00021964035113342106, -0.02001309208571911, -0.013466293923556805, 0.012650581076741219, -0.0034861175809055567, 0.009844809770584106, 0.004764184821397066, -0.0019654459320008755, 0.002165858168154955, -0.015118815936148167, -0.00407504802569747, -0.0183535385876894, -0.04098253697156906, -0.021335110068321228, 0.008550920523703098, -0.0065010907128453255, -0.002301224274560809, -0.04643937572836876, -0.017790978774428368, 0.01856449991464615, 0.008438408374786377, 0.014626574702560902, 0.011912220157682896, 0.03704461455345154, -0.028887486085295677, -0.0025860206224024296, 0.030378270894289017, 0.016975264996290207, -0.00828370451927185, -0.007063651457428932, -0.043907854706048965, 0.013909310102462769, 0.015203199349343777, 0.007179679349064827, 0.040448106825351715, 0.02629970759153366, -0.015639184042811394, 0.016876816749572754, 0.014141366817057133, 0.0032487872522324324, 0.010231570340692997, -0.004451260436326265, -0.010259699076414108, 0.0035828077234327793, -0.012263820506632328, -0.025118330493569374, -0.023768184706568718, -0.019239572808146477, 0.011047283187508583, 0.01329752616584301, 0.030631422996520996, -0.024921434000134468, -0.020730357617139816, 0.02372599206864834, 0.008958777412772179, 0.050827350467443466, 0.013311590068042278, 0.008396216668188572, 0.02378224954009056, 0.009549465961754322, -0.01113869994878769, 0.01109650731086731, 0.01238336507230997, -0.014106206595897675, 0.020645974203944206, 0.015822015702724457, 0.002637002617120743, -0.009788554161787033, 0.012446653097867966, 0.010315954685211182, -0.03935111314058304, -0.04860523343086243, 0.010034674778580666, 0.02129291743040085, 0.0055060614831745625, -0.03589136525988579, -0.0300969909876585, -0.02510426566004753, -0.0009765700669959188, -0.02535741776227951, 0.023163432255387306, 0.009992482140660286, -0.008185256272554398, 0.010998059064149857, 0.008881425485014915, 0.010119058191776276, -0.0005753060686402023, -0.004873181227594614, 0.021714838221669197, 0.004651672672480345, 0.0014406824484467506, -0.0032030793372541666, 0.010168282315135002, -0.006128394510596991, 0.03760717436671257, -0.008930649608373642, 0.011968476697802544, 0.010428466834127903, -0.0013633304042741656, 0.0061811343766748905, -0.008192288689315319, 0.004426648374646902, 0.03693210333585739, -0.03552570194005966, -0.011110571213066578, -0.008241512812674046, -0.016187680885195732, 0.016243936493992805, -0.015892336145043373, 0.014049950987100601, -0.004612996708601713, -0.01374757383018732, 0.0036777397617697716, 0.023571288213133812, 0.024021336808800697, -0.03181280195713043, 0.006944107357412577, 0.0028690588660538197, -0.03240348771214485, -0.027002908289432526, 0.005797890014946461, 0.03257225826382637, -0.0371289998292923, 0.007854752242565155, 0.008916584774851799, -0.0213913656771183, 0.021278854459524155, 0.021025702357292175, -0.003814863972365856, -0.029421918094158173, 0.03231910616159439, -0.03386614844202995, 0.02189766988158226, 0.0010591960744932294, -0.010400339029729366, -0.026651307940483093, -0.001455625519156456, -0.015273519791662693, -0.029253149405121803, 0.004468840546905994, -0.025413675233721733, -0.022094566375017166, -0.011448107659816742, 0.01690494641661644, 0.0065714106895029545, -0.010217506438493729, 0.01355067826807499, 0.003635547822341323, 0.0031116632744669914, -0.001038100104779005, -0.01575169712305069, -0.00142222351860255, 0.023191560059785843, 0.000530477031134069, 0.003885183949023485, 0.030575167387723923, -0.003380637615919113, 0.011926284059882164, -0.013958534225821495, -0.00555880181491375, -0.009486177936196327, -0.057606205344200134, -0.020674102008342743, 0.009493209421634674, 0.001775581855326891, -7.636320515302941e-05, 0.001283341320231557, -0.01648302562534809, -0.01020344253629446, -0.01263651717454195, -0.0020234601106494665, 0.010372210294008255, 0.0027477568946778774, 0.007390639744699001, 0.023360328748822212, -0.00031160583603195846, 0.008614208549261093, -0.01801600307226181, -0.02074442058801651, -0.019014548510313034, -0.003157371189445257, -0.03189718350768089, -0.018620755523443222, -0.03366925194859505, 0.05063045397400856, -0.006374514661729336, -0.03876042366027832, -0.02122259885072708, -0.014992239885032177, -0.03825411945581436, -0.020730357617139816, 0.002598326653242111, 0.018114451318979263, 0.012531036511063576, 0.016933074221014977, 0.0025719567202031612, 0.036003876477479935, 0.006339354440569878, 0.0050630453042685986, -0.027481084689497948, 0.012685741297900677, -0.000674193724989891, -0.012917797081172466, 0.01278418954461813, 0.01776285097002983, -0.02103976532816887, 0.018536372110247612, 0.012031764723360538, -0.02783268503844738, -0.024429192766547203, 0.02701697126030922, -0.01521726418286562, -0.009901066310703754, 0.022038310766220093, -0.008867361582815647, 0.007046071346849203, -0.012650581076741219, 0.020435012876987457, -0.03116585686802864, -0.009493209421634674, 0.026398155838251114, -0.006409674417227507, 0.016272064298391342, -0.014781279489398003, 0.0174112506210804, 0.0093314740806818, 0.008804073557257652, 0.016314256936311722, -0.012594325467944145, 0.00619871448725462, 0.004686832893639803, 0.043823469430208206, 0.01959117315709591, 0.01073787547647953, 0.029393790289759636, -0.01634238474071026, -0.0015250665601342916, -0.007678952068090439, 0.015090687200427055, 0.0007809923263266683, -0.00855795294046402, 0.04354218766093254, -0.016511153429746628, 0.00981668196618557, -0.010133122093975544, 0.002937620971351862, -0.02250242419540882, -0.017228417098522186, -0.016272064298391342, -0.0027917069382965565, -0.022685255855321884, 0.014246846549212933, 0.019872453063726425, -0.022164886817336082, -0.0031608871649950743, -0.012931860983371735, 0.02258680760860443, 0.0036707078106701374, -0.01404291857033968, -0.005818985868245363, -0.0012341173132881522, -0.003450957592576742, 0.019239572808146477, 0.010126090608537197, -0.006184650585055351, 0.014324198476970196, 0.003595113754272461, -0.022136759012937546, 0.0158360805362463, 0.199258953332901, -0.031222112476825714, 0.013909310102462769, 0.02873278222978115, 0.01715809851884842, -0.016637729480862617, 0.04435790330171585, 0.007981328293681145, 0.001445077476091683, -0.004553224891424179, 0.006673374678939581, 0.005931498017162085, -0.016328321769833565, 0.00015118815645109862, 0.01912705972790718, -0.026327835395932198, -0.021588262170553207, -0.035919494926929474, -0.017861299216747284, -0.00420514028519392, 0.005949078127741814, 0.0009370149928145111, -0.00689488323405385, -0.022572742775082588, -0.0030677132308483124, 0.005235329270362854, 3.282519173808396e-05, -0.0031485813669860363, 0.01869107596576214, 0.0013018003664910793, -0.01660960167646408, 0.005207201465964317, -0.008368088863790035, 0.0019197380170226097, 0.00042521668365225196, -0.00966900959610939, 0.010379242710769176, -0.0004133501788601279, 0.006100266240537167, 0.024738602340221405, 0.02189766988158226, 0.022136759012937546, 0.0036812557373195887, -0.025301162153482437, 0.01545635238289833, 0.011363723315298557, -0.003892216132953763, 0.008593113161623478, 0.008009456098079681, 0.007341415621340275, -0.022558679804205894, 0.022657128050923347, 0.023233752697706223, 0.020842868834733963, -0.006497574504464865, 0.0011752241989597678, -0.01963336393237114, 0.015090687200427055, 0.00044389546383172274, -0.004852084908634424, -0.027115419507026672, -0.008501696400344372, 0.00033907461329363286, 0.02399320900440216, -0.010442530736327171, 0.012242725118994713, -0.007510183844715357, -0.023922888562083244, 0.007875848561525345, -0.02911251038312912, -0.011954412795603275, -0.014865663833916187, 0.00011613799870247021, -0.011574683710932732, -0.019830260425806046, -0.03887293487787247, 0.021841414272785187, 0.028015516698360443, 0.0007084747194312513, 0.04874587431550026, -0.003790251910686493, -0.03906983137130737, 0.004268428310751915, -0.012038796208798885, 0.005245877429842949, -0.023669736459851265, 0.009394762106239796, -0.015273519791662693, -0.021616389974951744, -0.011546555906534195, -0.016722112894058228, -0.0095424335449934, 0.004212172236293554, 0.025160521268844604, -0.00016404355119448155, 0.004493452608585358, 0.007671920116990805, 0.005734601989388466, -0.010660522617399693, -0.03116585686802864, -0.007249999325722456, 0.05923762917518616, 0.021714838221669197, 0.0031749513000249863, -0.0006869392236694694, 0.01933801919221878, -0.002934104995802045, 0.000356215110514313, -0.0023064983543008566, 0.0006966082146391273, 0.009640881791710854, -0.027903005480766296, 0.011201987974345684, 0.003617967711761594, -0.0031151792500168085, 0.011989572085440159, 0.010927739553153515, -0.009753393940627575, 0.016159553080797195, -0.009992482140660286, -0.007200775668025017, -0.022052375599741936, -0.005903370212763548, 0.011427012272179127, -0.00012185150262666866, -0.02714354731142521, 0.0069792671129107475, 0.0008552678627893329, -0.027860812842845917, 0.017186226323246956, 0.0003729161398950964, -0.03982928767800331, 0.009605721570551395, 0.003660159884020686, 0.0006271671736612916, -0.008593113161623478, 0.014654703438282013, -0.006374514661729336, -0.02860620617866516, 0.013628030195832253, -0.008782977238297462, 0.024597961455583572, 0.004169980529695749, -0.021757030859589577, 0.014324198476970196, -0.014106206595897675, 0.0022766124457120895, 0.01530164759606123, -0.013044373132288456, -0.020125605165958405, -0.01980213262140751, 0.007995392195880413, 0.005274005234241486, 0.009443986229598522, -0.0011945621808990836, 0.024133849889039993, -0.011968476697802544, -0.0006983662024140358, 0.022980600595474243, 0.008607177063822746, -0.028578078374266624, 0.00297278119251132, 0.01558292843401432, 0.007042555138468742, -0.016032977029681206, -0.006543282885104418, -0.180806964635849, -0.014753151684999466, 0.011553588323295116, -0.04022308066487312, 0.018381666392087936, 0.005629121791571379, 0.012967021204531193, 0.008325896225869656, -0.011187923140823841, 0.001034584129229188, 0.021714838221669197, -0.0183535385876894, -0.0046270606108009815, -0.005984238348901272, -0.0009106449433602393, 0.00826260820031166, -0.008438408374786377, 0.009809650480747223, 0.011884092353284359, 0.0008056043297983706, 0.03127836808562279, -0.026876332238316536, 0.00981668196618557, -0.009465081617236137, 0.017523761838674545, 0.012334140948951244, 0.009190833196043968, 0.042276427149772644, -0.01736905798316002, -0.03099708817899227, -0.011265275999903679, -0.015034431591629982, 0.028999997302889824, 0.006212778389453888, 0.030968960374593735, 0.031193984672427177, 0.011490300297737122, -0.01967555657029152, -0.018578562885522842, -0.015653248876333237, 0.022375846281647682, 0.013424102216959, 0.023979144170880318, -0.008593113161623478, -0.032122209668159485, 0.007573471870273352, 0.007573471870273352, -0.021503878757357597, -0.0015022126026451588, -0.01291076559573412, 0.016398640349507332, 0.009718233719468117, 0.014654703438282013, -0.004286008421331644, 0.024865178391337395, 0.03085644729435444, -0.005695926025509834, 0.003632031846791506, -0.007123423274606466, -0.020224053412675858, -0.00035885212128050625, -0.0001596485381014645, 0.0007027612300589681, -0.0007317682611756027, 0.00857904925942421, -0.03496313840150833, -0.007819592021405697, 0.005207201465964317, -0.04025121033191681, 0.0018617239547893405, -0.03338797017931938, 0.003080019261687994, -0.028057709336280823, -0.013986662030220032, 0.027818620204925537, 0.038788553327322006, -0.030490783974528313, 0.01736905798316002, 0.04427351802587509, 0.008459504693746567, -0.019984964281320572, 0.0027477568946778774, -0.01874733157455921, 0.02129291743040085, -0.004099660087376833, 0.005516609642654657, 0.015934528782963753, 0.0254839938133955, -0.015245391987264156, -0.009183801710605621, 0.019619300961494446, -0.009844809770584106, 0.017397185787558556, -0.011827835813164711, -0.0007642912678420544, 0.01374757383018732, 0.010780067183077335, -0.03479437157511711, -0.0058717261999845505, -0.016468960791826248, 0.0074679916724562645, 0.0060123661532998085, -0.009289281442761421, -0.011012122966349125, 0.019956836476922035, 0.022136759012937546, -0.022952470928430557, 0.021025702357292175, 0.028324924409389496, -0.003278673393651843, -0.01950678788125515, -0.00892361719161272, 0.0023539643734693527, 0.003345477394759655, 0.0018441439606249332, -0.0009686590055935085, -0.018817652016878128, -0.028676524758338928, 0.03248787298798561, -0.0020093959756195545, 0.05136178061366081, -0.007967264391481876, 0.0026440348010510206, 0.02185547910630703, -0.009774490259587765, -0.03456934913992882, -0.10452375560998917, -0.03563821315765381, 0.018902035430073738, 0.03150339424610138, -0.016581473872065544, 0.03282541036605835, -0.005140397232025862, 0.04115130752325058, -0.00771411182358861, 0.03926672786474228, -0.005210717208683491, -0.004187560174614191, 0.023965081200003624, 0.016145488247275352, 0.014471870847046375, -0.011982540600001812, 0.000530477031134069, -0.015822015702724457, -0.027888940647244453, 0.029478173702955246, 0.017045585438609123, -0.01020344253629446, 0.01061129942536354, -0.03217846527695656, 0.01365615800023079, -0.020772550255060196, -0.038225989788770676, 0.019408339634537697, 0.005414645653218031, -0.003378879511728883, 0.012291948311030865, -0.0156251210719347, 0.008986905217170715, -0.016792433336377144, 0.011180891655385494, -0.004261396359652281, 0.015245391987264156, -0.019816195592284203, 0.015526671893894672, -0.00015261652879416943, -0.010252666659653187, 0.023022791370749474, 0.01214427687227726, -0.008775944821536541, -0.02531522698700428, 0.004595416598021984, -0.009310377761721611, 0.019070804119110107, 0.003340203547850251, -0.028156157582998276, -0.040194954723119736, -0.0027407249435782433, -0.048295825719833374, 0.008958777412772179, 0.013030309230089188, -0.010344082489609718, -0.0016797707648947835, 0.02539961040019989, -0.011005091480910778, -0.009261153638362885, -0.000408515683375299, -0.018423859030008316, -0.014078078791499138, 0.0028409308288246393, -0.014366391114890575, 0.006553830578923225, -0.008642337284982204, -0.024612026289105415, 0.02594810724258423, -0.004859116859734058, 0.00039313314482569695, 0.023374391719698906, -0.011834868229925632, 0.0035458896309137344, -0.01686275377869606, -0.006156522314995527, -0.000893064949195832, -0.016665857285261154, 0.0112230833619833, -0.0014740845654159784, -0.01797381043434143, -0.011441076174378395, 0.016848688945174217, -0.013613966293632984, -0.005066561046987772, 0.011427012272179127, -0.014710959047079086, -0.008396216668188572, 0.01022453885525465, -0.054062072187662125, -0.007320319768041372, 0.032544128596782684, 0.007116391323506832, -0.018030066043138504, 0.023177495226264, 0.0007840688340365887, -0.011623907834291458, 0.004841537214815617, 0.006086202338337898, 0.0004056589095853269, -0.02120853401720524, -0.02198205515742302, -0.07212026417255402, 0.019577108323574066, 0.0016832867404446006, -0.010147186927497387, 0.014028854668140411, -0.012812317349016666, 0.007517215795814991, -0.010491754859685898, 0.009753393940627575, 0.026524731889367104, -0.028099901974201202, 0.011933316476643085, -0.022938407957553864, -0.03403491526842117, -0.008853296749293804, -0.009366633370518684, 0.0188739076256752, -0.00919786561280489, 0.005080625414848328, -0.0015373725909739733, 0.032937921583652496, -0.025849658995866776, 0.025723082944750786, 0.018550435081124306, -0.0004966355045326054, -0.002341658342629671, -0.043907854706048965, 0.01406401488929987, -0.009633850306272507, -0.01587827317416668, 0.0070882635191082954, -0.014317166991531849, 0.013388941995799541, 0.014795343391597271, 0.001852933899499476, -0.016497088596224785, 8.790009451331571e-05, 0.026187194511294365, 0.007826624438166618, 0.03428806737065315, -0.013206109404563904, -0.04238893836736679, 0.015104752033948898, -0.005713506136089563, -0.0024524126201868057, -0.00817822478711605, -0.02246023155748844, -0.00890252087265253, 0.04624247923493385, 0.010533946566283703, 0.04199514910578728, 0.0017738238675519824, -0.019858388230204582, -0.050517939031124115, -0.011778612621128559, 0.0018582079792395234, 0.024654217064380646, -0.009999514557421207, 0.014204654842615128, 0.012685741297900677, 0.0377478152513504, 0.008037583902478218, 0.020603781566023827, -0.015020367689430714, -0.0038640880957245827, -0.014260910451412201, -0.004500484559684992, -0.008255576714873314, -0.0011620392324402928, -0.03234723210334778, 0.010140154510736465, -0.004039888270199299, 0.014851599000394344, -0.0011708291713148355, 0.0030677132308483124, -0.010062802582979202, 0.0013018003664910793, 0.014401551336050034, -0.01665179245173931, 0.01720028929412365, 0.018831714987754822, -0.024949561804533005, -0.002348690526559949, -0.0004386214422993362, 0.025596506893634796, 0.0001995332131627947, -0.019155187532305717, 0.007693015970289707, -0.015132879838347435, -0.0011708291713148355, 0.0023609965573996305, 0.0018248058622702956, -0.007042555138468742, 0.0190848670899868, 0.0018142579356208444, -0.018072258681058884, -0.0017878878861665726, -0.008508728817105293, 0.027438892051577568, -0.009043161757290363, 0.00010284310701536015, -0.010491754859685898, 0.00427897647023201, -0.007091779261827469, -0.008192288689315319, -0.009528369642794132, -0.0448923334479332, -0.021967990323901176, 0.03974490612745285, 0.03853540122509003, 0.015639184042811394, -0.009296313859522343, -0.012474780902266502, 0.0040680160745978355, -0.012664644978940487, 0.017045585438609123, -0.004521580878645182, -0.015132879838347435, -0.0247526653110981, 0.03341609984636307, 0.028718717396259308, 0.015596992336213589, 0.05344325676560402, 0.0001705261820461601, 0.020097477361559868, 0.006620634812861681, 0.030743936076760292, -0.0026739207096397877, 0.025554314255714417, 0.020252181217074394, -0.005562317557632923, -0.010815227404236794, -0.015104752033948898, -0.010147186927497387, -0.0056748297065496445, -0.013213141821324825, -0.020927254110574722, 0.016708049923181534, 0.012221628800034523, 0.09467894583940506, 0.01810038648545742, -0.012566196732223034, 0.009633850306272507, -0.009451017715036869, 0.010920707136392593, 0.008691561408340931, 0.022769639268517494, 0.0076648881658911705, -0.010878515429794788, -0.002415494527667761, -0.011659068055450916, -0.012559165246784687, -0.015132879838347435, 0.020800678059458733, -0.003934408072382212, -0.01071677915751934, 0.015639184042811394, 0.005646701902151108, -0.0022396943531930447, 0.04199514910578728, -0.012594325467944145, 0.006195198278874159, 0.005344325676560402, -0.012052860110998154, 0.022178951650857925, 0.029421918094158173, 0.0042367842979729176, 0.0032259332947432995, -0.018114451318979263, 0.03265664353966713, 0.018466051667928696, -0.05015227571129799, -0.019197380170226097, -0.009493209421634674, -0.008550920523703098, 0.004859116859734058, -0.013311590068042278, -0.005752182099968195, 0.005586929619312286, 0.005833050236105919, 0.0020709261298179626, -0.014338262379169464, -0.026918523013591766, 0.024991754442453384, -0.013072501868009567, -0.015146943740546703, -0.02002715691924095, -0.028057709336280823], metadata={'title': \"Beyond GPT-4: What's New?\", 'url': 'https://pub.towardsai.net/beyond-gpt-4-whats-new-cbd61a448eb9#dda8', 'source_name': 'towards_ai'}, excluded_embed_metadata_keys=[], excluded_llm_metadata_keys=[], relationships={<NodeRelationship.SOURCE: '1'>: RelatedNodeInfo(node_id='doc_0', node_type=<ObjectType.DOCUMENT: '4'>, metadata={'title': \"Beyond GPT-4: What's New?\", 'url': 'https://pub.towardsai.net/beyond-gpt-4-whats-new-cbd61a448eb9#dda8', 'source_name': 'towards_ai'}, hash='3b095b0e25cdf965d950cdbd7feb8024030e7645998c1a33dc4427affca624ab'), <NodeRelationship.NEXT: '3'>: RelatedNodeInfo(node_id='e470fa0d001e50b3ec3088022462a94ea7c87dd80106411b7d120f90b379e977', node_type=<ObjectType.TEXT: '1'>, metadata={}, hash='71418de3d50e604c2581574f1abf2248e5cc3ab7c74a3182c37cb1152d0cfd21')}, text='LLM Variants and Meta\\'s Open Source Before shedding light on four major trends, I\\'d share the latest Meta\\'s Llama 2 and Code Llama. Meta\\'s Llama 2 represents a sophisticated evolution in LLMs. This suite spans models pretrained and fine-tuned across a parameter spectrum of 7 billion to 70 billion. A specialized derivative, Llama 2-Chat, has been engineered explicitly for dialogue-centric applications. Benchmarking revealed Llama 2\\'s superior performance over most extant open-source chat models. Human-centric evaluations, focusing on safety and utility metrics, positioned Llama 2-Chat as a potential contender against proprietary, closed-source counterparts. The development trajectory of Llama 2 emphasized rigorous fine-tuning methodologies. Meta\\'s transparent delineation of these processes aims to catalyze community-driven advancements in LLMs, underscoring a commitment to collaborative and responsible AI development. Code Llama is built on top of Llama 2 and is available in three models: Code Llama, the foundational code model;Codel Llama - Python specialized for Python;and Code Llama - Instruct, which is fine-tuned for understanding natural language instructions. Based on its benchmark testing, Code Llama outperformed state-of-the-art publicly available LLMs (except GPT-4) on code tasks. Llama 2, Llama 2-Chat, and Code Llama are key steps in LLM development but still have a way to go compared to GPT-4. Meta\\'s open access and commitment to improving these models promise transparent and faster LLM progress in the future. Please refer to the LLM and Llama variants below: From LLMs to Multimodal LLMs, like OpenAI\\'s ChatGPT (GPT-3.5), primarily focus on understanding and generating human language. They\\'ve been instrumental in tasks like text generation, translation, and even creative writing. However, their scope is limited to text. Enter multimodal models like GPT-4. These are a new breed of AI models that can understand and generate not just text, but also images, sounds, and potentially other types of data. The term \"multimodal\" refers to their ability to process multiple modes or', start_char_idx=0, end_char_idx=2117, text_template='{metadata_str}\\n\\n{content}', metadata_template='{key}: {value}', metadata_seperator='\\n')"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"nodes[0]"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "EV0ll57p46Dc"
},
"source": [
"# Load Indexes"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"id": "PS215gCGkGD-"
},
"outputs": [],
"source": [
"# Create your index\n",
"db = chromadb.PersistentClient(path=\"./mini-llama-articles\")\n",
"chroma_collection = db.get_or_create_collection(\"mini-llama-articles\")\n",
"vector_store = ChromaVectorStore(chroma_collection=chroma_collection)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"id": "HbT3-kRO4Qpt"
},
"outputs": [],
"source": [
"# Create your index\n",
"from llama_index.core import VectorStoreIndex\n",
"\n",
"index = VectorStoreIndex.from_vector_store(vector_store)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"id": "sb61DWU84bHP"
},
"outputs": [],
"source": [
"query_engine = index.as_query_engine()"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"id": "G32W2LMMCmnv"
},
"outputs": [],
"source": [
"res = query_engine.query(\"How many parameters LLaMA2 model has?\")"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 53
},
"id": "obc20cU5Cxf2",
"outputId": "837babce-9edf-4a3f-f996-c0c407ae027c"
},
"outputs": [
{
"data": {
"text/plain": [
"'The Llama 2 model is available in four different sizes: 7 billion, 13 billion, 34 billion, and 70 billion parameters.'"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"res.response"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "oIAO-saJCzYe",
"outputId": "bce85c7c-502c-4a7b-f3e2-f721f3d6b5a4"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Node ID\t f707756065d1f788b41fb97fcef81979e1fd241dbfa4034a24bec8e57b648482\n",
"Title\t Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\n",
"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",
"Score\t 0.7122361910421624\n",
"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n",
"Node ID\t 636f98cf8754c3a4759da02aa11a3f2aa7cdeb848a4980ec99300ece4a2e92fd\n",
"Title\t Meta's Llama 2: Revolutionizing Open Source Language Models for Commercial Use\n",
"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",
"Score\t 0.7047493574957753\n",
"-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_\n"
]
}
],
"source": [
"for src in res.source_nodes:\n",
" print(\"Node ID\\t\", src.node_id)\n",
" print(\"Title\\t\", src.metadata['title'])\n",
" print(\"Text\\t\", src.text)\n",
" print(\"Score\\t\", src.score)\n",
" print(\"-_\"*20)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "d4xxZHbdN0lK"
},
"source": [
"# Evaluate the retrieval process and quality of answers\n",
"\n",
"We can evaluate our RAG system with a dataset of questions and associated chunks. Given a question, we can see if the RAG system retrieves the correct chunks of text that can answer the question.\n",
"\n",
"You can generate a synthetic dataset with an LLM such as `gpt-3.5-turbo` or create an authentic and manually curated dataset. \n",
"\n",
"Note that a **well curated dataset will always be a better option**, especially for a specific domain or use case.\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In our example, we will generate a synthetic dataset using `gpt-3.5-turbo` to make it simple.\n",
"\n",
"This is the default prompt that the `generate_question_context_pairs` function will uses:\n",
"\n",
"```python\n",
"DEFAULT_QA_GENERATE_PROMPT_TMPL = \"\"\"\\\n",
"Context information is below.\n",
"\n",
"---------------------\n",
"{context_str}\n",
"---------------------\n",
"\n",
"Given the context information and no prior knowledge,\n",
"generate only questions based on the below query.\n",
"\n",
"You are a Teacher/Professor. Your task is to setup \\\n",
"{num_questions_per_chunk} questions for an upcoming \\\n",
"quiz/examination. The questions should be diverse in nature \\\n",
"across the document. Restrict the questions to the \\\n",
"context information provided.\"\n",
"\"\"\"\n",
"```\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"100%|ββββββββββ| 108/108 [05:59<00:00, 3.33s/it]\n"
]
}
],
"source": [
"from llama_index.core.evaluation import generate_question_context_pairs\n",
"from llama_index.llms.openai import OpenAI\n",
"\n",
"llm = OpenAI(model=\"gpt-3.5-turbo-0125\")\n",
"rag_eval_dataset = generate_question_context_pairs(\n",
" nodes,\n",
" llm=llm,\n",
" num_questions_per_chunk=1\n",
")\n",
"# We can save the dataset as a json file for later use.\n",
"rag_eval_dataset.save_json(\"./rag_eval_dataset.json\")"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"# We can also load the dataset from a previously saved json file.\n",
"from llama_index.core.evaluation import EmbeddingQAFinetuneDataset\n",
"rag_eval_dataset = EmbeddingQAFinetuneDataset.from_json(\n",
" \"./rag_eval_dataset.json\"\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Evaluation for Hit Rate and Mean Reciprocal Rank (MRR)\n",
"\n",
"We will make use of `RetrieverEvaluator` available in Llama-index. We will measure the Hit Rate and Mean Reciprocal Rank (MRR).\n",
"\n",
"**Hit Rate:**\n",
"\n",
"Think of the Hit Rate like playing a game of guessing. You're given a question and you need to guess the correct answer from a list of options. The Hit Rate measures how often you guess the correct answer by only looking at your top few guesses. If you often find the right answer in your first few guesses, you have a high Hit Rate. So, in the context of a retrieval system, it's about how frequently the system finds the correct document within its top 'k' picks (where 'k' is a number you decide, like top 5 or top 10).\n",
"\n",
"**Mean Reciprocal Rank (MRR):**\n",
"\n",
"MRR is a bit like measuring how quickly you can find a treasure in a list of boxes. Imagine you have a row of boxes and only one of them has a treasure. The MRR calculates how close to the start of the row the treasure box is, on average. If the treasure is always in the first box you open, you're doing great and have an MRR of 1. If it's in the second box, the score is 1/2, since you took two tries to find it. If it's in the third box, your score is 1/3, and so on. MRR averages these scores across all your searches. So, for a retrieval system, MRR looks at where the correct document ranks in the system's guesses. If it's usually near the top, the MRR will be high, indicating good performance.\n",
"In summary, Hit Rate tells you how often the system gets it right in its top guesses, and MRR tells you how close to the top the right answer usually is. Both metrics are useful for evaluating the effectiveness of a retrieval system, like how well a search engine or a recommendation system works."
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"\n",
"def display_results_retriever(name, eval_results):\n",
" \"\"\"Display results from evaluate.\"\"\"\n",
"\n",
" metric_dicts = []\n",
" for eval_result in eval_results:\n",
" metric_dict = eval_result.metric_vals_dict\n",
" metric_dicts.append(metric_dict)\n",
"\n",
" full_df = pd.DataFrame(metric_dicts)\n",
"\n",
" hit_rate = full_df[\"hit_rate\"].mean()\n",
" mrr = full_df[\"mrr\"].mean()\n",
"\n",
" metric_df = pd.DataFrame(\n",
" {\"Retriever Name\": [name], \"Hit Rate\": [hit_rate], \"MRR\": [mrr]}\n",
" )\n",
"\n",
" return metric_df"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" Retriever Name Hit Rate MRR\n",
"0 Retriever top_2 0.703557 0.570158\n",
" Retriever Name Hit Rate MRR\n",
"0 Retriever top_4 0.822134 0.606884\n",
" Retriever Name Hit Rate MRR\n",
"0 Retriever top_6 0.857708 0.613472\n",
" Retriever Name Hit Rate MRR\n",
"0 Retriever top_8 0.883399 0.616937\n",
" Retriever Name Hit Rate MRR\n",
"0 Retriever top_10 0.901186 0.61904\n"
]
}
],
"source": [
"from llama_index.core.evaluation import RetrieverEvaluator\n",
"\n",
"# We can evaluate the retievers with different top_k values.\n",
"for i in [2, 4, 6, 8, 10]:\n",
" retriever = index.as_retriever(similarity_top_k=i)\n",
" retriever_evaluator = RetrieverEvaluator.from_metric_names(\n",
" [\"mrr\", \"hit_rate\"], retriever=retriever\n",
" )\n",
" eval_results = await retriever_evaluator.aevaluate_dataset(rag_eval_dataset, workers=32)\n",
" print(display_results_retriever(f\"Retriever top_{i}\", eval_results))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Evaluation using Relevance and Faithfulness metrics.\n",
"\n",
"Here, we evaluate the answer generated by the LLM. Is the answer using the correct context? Is the answer faithful to the context? Is the answer relevant to the question?\n",
"\n",
"An LLM will answer these questions, more specifically `gpt-4-0125-preview`.\n",
"\n",
"**`FaithfulnessEvaluator`**\n",
"Evaluates if the answer is faithful to the retrieved contexts (in other words, whether there's an hallucination).\n",
"\n",
"**`RelevancyEvaluator`**\n",
"Evaluates whether the retrieved context and answer are relevant to the user question.\n",
"\n",
"\n",
"Now, let's see how the top_k value affects these two metrics."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"top_2 faithfulness_score: 1.0\n",
"top_2 relevancy_score: 1.0\n",
"top_4 faithfulness_score: 1.0\n",
"top_4 relevancy_score: 0.95\n",
"top_6 faithfulness_score: 1.0\n",
"top_6 relevancy_score: 0.95\n",
"top_8 faithfulness_score: 0.65\n",
"top_8 relevancy_score: 0.7\n",
"top_10 faithfulness_score: 0.45\n",
"top_10 relevancy_score: 0.5\n"
]
}
],
"source": [
"from llama_index.core.evaluation import RelevancyEvaluator, FaithfulnessEvaluator, BatchEvalRunner\n",
"from llama_index.llms.openai import OpenAI\n",
"\n",
"llm_gpt4 = OpenAI(temperature=0, model=\"gpt-4-0125-preview\")\n",
"\n",
"faithfulness_evaluator = FaithfulnessEvaluator(llm=llm_gpt4)\n",
"relevancy_evaluator = RelevancyEvaluator(llm=llm_gpt4)\n",
"\n",
"# Run evaluation\n",
"queries = list(rag_eval_dataset.queries.values())\n",
"batch_eval_queries = queries[:20]\n",
"\n",
"runner = BatchEvalRunner(\n",
"{\"faithfulness\": faithfulness_evaluator, \"relevancy\": relevancy_evaluator},\n",
"workers=32,\n",
")\n",
"\n",
"for i in [2, 4, 6, 8, 10]:\n",
" # Set Faithfulness and Relevancy evaluators\n",
" query_engine = index.as_query_engine(similarity_top_k=i)\n",
"\n",
" eval_results = await runner.aevaluate_queries(\n",
" query_engine, queries=batch_eval_queries\n",
" )\n",
" faithfulness_score = sum(result.passing for result in eval_results['faithfulness']) / len(eval_results['faithfulness'])\n",
" print(f\"top_{i} faithfulness_score: {faithfulness_score}\")\n",
"\n",
" relevancy_score = sum(result.passing for result in eval_results['relevancy']) / len(eval_results['relevancy'])\n",
" print(f\"top_{i} relevancy_score: {relevancy_score}\")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"colab": {
"authorship_tag": "ABX9TyOnRtEA1r5V6nZnTDjOEHPs",
"include_colab_link": true,
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
"01d27fdbe86a4ca2830b9bf3ccbf1ae9": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "ProgressStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"076728d713254b49935c7938d18014f2": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_121dbf44a222434cbc57ebe6beb83e2a",
"placeholder": "β",
"style": "IPY_MODEL_2af0821ebb7e47988d134d4ec2776e87",
"value": " 108/108 [00:34<00:00, 3.66it/s]"
}
},
"10340f8e7c8e482c8d35047a3e43ee7f": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"1095efa793804a3fb625855e715a5317": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"121dbf44a222434cbc57ebe6beb83e2a": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"2073b65c0db045aa8e86d91a4fea2e2b": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"2af0821ebb7e47988d134d4ec2776e87": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"665b9b5e85a34be8a20d40c51e57cfe0": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_85f23ab21c3b404aaa146cfcaefc85d8",
"placeholder": "β",
"style": "IPY_MODEL_10340f8e7c8e482c8d35047a3e43ee7f",
"value": "Generating embeddings: 100%"
}
},
"6c575687c8f1468a803b88eea3d26b7b": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_eb057e56f0f94e4993b8ae960c78b0ad",
"placeholder": "β",
"style": "IPY_MODEL_2073b65c0db045aa8e86d91a4fea2e2b",
"value": "Parsing nodes: 100%"
}
},
"70e17db8fc2f490f85b7af8aa664f0c7": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "DescriptionStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "DescriptionStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"description_width": ""
}
},
"76fea2dabfea42aa8bc7ae719f2a22ee": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HBoxModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_6c575687c8f1468a803b88eea3d26b7b",
"IPY_MODEL_c266531dafcf4624af5fe9bcbc9d8df9",
"IPY_MODEL_e20a27a2f7764cb4b9537e34a3659c9a"
],
"layout": "IPY_MODEL_bba307f545cd4533be6f0489f95b9895"
}
},
"8141417665024172a4baa78c497acb69": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"85f23ab21c3b404aaa146cfcaefc85d8": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"b43a5a6a65034a16927700e442dde52a": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "ProgressStyleModel",
"state": {
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "ProgressStyleModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "StyleView",
"bar_color": null,
"description_width": ""
}
},
"b604cef3deca4847afcc459e5c8a9e0f": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "FloatProgressModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_1095efa793804a3fb625855e715a5317",
"max": 108,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_b43a5a6a65034a16927700e442dde52a",
"value": 108
}
},
"bba307f545cd4533be6f0489f95b9895": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"be591abb84a24c4b9903087501ebb0e5": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"c0a70bcdf3fb4bbfb2675b8012b2ef24": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HBoxModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HBoxModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HBoxView",
"box_style": "",
"children": [
"IPY_MODEL_665b9b5e85a34be8a20d40c51e57cfe0",
"IPY_MODEL_b604cef3deca4847afcc459e5c8a9e0f",
"IPY_MODEL_076728d713254b49935c7938d18014f2"
],
"layout": "IPY_MODEL_be591abb84a24c4b9903087501ebb0e5"
}
},
"c266531dafcf4624af5fe9bcbc9d8df9": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "FloatProgressModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "FloatProgressModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "ProgressView",
"bar_style": "success",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_8141417665024172a4baa78c497acb69",
"max": 14,
"min": 0,
"orientation": "horizontal",
"style": "IPY_MODEL_01d27fdbe86a4ca2830b9bf3ccbf1ae9",
"value": 14
}
},
"e20a27a2f7764cb4b9537e34a3659c9a": {
"model_module": "@jupyter-widgets/controls",
"model_module_version": "1.5.0",
"model_name": "HTMLModel",
"state": {
"_dom_classes": [],
"_model_module": "@jupyter-widgets/controls",
"_model_module_version": "1.5.0",
"_model_name": "HTMLModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/controls",
"_view_module_version": "1.5.0",
"_view_name": "HTMLView",
"description": "",
"description_tooltip": null,
"layout": "IPY_MODEL_e4fe85a095e64d52b6a53c2a4bba8aeb",
"placeholder": "β",
"style": "IPY_MODEL_70e17db8fc2f490f85b7af8aa664f0c7",
"value": " 14/14 [00:00<00:00, 26.60it/s]"
}
},
"e4fe85a095e64d52b6a53c2a4bba8aeb": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
},
"eb057e56f0f94e4993b8ae960c78b0ad": {
"model_module": "@jupyter-widgets/base",
"model_module_version": "1.2.0",
"model_name": "LayoutModel",
"state": {
"_model_module": "@jupyter-widgets/base",
"_model_module_version": "1.2.0",
"_model_name": "LayoutModel",
"_view_count": null,
"_view_module": "@jupyter-widgets/base",
"_view_module_version": "1.2.0",
"_view_name": "LayoutView",
"align_content": null,
"align_items": null,
"align_self": null,
"border": null,
"bottom": null,
"display": null,
"flex": null,
"flex_flow": null,
"grid_area": null,
"grid_auto_columns": null,
"grid_auto_flow": null,
"grid_auto_rows": null,
"grid_column": null,
"grid_gap": null,
"grid_row": null,
"grid_template_areas": null,
"grid_template_columns": null,
"grid_template_rows": null,
"height": null,
"justify_content": null,
"justify_items": null,
"left": null,
"margin": null,
"max_height": null,
"max_width": null,
"min_height": null,
"min_width": null,
"object_fit": null,
"object_position": null,
"order": null,
"overflow": null,
"overflow_x": null,
"overflow_y": null,
"padding": null,
"right": null,
"top": null,
"visibility": null,
"width": null
}
}
}
}
},
"nbformat": 4,
"nbformat_minor": 0
}
|