Spaces:
Sleeping
Sleeping
File size: 130,632 Bytes
7a56e2a |
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 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 |
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Retriever Evaluation with MLflow"
]
},
{
"cell_type": "raw",
"metadata": {},
"source": [
"<a href=\"https://raw.githubusercontent.com/mlflow/mlflow/master/docs/source/llms/rag/notebooks/retriever-evaluation-tutorial.ipynb\" class=\"notebook-download-btn\"><i class=\"fas fa-download\"></i>Download this Notebook</a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "f8938de9-7fae-41cd-ad6b-7ee26c288eab",
"showTitle": false,
"title": ""
}
},
"source": [
"In MLflow 2.8.0, we introduced a new model type \"retriever\" to the `mlflow.evaluate()` API. It helps you to evaluate the retriever in a RAG application. It contains two built-in metrics `precision_at_k` and `recall_at_k`. In MLflow 2.9.0, `ndcg_at_k` is available.\n",
"\n",
"This notebook illustrates how to use `mlflow.evaluate()` to evaluate the retriever in a RAG application. It has the following steps:\n",
"\n",
"* Step 1: Install and Load Packages\n",
"* Step 2: Evaluation Dataset Preparation\n",
"* Step 3: Calling `mlflow.evaluate()`\n",
"* Step 4: Result Analysis and Visualization"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Step 1: Install and Load Packages"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "5bf12edb-2498-4edd-aeff-b4844451850f",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting mlflow==2.9.0\n",
" Downloading mlflow-2.9.0-py3-none-any.whl.metadata (13 kB)\n",
"Collecting langchain==0.0.339\n",
" Downloading langchain-0.0.339-py3-none-any.whl.metadata (16 kB)\n",
"Requirement already satisfied: openai in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (1.23.1)\n",
"Collecting faiss-cpu\n",
" Downloading faiss_cpu-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.6 kB)\n",
"Collecting gensim\n",
" Downloading gensim-4.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (8.5 kB)\n",
"Collecting nltk\n",
" Downloading nltk-3.8.1-py3-none-any.whl.metadata (2.8 kB)\n",
"Collecting pyLDAvis\n",
" Downloading pyLDAvis-3.4.1-py3-none-any.whl.metadata (4.2 kB)\n",
"Requirement already satisfied: tiktoken in /u/marshad/.local/lib/python3.9/site-packages (0.6.0)\n",
"Requirement already satisfied: click<9,>=7.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (8.1.7)\n",
"Collecting cloudpickle<4 (from mlflow==2.9.0)\n",
" Downloading cloudpickle-3.0.0-py3-none-any.whl.metadata (7.0 kB)\n",
"Collecting databricks-cli<1,>=0.8.7 (from mlflow==2.9.0)\n",
" Downloading databricks_cli-0.18.0-py2.py3-none-any.whl.metadata (4.0 kB)\n",
"Collecting entrypoints<1 (from mlflow==2.9.0)\n",
" Downloading entrypoints-0.4-py3-none-any.whl.metadata (2.6 kB)\n",
"Requirement already satisfied: gitpython<4,>=2.1.0 in /u/marshad/.local/lib/python3.9/site-packages (from mlflow==2.9.0) (3.1.43)\n",
"Requirement already satisfied: pyyaml<7,>=5.1 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (6.0.1)\n",
"Requirement already satisfied: protobuf<5,>=3.12.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (4.25.3)\n",
"Collecting pytz<2024 (from mlflow==2.9.0)\n",
" Downloading pytz-2023.4-py2.py3-none-any.whl.metadata (22 kB)\n",
"Requirement already satisfied: requests<3,>=2.17.3 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (2.31.0)\n",
"Requirement already satisfied: packaging<24 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (23.2)\n",
"Requirement already satisfied: importlib-metadata!=4.7.0,<8,>=3.7.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (7.0.0)\n",
"Collecting sqlparse<1,>=0.4.0 (from mlflow==2.9.0)\n",
" Downloading sqlparse-0.5.0-py3-none-any.whl.metadata (3.9 kB)\n",
"Collecting alembic!=1.10.0,<2 (from mlflow==2.9.0)\n",
" Downloading alembic-1.13.1-py3-none-any.whl.metadata (7.4 kB)\n",
"Collecting docker<7,>=4.0.0 (from mlflow==2.9.0)\n",
" Downloading docker-6.1.3-py3-none-any.whl.metadata (3.5 kB)\n",
"Collecting Flask<4 (from mlflow==2.9.0)\n",
" Downloading flask-3.0.3-py3-none-any.whl.metadata (3.2 kB)\n",
"Requirement already satisfied: numpy<2 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (1.26.4)\n",
"Requirement already satisfied: scipy<2 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (1.13.0)\n",
"Requirement already satisfied: pandas<3 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (2.2.2)\n",
"Collecting querystring-parser<2 (from mlflow==2.9.0)\n",
" Downloading querystring_parser-1.2.4-py2.py3-none-any.whl.metadata (559 bytes)\n",
"Requirement already satisfied: sqlalchemy<3,>=1.4.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (2.0.29)\n",
"Requirement already satisfied: scikit-learn<2 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (1.4.2)\n",
"Collecting pyarrow<15,>=4.0.0 (from mlflow==2.9.0)\n",
" Downloading pyarrow-14.0.2-cp39-cp39-manylinux_2_28_x86_64.whl.metadata (3.0 kB)\n",
"Collecting markdown<4,>=3.3 (from mlflow==2.9.0)\n",
" Downloading Markdown-3.6-py3-none-any.whl.metadata (7.0 kB)\n",
"Requirement already satisfied: matplotlib<4 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (3.8.4)\n",
"Collecting gunicorn<22 (from mlflow==2.9.0)\n",
" Downloading gunicorn-21.2.0-py3-none-any.whl.metadata (4.1 kB)\n",
"Requirement already satisfied: Jinja2<4,>=2.11 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from mlflow==2.9.0) (3.1.3)\n",
"Requirement already satisfied: aiohttp<4.0.0,>=3.8.3 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from langchain==0.0.339) (3.9.5)\n",
"Collecting anyio<4.0 (from langchain==0.0.339)\n",
" Downloading anyio-3.7.1-py3-none-any.whl.metadata (4.7 kB)\n",
"Requirement already satisfied: async-timeout<5.0.0,>=4.0.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from langchain==0.0.339) (4.0.3)\n",
"Requirement already satisfied: dataclasses-json<0.7,>=0.5.7 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from langchain==0.0.339) (0.6.4)\n",
"Requirement already satisfied: jsonpatch<2.0,>=1.33 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from langchain==0.0.339) (1.33)\n",
"Collecting langsmith<0.1.0,>=0.0.63 (from langchain==0.0.339)\n",
" Downloading langsmith-0.0.92-py3-none-any.whl.metadata (9.9 kB)\n",
"Requirement already satisfied: pydantic<3,>=1 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from langchain==0.0.339) (2.7.0)\n",
"Requirement already satisfied: tenacity<9.0.0,>=8.1.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from langchain==0.0.339) (8.2.3)\n",
"Requirement already satisfied: distro<2,>=1.7.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from openai) (1.9.0)\n",
"Requirement already satisfied: httpx<1,>=0.23.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from openai) (0.27.0)\n",
"Requirement already satisfied: sniffio in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from openai) (1.3.1)\n",
"Requirement already satisfied: tqdm>4 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from openai) (4.66.2)\n",
"Requirement already satisfied: typing-extensions<5,>=4.7 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from openai) (4.11.0)\n",
"Collecting smart-open>=1.8.1 (from gensim)\n",
" Downloading smart_open-7.0.4-py3-none-any.whl.metadata (23 kB)\n",
"Requirement already satisfied: joblib in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from nltk) (1.4.0)\n",
"Requirement already satisfied: regex>=2021.8.3 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from nltk) (2024.4.16)\n",
"Collecting numexpr (from pyLDAvis)\n",
" Downloading numexpr-2.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.9 kB)\n",
"Collecting funcy (from pyLDAvis)\n",
" Downloading funcy-2.0-py2.py3-none-any.whl.metadata (5.9 kB)\n",
"Requirement already satisfied: setuptools in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pyLDAvis) (68.2.2)\n",
"Requirement already satisfied: aiosignal>=1.1.2 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.0.339) (1.3.1)\n",
"Requirement already satisfied: attrs>=17.3.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.0.339) (23.2.0)\n",
"Requirement already satisfied: frozenlist>=1.1.1 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.0.339) (1.4.1)\n",
"Requirement already satisfied: multidict<7.0,>=4.5 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.0.339) (6.0.5)\n",
"Requirement already satisfied: yarl<2.0,>=1.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from aiohttp<4.0.0,>=3.8.3->langchain==0.0.339) (1.9.4)\n",
"Collecting Mako (from alembic!=1.10.0,<2->mlflow==2.9.0)\n",
" Downloading Mako-1.3.3-py3-none-any.whl.metadata (2.9 kB)\n",
"Requirement already satisfied: idna>=2.8 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from anyio<4.0->langchain==0.0.339) (3.7)\n",
"Requirement already satisfied: exceptiongroup in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from anyio<4.0->langchain==0.0.339) (1.2.0)\n",
"Collecting pyjwt>=1.7.0 (from databricks-cli<1,>=0.8.7->mlflow==2.9.0)\n",
" Downloading PyJWT-2.8.0-py3-none-any.whl.metadata (4.2 kB)\n",
"Requirement already satisfied: oauthlib>=3.1.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from databricks-cli<1,>=0.8.7->mlflow==2.9.0) (3.2.2)\n",
"Collecting tabulate>=0.7.7 (from databricks-cli<1,>=0.8.7->mlflow==2.9.0)\n",
" Downloading tabulate-0.9.0-py3-none-any.whl.metadata (34 kB)\n",
"Requirement already satisfied: six>=1.10.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from databricks-cli<1,>=0.8.7->mlflow==2.9.0) (1.16.0)\n",
"Requirement already satisfied: urllib3<3,>=1.26.7 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from databricks-cli<1,>=0.8.7->mlflow==2.9.0) (2.2.1)\n",
"Requirement already satisfied: marshmallow<4.0.0,>=3.18.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain==0.0.339) (3.21.1)\n",
"Requirement already satisfied: typing-inspect<1,>=0.4.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from dataclasses-json<0.7,>=0.5.7->langchain==0.0.339) (0.9.0)\n",
"Requirement already satisfied: websocket-client>=0.32.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from docker<7,>=4.0.0->mlflow==2.9.0) (1.7.0)\n",
"Collecting Werkzeug>=3.0.0 (from Flask<4->mlflow==2.9.0)\n",
" Downloading werkzeug-3.0.2-py3-none-any.whl.metadata (4.1 kB)\n",
"Collecting itsdangerous>=2.1.2 (from Flask<4->mlflow==2.9.0)\n",
" Downloading itsdangerous-2.2.0-py3-none-any.whl.metadata (1.9 kB)\n",
"Requirement already satisfied: blinker>=1.6.2 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from Flask<4->mlflow==2.9.0) (1.7.0)\n",
"Requirement already satisfied: gitdb<5,>=4.0.1 in /u/marshad/.local/lib/python3.9/site-packages (from gitpython<4,>=2.1.0->mlflow==2.9.0) (4.0.11)\n",
"Requirement already satisfied: certifi in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from httpx<1,>=0.23.0->openai) (2024.2.2)\n",
"Requirement already satisfied: httpcore==1.* in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from httpx<1,>=0.23.0->openai) (1.0.5)\n",
"Requirement already satisfied: h11<0.15,>=0.13 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
"Requirement already satisfied: zipp>=0.5 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from importlib-metadata!=4.7.0,<8,>=3.7.0->mlflow==2.9.0) (3.17.0)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from Jinja2<4,>=2.11->mlflow==2.9.0) (2.1.5)\n",
"Requirement already satisfied: jsonpointer>=1.9 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from jsonpatch<2.0,>=1.33->langchain==0.0.339) (2.4)\n",
"Requirement already satisfied: contourpy>=1.0.1 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from matplotlib<4->mlflow==2.9.0) (1.2.1)\n",
"Requirement already satisfied: cycler>=0.10 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from matplotlib<4->mlflow==2.9.0) (0.12.1)\n",
"Requirement already satisfied: fonttools>=4.22.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from matplotlib<4->mlflow==2.9.0) (4.51.0)\n",
"Requirement already satisfied: kiwisolver>=1.3.1 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from matplotlib<4->mlflow==2.9.0) (1.4.5)\n",
"Requirement already satisfied: pillow>=8 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from matplotlib<4->mlflow==2.9.0) (10.3.0)\n",
"Requirement already satisfied: pyparsing>=2.3.1 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from matplotlib<4->mlflow==2.9.0) (3.1.2)\n",
"Requirement already satisfied: python-dateutil>=2.7 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from matplotlib<4->mlflow==2.9.0) (2.9.0)\n",
"Requirement already satisfied: importlib-resources>=3.2.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from matplotlib<4->mlflow==2.9.0) (6.4.0)\n",
"Requirement already satisfied: tzdata>=2022.7 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pandas<3->mlflow==2.9.0) (2024.1)\n",
"Requirement already satisfied: annotated-types>=0.4.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pydantic<3,>=1->langchain==0.0.339) (0.6.0)\n",
"Requirement already satisfied: pydantic-core==2.18.1 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pydantic<3,>=1->langchain==0.0.339) (2.18.1)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from requests<3,>=2.17.3->mlflow==2.9.0) (3.3.2)\n",
"Requirement already satisfied: threadpoolctl>=2.0.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from scikit-learn<2->mlflow==2.9.0) (3.4.0)\n",
"Requirement already satisfied: wrapt in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from smart-open>=1.8.1->gensim) (1.16.0)\n",
"Requirement already satisfied: greenlet!=0.4.17 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from sqlalchemy<3,>=1.4.0->mlflow==2.9.0) (3.0.3)\n",
"Requirement already satisfied: smmap<6,>=3.0.1 in /u/marshad/.local/lib/python3.9/site-packages (from gitdb<5,>=4.0.1->gitpython<4,>=2.1.0->mlflow==2.9.0) (5.0.1)\n",
"Requirement already satisfied: mypy-extensions>=0.3.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from typing-inspect<1,>=0.4.0->dataclasses-json<0.7,>=0.5.7->langchain==0.0.339) (1.0.0)\n",
"Downloading mlflow-2.9.0-py3-none-any.whl (19.1 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m19.1/19.1 MB\u001b[0m \u001b[31m48.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m00:01\u001b[0m\n",
"\u001b[?25hDownloading langchain-0.0.339-py3-none-any.whl (2.0 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.0/2.0 MB\u001b[0m \u001b[31m69.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading faiss_cpu-1.8.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (27.0 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m27.0/27.0 MB\u001b[0m \u001b[31m65.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m00:01\u001b[0m\n",
"\u001b[?25hDownloading gensim-4.3.2-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (26.6 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m26.6/26.6 MB\u001b[0m \u001b[31m71.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m00:01\u001b[0m\n",
"\u001b[?25hDownloading nltk-3.8.1-py3-none-any.whl (1.5 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.5/1.5 MB\u001b[0m \u001b[31m76.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading pyLDAvis-3.4.1-py3-none-any.whl (2.6 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.6/2.6 MB\u001b[0m \u001b[31m95.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading alembic-1.13.1-py3-none-any.whl (233 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m233.4/233.4 kB\u001b[0m \u001b[31m21.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading anyio-3.7.1-py3-none-any.whl (80 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m80.9/80.9 kB\u001b[0m \u001b[31m8.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading cloudpickle-3.0.0-py3-none-any.whl (20 kB)\n",
"Downloading databricks_cli-0.18.0-py2.py3-none-any.whl (150 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m150.3/150.3 kB\u001b[0m \u001b[31m14.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading docker-6.1.3-py3-none-any.whl (148 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m148.1/148.1 kB\u001b[0m \u001b[31m16.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading entrypoints-0.4-py3-none-any.whl (5.3 kB)\n",
"Downloading flask-3.0.3-py3-none-any.whl (101 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m101.7/101.7 kB\u001b[0m \u001b[31m11.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading gunicorn-21.2.0-py3-none-any.whl (80 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m80.2/80.2 kB\u001b[0m \u001b[31m7.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading langsmith-0.0.92-py3-none-any.whl (56 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m56.5/56.5 kB\u001b[0m \u001b[31m4.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading Markdown-3.6-py3-none-any.whl (105 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m105.4/105.4 kB\u001b[0m \u001b[31m10.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading pyarrow-14.0.2-cp39-cp39-manylinux_2_28_x86_64.whl (38.0 MB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m38.0/38.0 MB\u001b[0m \u001b[31m46.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m:00:01\u001b[0m00:01\u001b[0m\n",
"\u001b[?25hDownloading pytz-2023.4-py2.py3-none-any.whl (506 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m506.5/506.5 kB\u001b[0m \u001b[31m23.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading querystring_parser-1.2.4-py2.py3-none-any.whl (7.9 kB)\n",
"Downloading smart_open-7.0.4-py3-none-any.whl (61 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m61.2/61.2 kB\u001b[0m \u001b[31m5.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading sqlparse-0.5.0-py3-none-any.whl (43 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m44.0/44.0 kB\u001b[0m \u001b[31m3.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading funcy-2.0-py2.py3-none-any.whl (30 kB)\n",
"Downloading numexpr-2.10.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (375 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m375.6/375.6 kB\u001b[0m \u001b[31m28.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading itsdangerous-2.2.0-py3-none-any.whl (16 kB)\n",
"Downloading PyJWT-2.8.0-py3-none-any.whl (22 kB)\n",
"Downloading tabulate-0.9.0-py3-none-any.whl (35 kB)\n",
"Downloading werkzeug-3.0.2-py3-none-any.whl (226 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m226.8/226.8 kB\u001b[0m \u001b[31m14.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hDownloading Mako-1.3.3-py3-none-any.whl (78 kB)\n",
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m78.8/78.8 kB\u001b[0m \u001b[31m7.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
"\u001b[?25hInstalling collected packages: pytz, funcy, Werkzeug, tabulate, sqlparse, smart-open, querystring-parser, pyjwt, pyarrow, numexpr, nltk, Mako, itsdangerous, gunicorn, faiss-cpu, entrypoints, cloudpickle, anyio, markdown, gensim, Flask, docker, databricks-cli, alembic, pyLDAvis, mlflow, langsmith, langchain\n",
" Attempting uninstall: pytz\n",
" Found existing installation: pytz 2024.1\n",
" Uninstalling pytz-2024.1:\n",
" Successfully uninstalled pytz-2024.1\n",
" Attempting uninstall: pyarrow\n",
" Found existing installation: pyarrow 15.0.2\n",
" Uninstalling pyarrow-15.0.2:\n",
" Successfully uninstalled pyarrow-15.0.2\n",
" Attempting uninstall: anyio\n",
" Found existing installation: anyio 4.3.0\n",
" Uninstalling anyio-4.3.0:\n",
" Successfully uninstalled anyio-4.3.0\n",
" Attempting uninstall: langsmith\n",
" Found existing installation: langsmith 0.1.48\n",
" Uninstalling langsmith-0.1.48:\n",
" Successfully uninstalled langsmith-0.1.48\n",
" Attempting uninstall: langchain\n",
" Found existing installation: langchain 0.1.16\n",
" Uninstalling langchain-0.1.16:\n",
" Successfully uninstalled langchain-0.1.16\n",
"\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
"langchain-community 0.0.33 requires langsmith<0.2.0,>=0.1.0, but you have langsmith 0.0.92 which is incompatible.\n",
"langchain-core 0.1.44 requires langsmith<0.2.0,>=0.1.0, but you have langsmith 0.0.92 which is incompatible.\u001b[0m\u001b[31m\n",
"\u001b[0mSuccessfully installed Flask-3.0.3 Mako-1.3.3 Werkzeug-3.0.2 alembic-1.13.1 anyio-3.7.1 cloudpickle-3.0.0 databricks-cli-0.18.0 docker-6.1.3 entrypoints-0.4 faiss-cpu-1.8.0 funcy-2.0 gensim-4.3.2 gunicorn-21.2.0 itsdangerous-2.2.0 langchain-0.0.339 langsmith-0.0.92 markdown-3.6 mlflow-2.9.0 nltk-3.8.1 numexpr-2.10.0 pyLDAvis-3.4.1 pyarrow-14.0.2 pyjwt-2.8.0 pytz-2023.4 querystring-parser-1.2.4 smart-open-7.0.4 sqlparse-0.5.0 tabulate-0.9.0\n",
"Requirement already satisfied: faiss-cpu in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (1.8.0)\n",
"Requirement already satisfied: gensim in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (4.3.2)\n",
"Requirement already satisfied: nltk in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (3.8.1)\n",
"Requirement already satisfied: pyLDAvis in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (3.4.1)\n",
"Requirement already satisfied: tiktoken in /u/marshad/.local/lib/python3.9/site-packages (0.6.0)\n",
"Requirement already satisfied: numpy in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from faiss-cpu) (1.26.4)\n",
"Requirement already satisfied: scipy>=1.7.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from gensim) (1.13.0)\n",
"Requirement already satisfied: smart-open>=1.8.1 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from gensim) (7.0.4)\n",
"Requirement already satisfied: click in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from nltk) (8.1.7)\n",
"Requirement already satisfied: joblib in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from nltk) (1.4.0)\n",
"Requirement already satisfied: regex>=2021.8.3 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from nltk) (2024.4.16)\n",
"Requirement already satisfied: tqdm in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from nltk) (4.66.2)\n",
"Requirement already satisfied: pandas>=2.0.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pyLDAvis) (2.2.2)\n",
"Requirement already satisfied: jinja2 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pyLDAvis) (3.1.3)\n",
"Requirement already satisfied: numexpr in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pyLDAvis) (2.10.0)\n",
"Requirement already satisfied: funcy in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pyLDAvis) (2.0)\n",
"Requirement already satisfied: scikit-learn>=1.0.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pyLDAvis) (1.4.2)\n",
"Requirement already satisfied: setuptools in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pyLDAvis) (68.2.2)\n",
"Requirement already satisfied: requests>=2.26.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from tiktoken) (2.31.0)\n",
"Requirement already satisfied: python-dateutil>=2.8.2 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pandas>=2.0.0->pyLDAvis) (2.9.0)\n",
"Requirement already satisfied: pytz>=2020.1 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pandas>=2.0.0->pyLDAvis) (2023.4)\n",
"Requirement already satisfied: tzdata>=2022.7 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from pandas>=2.0.0->pyLDAvis) (2024.1)\n",
"Requirement already satisfied: charset-normalizer<4,>=2 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from requests>=2.26.0->tiktoken) (3.3.2)\n",
"Requirement already satisfied: idna<4,>=2.5 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from requests>=2.26.0->tiktoken) (3.7)\n",
"Requirement already satisfied: urllib3<3,>=1.21.1 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from requests>=2.26.0->tiktoken) (2.2.1)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from requests>=2.26.0->tiktoken) (2024.2.2)\n",
"Requirement already satisfied: threadpoolctl>=2.0.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from scikit-learn>=1.0.0->pyLDAvis) (3.4.0)\n",
"Requirement already satisfied: wrapt in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from smart-open>=1.8.1->gensim) (1.16.0)\n",
"Requirement already satisfied: MarkupSafe>=2.0 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from jinja2->pyLDAvis) (2.1.5)\n",
"Requirement already satisfied: six>=1.5 in /u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages (from python-dateutil>=2.8.2->pandas>=2.0.0->pyLDAvis) (1.16.0)\n"
]
}
],
"source": [
"# !pip install mlflow==2.9.0 langchain==0.0.339 openai faiss-cpu gensim nltk pyLDAvis tiktoken\n",
"# !pip install faiss-cpu gensim nltk pyLDAvis tiktoken\n"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "414eb948-7f7a-411b-8308-facadb0bdde8",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": [
"import ast\n",
"import os\n",
"import pprint\n",
"from typing import List\n",
"\n",
"import pandas as pd\n",
"from langchain.docstore.document import Document\n",
"from langchain.embeddings.openai import OpenAIEmbeddings\n",
"from langchain.text_splitter import CharacterTextSplitter\n",
"from langchain.vectorstores import FAISS\n",
"\n",
"import mlflow\n",
"\n",
"os.environ[\"OPENAI_API_KEY\"] = \"key-here\"\n",
"\n",
"CHUNK_SIZE = 100 # WARNING! MAKE SURE ITS SAME. CHUNK_SIZE = 100 # Warning : Change in other notebook as well. # IRRELEVANT SINCE THE ALREAYD BUILT DATABAES IS USED\n",
"\n",
"# Assume running from https://github.com/mlflow/mlflow/blob/master/examples/llms/rag\n",
"OUTPUT_DF_PATH = \"/projects/bcjp/marshad/agllm/agllm-data/evaluation/question_answer_source_agllm.csv\"\n",
"SCRAPPED_DOCS_PATH = \"None\"\n",
"EVALUATION_DATASET_PATH = \"/projects/bcjp/marshad/agllm/agllm-data/evaluation/static_evaluation_dataset.csv\" # This is where/how the dataset will be saved when it is prepared for evaluation\n",
"DB_PERSIST_DIR = \"faiss_index\""
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "eebcf0d9-6634-47d9-808d-e79c5a50fbbf",
"showTitle": false,
"title": ""
}
},
"source": [
"## Step 2: Evaluation Dataset Preparation\n",
"The evaluation dataset should contain three columns: questions, ground truth doc IDs, retrieved relevant doc IDs. A \"doc ID\" is a unique string identifier of the documents in you RAG application. For example, it could be the URL of a documentation web page, or the file path of a PDF document.\n",
"\n",
"If you have a list of questions that you would like to evaluate, please see 1.1 Manual Preparation. If you do not have a question list yet, please see 1.2 Generate the Evaluation Dataset.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "f8a690cc-7672-4f24-8518-8faabfc9afea",
"showTitle": false,
"title": ""
}
},
"source": [
"### Manual Preparation\n",
"\n",
"When evaluating a retriever, it's recommended to save the retrieved document IDs into a static dataset represented by a Pandas Dataframe or an MLflow Pandas Dataset containing the input queries, retrieved relevant document IDs, and the ground-truth document IDs for the evaluation.\n",
"\n",
"#### Concepts\n",
"\n",
"A \"document ID\" is a string that identifies a document.\n",
"\n",
"A list of \"retrieved relevant document IDs\" are the output of the retriever for a specific input query and a `k` value.\n",
"\n",
"A list of \"ground-truth document IDs\" are the labeled relevant documents for a specific input query.\n",
"\n",
"#### Expected Data Format\n",
"\n",
"For each row, the retrieved relevant document IDs and the ground-truth relevant document IDs should be provided as a tuple of document ID strings.\n",
"\n",
"The column name of the retrieved relevant document IDs should be specified by the `predictions` parameter, and the column name of the ground-truth relevant document IDs should be specified by the `targets` parameter.\n",
"\n",
"Here is a simple example dataset that illustrates the expected data format. The doc IDs are the paths of the documentation pages."
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "1a61b1b2-582e-49d5-864d-b58d2b6c3392",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": [
"# # THIS IS NO BEING USED INSTEAD : QUESTION_ANSWER_SOURCE (GENERATED FROM LAST NOTEBOOK IS BEING USED)\n",
"# data = pd.DataFrame(\n",
"# {\n",
"# \"questions\": [\n",
"# \"What is MLflow?\",\n",
"# \"What is Databricks?\",\n",
"# \"How to serve a model on Databricks?\",\n",
"# \"How to enable MLflow Autologging for my workspace by default?\",\n",
"# ],\n",
"# \"retrieved_context\": [\n",
"# [\n",
"# \"mlflow/index.html\",\n",
"# \"mlflow/quick-start.html\",\n",
"# ],\n",
"# [\n",
"# \"introduction/index.html\",\n",
"# \"getting-started/overview.html\",\n",
"# ],\n",
"# [\n",
"# \"machine-learning/model-serving/index.html\",\n",
"# \"machine-learning/model-serving/model-serving-intro.html\",\n",
"# ],\n",
"# [],\n",
"# ],\n",
"# \"ground_truth_context\": [\n",
"# [\"mlflow/index.html\"],\n",
"# [\"introduction/index.html\"],\n",
"# [\n",
"# \"machine-learning/model-serving/index.html\",\n",
"# \"machine-learning/model-serving/llm-optimized-model-serving.html\",\n",
"# ],\n",
"# [\"mlflow/databricks-autologging.html\"],\n",
"# ],\n",
"# }\n",
"# )"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "f740b47c-71ee-4633-944c-172887ff5081",
"showTitle": false,
"title": ""
}
},
"source": [
"### Generate the Evaluation Dataset\n",
"There are two steps to generate the evaluation dataset: generate questions with ground truth doc IDs and retrieve relevant doc IDs. "
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "f6beddae-85e2-44e7-8ec6-7ca2f02bc16b",
"showTitle": false,
"title": ""
}
},
"source": [
"\n",
"#### Generate Questions with Ground Truth Doc IDs\n",
"If you don't have a list of questions to evaluate, you can generate them using LLMs. The [Question Generation Notebook](https://mlflow.org/docs/latest/llms/rag/notebooks/question-generation-retrieval-evaluation.html) provides an example way to do it. Here is the result of running that notebook."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "98bf55c7-3e58-4fff-bc0e-1af58d64839f",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": [
"generated_df = pd.read_csv(OUTPUT_DF_PATH)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "17baa097-457f-46df-9e25-56061972785f",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>question</th>\n",
" <th>answer</th>\n",
" <th>chunk</th>\n",
" <th>chunk_id</th>\n",
" <th>source</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>When does peak adult flight of stalk borer occur?</td>\n",
" <td>Peak adult flight of stalk borer occurs during...</td>\n",
" <td>11/10/23, 9:03 AM\\nStart Scouting for Stalk Bo...</td>\n",
" <td>0</td>\n",
" <td>agllm-data/Start Scouting for Stalk Borer _ In...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>What are the distinguishing features of stalk ...</td>\n",
" <td>Stalk borer larvae have three pairs of true le...</td>\n",
" <td>Description. Stalk borer larvae have three pai...</td>\n",
" <td>0</td>\n",
" <td>agllm-data/Start Scouting for Stalk Borer _ In...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" question \\\n",
"0 When does peak adult flight of stalk borer occur? \n",
"1 What are the distinguishing features of stalk ... \n",
"\n",
" answer \\\n",
"0 Peak adult flight of stalk borer occurs during... \n",
"1 Stalk borer larvae have three pairs of true le... \n",
"\n",
" chunk chunk_id \\\n",
"0 11/10/23, 9:03 AM\\nStart Scouting for Stalk Bo... 0 \n",
"1 Description. Stalk borer larvae have three pai... 0 \n",
"\n",
" source \n",
"0 agllm-data/Start Scouting for Stalk Borer _ In... \n",
"1 agllm-data/Start Scouting for Stalk Borer _ In... "
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"generated_df.head(3)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "93165dc5-aff9-46f9-83ab-e6dbfcbbc32b",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>question</th>\n",
" <th>source</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>When does peak adult flight of stalk borer occur?</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>What are the distinguishing features of stalk ...</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" question \\\n",
"0 When does peak adult flight of stalk borer occur? \n",
"1 What are the distinguishing features of stalk ... \n",
"\n",
" source \n",
"0 [agllm-data/Start Scouting for Stalk Borer _ I... \n",
"1 [agllm-data/Start Scouting for Stalk Borer _ I... "
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Prepare dataframe `data` with the required format\n",
"data = pd.DataFrame({})\n",
"data[\"question\"] = generated_df[\"question\"].copy(deep=True)\n",
"data[\"source\"] = generated_df[\"source\"].apply(lambda x: [x])\n",
"data.head(3)"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "3eabe651-28be-45bb-94ad-58e6bc582137",
"showTitle": false,
"title": ""
}
},
"source": [
"#### Retrieve Relevant Doc IDs\n",
"\n",
"Once we have a list of questions with ground truth doc IDs from 1.1, we can collect the retrieved relevant doc IDs. In this tutorial, we use a LangChain retriever. You can plug in your own retriever as needed."
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "9817f671-f2fd-4b2e-abe9-3bc9afd9ce3c",
"showTitle": false,
"title": ""
}
},
"source": [
"First, we build a FAISS retriever from the docs saved at https://github.com/mlflow/mlflow/blob/master/examples/llms/question_generation/mlflow_docs_scraped.csv. See the [Question Generation Notebook](https://mlflow.org/docs/latest/llms/rag/notebooks/question-generation-retrieval-evaluation.html) for how to create this csv file."
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "178b45b4-11f9-47ca-9564-c8caa32d2504",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages/langchain_core/_api/deprecation.py:117: LangChainDeprecationWarning: The class `langchain_community.embeddings.openai.OpenAIEmbeddings` was deprecated in langchain-community 0.0.9 and will be removed in 0.2.0. An updated version of the class exists in the langchain-openai package and should be used instead. To use it run `pip install -U langchain-openai` and import as `from langchain_openai import OpenAIEmbeddings`.\n",
" warn_deprecated(\n"
]
}
],
"source": [
"embedding = OpenAIEmbeddings()"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "e5a113bb-11b8-4d1a-a21b-b59b523f3525",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": [
"# scrapped_df = pd.read_csv(SCRAPPED_DOCS_PATH)\n",
"# list_of_documents = [\n",
"# Document(page_content=row[\"text\"], metadata={\"source\": row[\"source\"]})\n",
"# for i, row in scrapped_df.iterrows()\n",
"# ]\n",
"# text_splitter = CharacterTextSplitter(chunk_size=CHUNK_SIZE, chunk_overlap=0)\n",
"# docs = text_splitter.split_documents(list_of_documents)\n",
"# db = FAISS.from_documents(docs, embeddings)\n",
"\n",
"# # Save the db to local disk\n",
"# db.save_local(DB_PERSIST_DIR)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "bace7c63-e3d5-42f3-bf6a-00ef1842baae",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": [
"# Load the db from local disk : Already stored database that is being used in agllm should come here\n",
"# db = FAISS.load_local(DB_PERSIST_DIR, embeddings)\n",
"from langchain.vectorstores import Chroma\n",
"\n",
"persist_directory = 'db3'\n",
"vectordb = Chroma(persist_directory=persist_directory, \n",
" embedding_function=embedding)\n",
"\n",
"retriever = vectordb.as_retriever()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "c06bcb3c-58c8-454c-bf5b-e29ec227991f",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"data": {
"text/plain": [
"[Document(page_content='Control. To prevent stand loss, scout and determine the percent of infested plants.\\nThe use of an economic threshold (Table 1), first developed by ISU entomologist\\nLarry Pedigo, will help determine justifiable insecticide treatments based on market\\nvalue and plant stage. Young plants have a lower threshold because they are more\\neasily killed by stalk borer larvae.\\nTable 1. Economic thresholds for stalk borer in corn, based on plant\\nstage, expected yield and market value.', metadata={'author': '', 'creationDate': \"D:20231110150309+00'00'\", 'creator': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36', 'file_path': 'agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf', 'format': 'PDF 1.4', 'keywords': '', 'matched_specie_0': 'Hypagyrtis unipunctata', 'matched_specie_1': 'Papaipema nebris', 'modDate': \"D:20231110150309+00'00'\", 'page': 2, 'producer': 'Skia/PDF m118', 'source': 'agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf', 'subject': '', 'title': '', 'total_pages': 6, 'trapped': ''}),\n",
" Document(page_content='This has been the week of the fuzzy brown moths or FBMs (as entomologists not-so-\\ntechnically call the hundreds of moth species that fit this description). There is a wide\\nvariety of species that can be called FBMs and it seems we are experiencing several.', metadata={'author': '', 'creationDate': \"D:20231110150311+00'00'\", 'creator': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36', 'file_path': 'agllm-data/Moths Abundant Around Iowa _ Integrated Crop Management.pdf', 'format': 'PDF 1.4', 'keywords': '', 'matched_specie_0': 'Nomophila nearctica', 'matched_specie_1': 'Agrotis ipsilon', 'matched_specie_2': 'Euxoa auxiliaris', 'modDate': \"D:20231110150311+00'00'\", 'page': 0, 'producer': 'Skia/PDF m118', 'source': 'agllm-data/Moths Abundant Around Iowa _ Integrated Crop Management.pdf', 'subject': '', 'title': '', 'total_pages': 4, 'trapped': ''}),\n",
" Document(page_content='Dr Laura Jesse Iles directs the North Central IPM Center.\\xa0 \\xa0Dr. Iles has\\nearned B.S. (Animal Ecology), M.S. (Entomology), and Ph.D. (Co-major\\nin Entomology and Ecology and Evolutionary Biology) degrees, all from\\nIowa State University.\\xa0 In addit...\\nErin Hodgson Professor\\nDr. Erin Hodgson started working in the Department of Entomology,\\nnow the Department of Plant Pathology, Entomology, and Microbiology,\\nat Iowa State University in 2009. She is a professor with extension and', metadata={'author': '', 'creationDate': \"D:20231110150311+00'00'\", 'creator': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36', 'file_path': 'agllm-data/Moths Abundant Around Iowa _ Integrated Crop Management.pdf', 'format': 'PDF 1.4', 'keywords': '', 'matched_specie_0': 'Nomophila nearctica', 'matched_specie_1': 'Agrotis ipsilon', 'matched_specie_2': 'Euxoa auxiliaris', 'modDate': \"D:20231110150311+00'00'\", 'page': 3, 'producer': 'Skia/PDF m118', 'source': 'agllm-data/Moths Abundant Around Iowa _ Integrated Crop Management.pdf', 'subject': '', 'title': '', 'total_pages': 4, 'trapped': ''}),\n",
" Document(page_content='For more information on stalk borer biology and management, read a recent Journal\\nof Integrated Pest Management article by Rice and Davis (2010), called \"Stalk borer\\necology and IPM in corn.\"\\nErin Hodgson is an assistant professor of entomology with extension and research\\nresponsibilities; contact at [email protected] or phone 515-294-2847. Adam Sisson is\\nan Integrated Pest Management program assistant. Sisson can be contacted by\\nemail at [email protected] or by calling 515-294-5899', metadata={'author': '', 'creationDate': \"D:20231110150309+00'00'\", 'creator': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36', 'file_path': 'agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf', 'format': 'PDF 1.4', 'keywords': '', 'matched_specie_0': 'Hypagyrtis unipunctata', 'matched_specie_1': 'Papaipema nebris', 'modDate': \"D:20231110150309+00'00'\", 'page': 4, 'producer': 'Skia/PDF m118', 'source': 'agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf', 'subject': '', 'title': '', 'total_pages': 6, 'trapped': ''})]"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Test the retriever with a query\n",
"retrieved_docs = retriever.get_relevant_documents(\n",
" \"What is the purpose of the MLflow Model Registry?\"\n",
")\n",
"(retrieved_docs)"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "2ec7b458-c248-4ec0-9d85-0e447d6b4ecd",
"showTitle": false,
"title": ""
}
},
"source": [
"After building a retriever, we define a function that takes a question string as input and returns a list of relevant doc ID strings."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "bc688e4b-3389-4804-b7bf-159bce4f9db8",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>question</th>\n",
" <th>source</th>\n",
" <th>retrieved_doc_ids</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>When does peak adult flight of stalk borer occur?</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>What are the distinguishing features of stalk ...</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" question \\\n",
"0 When does peak adult flight of stalk borer occur? \n",
"1 What are the distinguishing features of stalk ... \n",
"\n",
" source \\\n",
"0 [agllm-data/Start Scouting for Stalk Borer _ I... \n",
"1 [agllm-data/Start Scouting for Stalk Borer _ I... \n",
"\n",
" retrieved_doc_ids \n",
"0 [agllm-data/Start Scouting for Stalk Borer _ I... \n",
"1 [agllm-data/Start Scouting for Stalk Borer _ I... "
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Define a function to return a list of retrieved doc ids\n",
"def retrieve_doc_ids(question: str) -> List[str]:\n",
" docs = retriever.get_relevant_documents(question)\n",
" return [doc.metadata[\"source\"] for doc in docs]\n",
"\n",
"data[\"retrieved_doc_ids\"] = data[\"question\"].apply(retrieve_doc_ids)\n",
"data.head(3)"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "330a3336-6ca2-455f-a1ae-5bd842a4d2bb",
"showTitle": false,
"title": ""
}
},
"source": [
"We can store the retrieved doc IDs in the dataframe as a column \"retrieved_doc_ids\"."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "f96ec69b-bea3-4023-8cd3-6bee1e327ff0",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'data' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m/projects/bcjp/marshad/agllm/retriever-evaluation-tutorial.ipynb Cell 24\u001b[0m line \u001b[0;36m1\n\u001b[0;32m----> <a href='vscode-notebook-cell://openondemand.delta.ncsa.illinois.edu/projects/bcjp/marshad/agllm/retriever-evaluation-tutorial.ipynb#X32sdnNjb2RlLXJlbW90ZQ%3D%3D?line=0'>1</a>\u001b[0m data[\u001b[39m\"\u001b[39m\u001b[39mquestion\u001b[39m\u001b[39m\"\u001b[39m][\u001b[39m0\u001b[39m]\n",
"\u001b[0;31mNameError\u001b[0m: name 'data' is not defined"
]
}
],
"source": [
"data[\"question\"][0]"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf',\n",
" 'agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf',\n",
" 'agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf',\n",
" 'agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf']"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data.iloc[0][\"retrieved_doc_ids\"]"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "5e5c4cd1-38c3-4709-8d41-6e319fb8a924",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": [
"# Persist the static evaluation dataset to disk\n",
"data.to_csv(EVALUATION_DATASET_PATH, index=False)"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "deabd8f0-44cf-409f-a27b-e82dd4d99940",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>question</th>\n",
" <th>source</th>\n",
" <th>retrieved_doc_ids</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>When does peak adult flight of stalk borer occur?</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>What are the distinguishing features of stalk ...</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" question \\\n",
"0 When does peak adult flight of stalk borer occur? \n",
"1 What are the distinguishing features of stalk ... \n",
"\n",
" source \\\n",
"0 [agllm-data/Start Scouting for Stalk Borer _ I... \n",
"1 [agllm-data/Start Scouting for Stalk Borer _ I... \n",
"\n",
" retrieved_doc_ids \n",
"0 [agllm-data/Start Scouting for Stalk Borer _ I... \n",
"1 [agllm-data/Start Scouting for Stalk Borer _ I... "
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Load the static evaluation dataset from disk and deserialize the source and retrieved doc ids\n",
"data = pd.read_csv(EVALUATION_DATASET_PATH)\n",
"data[\"source\"] = data[\"source\"].apply(ast.literal_eval)\n",
"data[\"retrieved_doc_ids\"] = data[\"retrieved_doc_ids\"].apply(ast.literal_eval)\n",
"data.head(3)"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "c62b5306-9c0d-4ce8-8c4a-23cb1ecc7f66",
"showTitle": false,
"title": ""
}
},
"source": [
"## Step 3: Calling `mlflow.evaluate()`"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "bdeebdcc-b4e7-4f9d-8fdc-366f9c13ed20",
"showTitle": false,
"title": ""
}
},
"source": [
"### Metrics Definition\n",
"\n",
"There are three built-in metrics provided for the retriever model type. Click the metric name below to see the metrics definitions.\n",
"\n",
"1. [mlflow.metrics.precision_at_k(k)](https://mlflow.org/docs/latest/python_api/mlflow.metrics.html#mlflow.metrics.precision_at_k)\n",
"1. [mlflow.metrics.recall_at_k(k)](https://mlflow.org/docs/latest/python_api/mlflow.metrics.html#mlflow.metrics.recall_at_k)\n",
"1. [mlflow.metrics.ndcg_at_k(k)](https://mlflow.org/docs/latest/python_api/mlflow.metrics.html#mlflow.metrics.ndcg_at_k) \n",
"\n",
"All metrics compute a score between 0 and 1 for each row representing the corresponding metric of the retriever model at the given `k` value.\n",
"\n",
"The `k` parameter should be a positive integer representing the number of retrieved documents\n",
"to evaluate for each row. `k` defaults to 3.\n",
"\n",
"When the model type is `\"retriever\"`, these metrics will be calculated automatically with the\n",
"default `k` value of 3.\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "25a32237-b2ef-4f4a-9e5a-4537e7e43012",
"showTitle": false,
"title": ""
}
},
"source": [
"### Basic usage\n",
"\n",
"There are two supported ways to specify the retriever's output:\n",
"\n",
"* Case 1: Save the retriever's output to a static evaluation dataset\n",
"* Case 2: Wrap the retriever in a function"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf']\n",
"['agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf', 'agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf', 'agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf', 'agllm-data/Start Scouting for Stalk Borer _ Integrated Crop Management.pdf']\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"/tmp/ipykernel_1842537/457881667.py:1: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n",
" print(data.iloc[0][1])\n",
"/tmp/ipykernel_1842537/457881667.py:2: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`\n",
" print(data.iloc[0][2])\n"
]
}
],
"source": [
"print(data.iloc[0][1])\n",
"print(data.iloc[0][2])\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "0390728a-a6cf-4c84-867a-0c6832114471",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages/mlflow/data/digest_utils.py:26: FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.\n",
" string_columns = trimmed_df.columns[(df.applymap(type) == str).all(0)]\n",
"/u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages/mlflow/models/evaluation/base.py:414: FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.\n",
" data = data.applymap(_hash_array_like_element_as_bytes)\n",
"2024/04/19 15:45:38 WARNING mlflow.data.pandas_dataset: Failed to infer schema for Pandas dataset. Exception: Unable to map 'object' type to MLflow DataType. object can be mapped iff all values have identical data type which is one of (string, (bytes or byterray), int, float).\n",
"2024/04/19 15:45:39 INFO mlflow.models.evaluation.base: Evaluating the model with the default evaluator.\n",
"2024/04/19 15:45:39 INFO mlflow.models.evaluation.default_evaluator: Testing metrics on first row...\n",
"2024/04/19 15:45:39 INFO mlflow.models.evaluation.default_evaluator: Evaluating builtin metrics: precision_at_3\n",
"2024/04/19 15:45:39 INFO mlflow.models.evaluation.default_evaluator: Evaluating builtin metrics: recall_at_3\n",
"2024/04/19 15:45:39 INFO mlflow.models.evaluation.default_evaluator: Evaluating builtin metrics: ndcg_at_3\n"
]
}
],
"source": [
"# Case 1: Evaluating a static evaluation dataset\n",
"with mlflow.start_run() as run:\n",
" evaluate_results = mlflow.evaluate(\n",
" data=data,\n",
" model_type=\"retriever\",\n",
" targets=\"source\",\n",
" predictions=\"retrieved_doc_ids\",\n",
" evaluators=\"default\",\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "70aa6719-f69d-4fda-8a67-ac4e0d8ea6d8",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>question</th>\n",
" <th>source</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>When does peak adult flight of stalk borer occur?</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>What are the distinguishing features of stalk ...</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" question \\\n",
"0 When does peak adult flight of stalk borer occur? \n",
"1 What are the distinguishing features of stalk ... \n",
"\n",
" source \n",
"0 [agllm-data/Start Scouting for Stalk Borer _ I... \n",
"1 [agllm-data/Start Scouting for Stalk Borer _ I... "
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"question_source_df = data[[\"question\", \"source\"]]\n",
"question_source_df.head(3)"
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "00672280-3dfc-4c00-9ae2-bea50732ef8b",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": [
"# # Case 2: Evaluating a function\n",
"# def retriever_model_function(question_df: pd.DataFrame) -> pd.Series:\n",
"# return question_df[\"question\"].apply(retrieve_doc_ids)\n",
"\n",
"\n",
"# with mlflow.start_run() as run:\n",
"# evaluate_results = mlflow.evaluate(\n",
"# model=retriever_model_function,\n",
"# data=question_source_df,\n",
"# model_type=\"retriever\",\n",
"# targets=\"source\",\n",
"# evaluators=\"default\",\n",
"# )"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "cb24318b-6149-4703-ad06-731c8a75866f",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{ 'ndcg_at_3/mean': 1.0,\n",
" 'ndcg_at_3/p90': 1.0,\n",
" 'ndcg_at_3/variance': 0.0,\n",
" 'precision_at_3/mean': 1.0,\n",
" 'precision_at_3/p90': 1.0,\n",
" 'precision_at_3/variance': 0.0,\n",
" 'recall_at_3/mean': 1.0,\n",
" 'recall_at_3/p90': 1.0,\n",
" 'recall_at_3/variance': 0.0}\n"
]
}
],
"source": [
"pp = pprint.PrettyPrinter(indent=4)\n",
"pp.pprint(evaluate_results.metrics)"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "7a9b83c5-1544-4b0e-81f6-7abc1fafa258",
"showTitle": false,
"title": ""
}
},
"source": [
"### Try different k values\n",
"To use another `k` value, use the `evaluator_config` parameter\n",
"in the `mlflow.evaluate()` API as follows: `evaluator_config={\"retriever_k\": <k_value>}`.\n",
"\n",
"\n",
"```python\n",
"# Case 1: Specifying the model type\n",
"evaluate_results = mlflow.evaluate(\n",
" data=data,\n",
" model_type=\"retriever\",\n",
" targets=\"ground_truth_context\",\n",
" predictions=\"retrieved_context\",\n",
" evaluators=\"default\",\n",
" evaluator_config={\"retriever_k\": 5}\n",
" )\n",
"```\n",
"\n",
"Alternatively, you can directly specify the desired metrics\n",
"in the `extra_metrics` parameter of the `mlflow.evaluate()` API without specifying a model\n",
"type. In this case, the `k` value specified in the `evaluator_config` parameter will be\n",
"ignored.\n",
"\n",
"\n",
"```python\n",
"# Case 2: Specifying the extra_metrics\n",
"evaluate_results = mlflow.evaluate(\n",
" data=data,\n",
" targets=\"ground_truth_context\",\n",
" predictions=\"retrieved_context\",\n",
" extra_metrics=[\n",
" mlflow.metrics.precision_at_k(4),\n",
" mlflow.metrics.precision_at_k(5)\n",
" ],\n",
" )\n",
"```"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "4b7174aa-0aa2-497d-aaa5-842121fcf270",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages/mlflow/data/digest_utils.py:26: FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.\n",
" string_columns = trimmed_df.columns[(df.applymap(type) == str).all(0)]\n",
"/u/marshad/.conda/envs/agllm-env1/lib/python3.9/site-packages/mlflow/models/evaluation/base.py:414: FutureWarning: DataFrame.applymap has been deprecated. Use DataFrame.map instead.\n",
" data = data.applymap(_hash_array_like_element_as_bytes)\n",
"2024/04/19 15:46:08 WARNING mlflow.data.pandas_dataset: Failed to infer schema for Pandas dataset. Exception: Unable to map 'object' type to MLflow DataType. object can be mapped iff all values have identical data type which is one of (string, (bytes or byterray), int, float).\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.base: Evaluating the model with the default evaluator.\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.default_evaluator: Testing metrics on first row...\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.default_evaluator: Evaluating metrics: precision_at_1\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.default_evaluator: Evaluating metrics: precision_at_2\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.default_evaluator: Evaluating metrics: precision_at_3\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.default_evaluator: Evaluating metrics: recall_at_1\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.default_evaluator: Evaluating metrics: recall_at_2\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.default_evaluator: Evaluating metrics: recall_at_3\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.default_evaluator: Evaluating metrics: ndcg_at_1\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.default_evaluator: Evaluating metrics: ndcg_at_2\n",
"2024/04/19 15:46:08 INFO mlflow.models.evaluation.default_evaluator: Evaluating metrics: ndcg_at_3\n"
]
}
],
"source": [
"with mlflow.start_run() as run:\n",
" evaluate_results = mlflow.evaluate(\n",
" data=data,\n",
" targets=\"source\",\n",
" predictions=\"retrieved_doc_ids\",\n",
" evaluators=\"default\",\n",
" extra_metrics=[\n",
" mlflow.metrics.precision_at_k(1),\n",
" mlflow.metrics.precision_at_k(2),\n",
" mlflow.metrics.precision_at_k(3),\n",
" mlflow.metrics.recall_at_k(1),\n",
" mlflow.metrics.recall_at_k(2),\n",
" mlflow.metrics.recall_at_k(3),\n",
" mlflow.metrics.ndcg_at_k(1),\n",
" mlflow.metrics.ndcg_at_k(2),\n",
" mlflow.metrics.ndcg_at_k(3),\n",
" ],\n",
" )"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "d57c201b-3718-43af-b8c2-ef22bfa2c15b",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAeoAAAEiCAYAAAA21pHjAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAABDRklEQVR4nO3dd1gUV9sG8HtZmkixoKCAgL0jakREpYRALIi9RgFLbCiGxIixGyOo0eibmBiJhSQWIsYWjagI2GNPlESNAkFREAugqLQ93x9+bNzsorAusML9u669ZGfOnHlmdtxnZ+bMORIh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UJycnKZredudtkNcCQkmWVWd4Zu2TUmLqxWuh8BEokE1tbWr9XAWa1EHRQUhISEBAwbNgw1atQA8LyXsPv376OgoADjx4/HmDFj1A6KiIheztjYGE2aNEF+fn6ZrWPpj+fKrO5v9L4us7r/V9e8zOr+wv2LUpXX09N77aeQ1ErUEokE4eHh8PPzQ1RUFP7++2/IZDI0atQIgwcPRvfu3V8rKCIiejWpVFqmj6Lee1p298ANC++WWd0PCsuu001DQ8Myq7s4r9UzWdeuXdG1a1dNxUJERET/8Ub39U1ERFTZqXVGbW9v/8pWhhKJBDduVLb+YYiIiMqXWona1dVVKVEXFhbin3/+wfHjx9G6dWs4OjpqJEAiIqKqTK1E/bJex37//Xd4e3tjxIgR6sZERERE/0/j96gdHBwwfvx4zJgxQ9NVExERVTll0pjMwsICf/75Z1lUTUREVKVoPFHfv38f69atg7W1taarJiIiqnLUukft4eGhcnpmZiauXLmCvLw8/PDDD68VGBEREamZqGUymVKrb4lEAnt7e3h6emL06NFo3ry5RgIkIiKqytRK1P8dF5qIiIjKBnsmIyIi0mIlOqP+/vvv1ap81KhRai1HREREz5UoUfv7+5e6YolEwkRNRET0mkqUqJOSkso6DiIiIlKhRIna1ta2rOMgIiIiFdiYjIiISIup9XgWAKSlpWHdunU4f/48srKyIJPJFOZLJBLExMS8doBERERVmVqJ+o8//oCbmxuePn2KZs2a4dKlS2jZsiUyMzORmpqKRo0awcbGRtOxEhERVTlqXfoOCQmBsbExrl69ikOHDkEIgVWrVuHmzZuIjIzEw4cPERYWpulYiYiIqhy1EvXx48cxfvx4NGjQADo6z6souvQ9aNAgjBgxAtOnT9dclERERFWUWolaJpPBwsICAFCjRg1IpVI8ePBAPr9NmzY4d+6cZiIkIiKqwtRK1Pb29vJnq3V0dGBvb49Dhw7J5584cQI1atRQK6DVq1fDzs4OhoaGcHJywunTp19aPjMzE5MnT0a9evVgYGCApk2bYt++fWqtm4iISNuolai9vLywbds2+fuJEyfiu+++g6enJ95++21ERERg+PDhpa43MjIS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YoK0tDQAz8fWrVatWgVHR5XFzJkz0aNHDzRo0ACPHj3C5s2bERcXh+jo6IoOrdzx8axKJi4uDu7u7krT/fz8sHHjxvIPiCodiUSicvqGDRvg7+9fvsFQpTVmzBjExMTgzp07MDMzQ9u2bTFjxgy88847FR1auWOiJiIi0mLsmYyIiEiLMVETERFpMSZqIiIiLcZETUREpMWYqImIiLQYEzUREZEWY6ImIiLSYkzUREREWoyJmohKZf78+ZBIJLh3715Fh0JUJTBRExERaTEmaiIiIi3GRE1ERKTFmKiJ6LX9888/aNy4MVq3bo309PSKDoeoUmGiJqLXcuPGDXTv3h0mJiaIi4uDhYVFRYdEVKkwUROR2q5cuYLu3bvDwsIChw8fhrm5eUWHRFTpMFETkVouX74MV1dX2NnZ4dChQ6hZs2ZFh0RUKTFRE5FafHx8YGJigujoaJiamlZ0OESVFhM1EallwIABuHHjBjZt2lTRoRBVaroVHQARvZmWLVsGXV1dTJo0CSYmJhg+fHhFh0RUKTFRE5FaJBIJ1q5di0ePHsHPzw/Gxsbo06dPRYdFVOnw0jcRqU1HRwc//vgjvLy8MHjwYBw+fLiiQyKqdJioiei16OnpISoqCp07d4avry9+++23ig6JqFKRCCFERQdBREREqvGMmoiISIsxURMREWkxJmoiIiItxkRNRESkxZioiYiItBgTNRERkRZjoiYiItJiTNRERERajImaiIhIizFRExERaTEmaiIiIi3GRE1ERKTFmKiJiIi02P8BLa9Mrn12vk0AAAAASUVORK5CYII=",
"text/plain": [
"<Figure size 500x300 with 1 Axes>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"# Prepare data\n",
"metrics = [\"precision\", \"recall\", \"ndcg\"]\n",
"k_values = [1, 2, 3]\n",
"bar_width = 0.15\n",
"opacity = 0.8\n",
"\n",
"# Create subplots\n",
"fig, ax = plt.subplots(figsize=(5, 3))\n",
"\n",
"# Plotting each metric\n",
"for i, metric_name in enumerate(metrics):\n",
" y = [evaluate_results.metrics[f\"{metric_name}_at_{k}/mean\"] for k in k_values]\n",
" x = np.arange(len(k_values)) + i * bar_width\n",
" ax.bar(x, y, width=bar_width, alpha=opacity, label=f\"{metric_name}@k\")\n",
"\n",
"# Adding labels and title\n",
"ax.set_xlabel(\"k\", fontsize=12)\n",
"ax.set_ylabel(\"Metric Value\", fontsize=12)\n",
"ax.set_title(\"Metrics Comparison at Different Ks\", fontsize=14)\n",
"\n",
"# Setting x-axis ticks\n",
"ax.set_xticks(np.arange(len(k_values)) + bar_width)\n",
"ax.set_xticklabels(k_values)\n",
"\n",
"# Add legend and adjust layout\n",
"ax.legend(fontsize=8)\n",
"fig.tight_layout()\n",
"\n",
"# Display the plot\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "cac23d4b-bece-4274-836f-9ca2b7c3860d",
"showTitle": false,
"title": ""
}
},
"source": [
"### Corner case handling\n",
"\n",
"There are a few corner cases handle specially for each built-in metric."
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "e05a4ede-db44-46d2-bce8-752b0ce5d807",
"showTitle": false,
"title": ""
}
},
"source": [
"#### Empty retrieved document IDs\n",
"\n",
"When no relevant docs are retrieved:\n",
"\n",
"- `mlflow.metrics.precision_at_k(k)` is defined as:\n",
" * 0 if the ground-truth doc IDs is non-empty\n",
" * 1 if the ground-truth doc IDs is also empty\n",
"\n",
"- `mlflow.metrics.ndcg_at_k(k)` is defined as:\n",
" * 0 if the ground-truth doc IDs is non-empty\n",
" * 1 if the ground-truth doc IDs is also empty"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "931a32e7-29cb-4a22-b94e-ea2bf4f0b1a7",
"showTitle": false,
"title": ""
}
},
"source": [
"#### Empty ground-truth document IDs\n",
"\n",
"When no ground-truth document IDs are provided:\n",
"\n",
"- `mlflow.metrics.recall_at_k(k)` is defined as:\n",
" * 0 if the retrieved doc IDs is non-empty\n",
" * 1 if the retrieved doc IDs is also empty\n",
"\n",
"- `mlflow.metrics.ndcg_at_k(k)` is defined as:\n",
" * 0 if the retrieved doc IDs is non-empty\n",
" * 1 if the retrieved doc IDs is also empty"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "5a1453f6-a62d-43da-b230-955841c66651",
"showTitle": false,
"title": ""
}
},
"source": [
"#### Duplicate retreived document IDs\n",
"\n",
"It is a common case for the retriever in a RAG system to retrieve multiple chunks in the same document for a given query. In this case, `mlflow.metrics.ndcg_at_k(k)` is calculated as follows:\n",
"\n",
"If the duplicate doc IDs are in the ground truth,\n",
" they will be treated as different docs. For example, if the ground truth doc IDs are\n",
" [1, 2] and the retrieved doc IDs are [1, 1, 1, 3], the score will be equavalent to\n",
" ground truth doc IDs [10, 11, 12, 2] and retrieved doc IDs [10, 11, 12, 3].\n",
"\n",
"If the duplicate doc IDs are not in the ground truth, the ndcg score is calculated as normal."
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "525ccc10-3a60-4dc9-804e-083cfa313349",
"showTitle": false,
"title": ""
}
},
"source": [
"## Step 4: Result Analysis and Visualization\n",
"\n",
"You can view the per-row scores in the logged \"eval_results_table.json\" in artifacts by either loading it to a pandas dataframe (shown below) or visiting the MLflow run comparison UI."
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "32f3d5b3-245c-46b7-87ce-d85e261eac28",
"showTitle": true,
"title": ""
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading artifacts: 100%|██████████| 1/1 [00:00<00:00, 574.25it/s] "
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>question</th>\n",
" <th>source</th>\n",
" <th>retrieved_doc_ids</th>\n",
" <th>precision_at_1/score</th>\n",
" <th>precision_at_2/score</th>\n",
" <th>precision_at_3/score</th>\n",
" <th>recall_at_1/score</th>\n",
" <th>recall_at_2/score</th>\n",
" <th>recall_at_3/score</th>\n",
" <th>ndcg_at_1/score</th>\n",
" <th>ndcg_at_2/score</th>\n",
" <th>ndcg_at_3/score</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>What are her research responsibilities in corn...</td>\n",
" <td>[Moths Abundant Around Iowa _ Integrated Crop ...</td>\n",
" <td>[agllm-data/Moths Abundant Around Iowa _ Integ...</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0.000000</td>\n",
" <td>0.306574</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>What important degree day benchmark did some p...</td>\n",
" <td>[Start Scouting for Stalk Borer _ Integrated C...</td>\n",
" <td>[agllm-data/Start Scouting for Stalk Borer _ I...</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0</td>\n",
" <td>0.386853</td>\n",
" <td>0.530721</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" question \\\n",
"0 What are her research responsibilities in corn... \n",
"1 What important degree day benchmark did some p... \n",
"\n",
" source \\\n",
"0 [Moths Abundant Around Iowa _ Integrated Crop ... \n",
"1 [Start Scouting for Stalk Borer _ Integrated C... \n",
"\n",
" retrieved_doc_ids precision_at_1/score \\\n",
"0 [agllm-data/Moths Abundant Around Iowa _ Integ... 0 \n",
"1 [agllm-data/Start Scouting for Stalk Borer _ I... 0 \n",
"\n",
" precision_at_2/score precision_at_3/score recall_at_1/score \\\n",
"0 0 0 0 \n",
"1 0 0 0 \n",
"\n",
" recall_at_2/score recall_at_3/score ndcg_at_1/score ndcg_at_2/score \\\n",
"0 0 0 0 0.000000 \n",
"1 0 0 0 0.386853 \n",
"\n",
" ndcg_at_3/score \n",
"0 0.306574 \n",
"1 0.530721 "
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"eval_results_table = evaluate_results.tables[\"eval_results_table\"]\n",
"eval_results_table.head(5)"
]
},
{
"cell_type": "markdown",
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "cf18dd29-1017-4245-9f3b-923dbd46f742",
"showTitle": false,
"title": ""
}
},
"source": [
"With the evaluate results table, you can further visualize the well-answered questions and poorly-answered questions using topical analysis techniques."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "b1d9e40a-ccf6-4d6a-b24c-8cf41bbfa005",
"showTitle": true,
"title": "Utilitity functions"
}
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[nltk_data] Downloading package punkt to\n",
"[nltk_data] /Users/liang.zhang/nltk_data...\n",
"[nltk_data] Package punkt is already up-to-date!\n",
"[nltk_data] Downloading package stopwords to\n",
"[nltk_data] /Users/liang.zhang/nltk_data...\n",
"[nltk_data] Package stopwords is already up-to-date!\n"
]
}
],
"source": [
"import nltk\n",
"import pyLDAvis.gensim_models as gensimvis\n",
"from gensim import corpora, models\n",
"from nltk.corpus import stopwords\n",
"from nltk.tokenize import word_tokenize\n",
"\n",
"# Initialize NLTK resources\n",
"nltk.download(\"punkt\")\n",
"nltk.download(\"stopwords\")\n",
"\n",
"\n",
"def topical_analysis(questions: List[str]):\n",
" stop_words = set(stopwords.words(\"english\"))\n",
"\n",
" # Tokenize and remove stop words\n",
" tokenized_data = []\n",
" for question in questions:\n",
" tokens = word_tokenize(question.lower())\n",
" filtered_tokens = [word for word in tokens if word not in stop_words and word.isalpha()]\n",
" tokenized_data.append(filtered_tokens)\n",
"\n",
" # Create a dictionary and corpus\n",
" dictionary = corpora.Dictionary(tokenized_data)\n",
" corpus = [dictionary.doc2bow(text) for text in tokenized_data]\n",
"\n",
" # Apply LDA model\n",
" lda_model = models.LdaModel(corpus, num_topics=5, id2word=dictionary, passes=15)\n",
"\n",
" # Get topic distribution for each question\n",
" topic_distribution = []\n",
" for i, ques in enumerate(questions):\n",
" bow = dictionary.doc2bow(tokenized_data[i])\n",
" topics = lda_model.get_document_topics(bow)\n",
" topic_distribution.append(topics)\n",
" print(f\"Question: {ques}\\nTopic: {topics}\")\n",
"\n",
" # Print all topics\n",
" print(\"\\nTopics found are:\")\n",
" for idx, topic in lda_model.print_topics(-1):\n",
" print(f\"Topic: {idx} \\nWords: {topic}\\n\")\n",
" return lda_model, corpus, dictionary"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "e892d804-a4d8-468c-93e2-acc4a5fbcf2c",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": [
"filtered_df = eval_results_table[eval_results_table[\"precision_at_1/score\"] == 1]\n",
"hit_questions = filtered_df[\"question\"].tolist()\n",
"filtered_df = eval_results_table[eval_results_table[\"precision_at_1/score\"] == 0]\n",
"miss_questions = filtered_df[\"question\"].tolist()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "7c178b69-37d4-4a6b-9737-b93e7f3d75c5",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Question: What is the purpose of the MLflow Model Registry?\n",
"Topic: [(0, 0.0400703), (1, 0.040002838), (2, 0.040673085), (3, 0.04075462), (4, 0.8384991)]\n",
"Question: What is the purpose of registering a model with the Model Registry?\n",
"Topic: [(0, 0.0334267), (1, 0.033337697), (2, 0.033401005), (3, 0.033786207), (4, 0.8660484)]\n",
"Question: What can you do with registered models and model versions?\n",
"Topic: [(0, 0.04019648), (1, 0.04000775), (2, 0.040166058), (3, 0.8391777), (4, 0.040452003)]\n",
"Question: How can you add, modify, update, or delete a model in the Model Registry?\n",
"Topic: [(0, 0.025052568), (1, 0.025006149), (2, 0.025024023), (3, 0.025236268), (4, 0.899681)]\n",
"Question: How can you deploy and organize models in the Model Registry?\n",
"Topic: [(0, 0.033460867), (1, 0.033337582), (2, 0.033362914), (3, 0.8659808), (4, 0.033857808)]\n",
"Question: What method do you use to create a new registered model?\n",
"Topic: [(0, 0.028867528), (1, 0.028582651), (2, 0.882546), (3, 0.030021703), (4, 0.029982116)]\n",
"Question: How can you deploy and organize models in the Model Registry?\n",
"Topic: [(0, 0.033460878), (1, 0.033337586), (2, 0.033362918), (3, 0.8659798), (4, 0.03385884)]\n",
"Question: How can you fetch a list of registered models in the MLflow registry?\n",
"Topic: [(0, 0.0286206), (1, 0.028577656), (2, 0.02894385), (3, 0.88495284), (4, 0.028905064)]\n",
"Question: What is the default channel logged for models using MLflow v1.18 and above?\n",
"Topic: [(0, 0.02862059), (1, 0.028577654), (2, 0.028883327), (3, 0.8851736), (4, 0.028744776)]\n",
"Question: What information is stored in the conda.yaml file?\n",
"Topic: [(0, 0.050020963), (1, 0.051287953), (2, 0.051250603), (3, 0.7968765), (4, 0.05056402)]\n",
"Question: How can you save a model with a manually specified conda environment?\n",
"Topic: [(0, 0.02862434), (1, 0.02858204), (2, 0.02886313), (3, 0.8851747), (4, 0.028755778)]\n",
"Question: What are inference params and how are they used during model inference?\n",
"Topic: [(0, 0.86457103), (1, 0.03353862), (2, 0.033417325), (3, 0.034004394), (4, 0.034468662)]\n",
"Question: What is the purpose of model signatures in MLflow?\n",
"Topic: [(0, 0.040070876), (1, 0.04000346), (2, 0.040688124), (3, 0.040469088), (4, 0.8387685)]\n",
"Question: What is the API used to set signatures on models?\n",
"Topic: [(0, 0.033873636), (1, 0.033508822), (2, 0.033337757), (3, 0.035357967), (4, 0.8639218)]\n",
"Question: What components are used to generate the final time series?\n",
"Topic: [(0, 0.028693806), (1, 0.8853218), (2, 0.028573763), (3, 0.02862714), (4, 0.0287835)]\n",
"Question: What functionality does the configuration DataFrame submitted to the pyfunc flavor provide?\n",
"Topic: [(0, 0.02519801), (1, 0.025009492), (2, 0.025004204), (3, 0.025004204), (4, 0.8997841)]\n",
"Question: What is a common configuration for lowering the total memory pressure for pytorch models within transformers pipelines?\n",
"Topic: [(0, 0.93316424), (1, 0.016669936), (2, 0.016668117), (3, 0.016788227), (4, 0.016709473)]\n",
"Question: What does the save_model() function do?\n",
"Topic: [(0, 0.10002145), (1, 0.59994656), (2, 0.10001026), (3, 0.10001026), (4, 0.10001151)]\n",
"Question: What is an MLflow Project?\n",
"Topic: [(0, 0.06667001), (1, 0.06667029), (2, 0.7321751), (3, 0.06711196), (4, 0.06737265)]\n",
"Question: What are the entry points in a MLproject file and how can you specify parameters for them?\n",
"Topic: [(0, 0.02857626), (1, 0.88541776), (2, 0.02868285), (3, 0.028626908), (4, 0.02869626)]\n",
"Question: What are the project environments supported by MLflow?\n",
"Topic: [(0, 0.040009078), (1, 0.040009864), (2, 0.839655), (3, 0.040126894), (4, 0.040199146)]\n",
"Question: What is the purpose of specifying a Conda environment in an MLflow project?\n",
"Topic: [(0, 0.028579442), (1, 0.028580135), (2, 0.8841217), (3, 0.028901232), (4, 0.029817443)]\n",
"Question: What is the purpose of the MLproject file?\n",
"Topic: [(0, 0.05001335), (1, 0.052611485), (2, 0.050071735), (3, 0.05043289), (4, 0.7968705)]\n",
"Question: How can you pass runtime parameters to the entry point of an MLflow Project?\n",
"Topic: [(0, 0.025007373), (1, 0.025498485), (2, 0.8993807), (3, 0.02504522), (4, 0.025068246)]\n",
"Question: How does MLflow run a Project on Kubernetes?\n",
"Topic: [(0, 0.04000677), (1, 0.040007353), (2, 0.83931196), (3, 0.04012452), (4, 0.04054937)]\n",
"Question: What fields are replaced when MLflow creates a Kubernetes Job for an MLflow Project?\n",
"Topic: [(0, 0.022228329), (1, 0.022228856), (2, 0.023192631), (3, 0.02235802), (4, 0.90999216)]\n",
"Question: What is the syntax for searching runs using the MLflow UI and API?\n",
"Topic: [(0, 0.025003674), (1, 0.02500399), (2, 0.02527212), (3, 0.89956146), (4, 0.025158761)]\n",
"Question: What is the syntax for searching runs using the MLflow UI and API?\n",
"Topic: [(0, 0.025003672), (1, 0.025003988), (2, 0.025272164), (3, 0.8995614), (4, 0.025158769)]\n",
"Question: What are the key parts of a search expression in MLflow?\n",
"Topic: [(0, 0.03334423), (1, 0.03334517), (2, 0.8662702), (3, 0.033611353), (4, 0.033429127)]\n",
"Question: What are the key attributes for the model with the run_id 'a1b2c3d4' and run_name 'my-run'?\n",
"Topic: [(0, 0.05017508), (1, 0.05001634), (2, 0.05058142), (3, 0.7985237), (4, 0.050703418)]\n",
"Question: What information does each run record in MLflow Tracking?\n",
"Topic: [(0, 0.03333968), (1, 0.033340227), (2, 0.86639804), (3, 0.03349555), (4, 0.033426523)]\n",
"Question: What are the two components used by MLflow for storage?\n",
"Topic: [(0, 0.0334928), (1, 0.033938777), (2, 0.033719826), (3, 0.03357158), (4, 0.86527705)]\n",
"Question: What interfaces does the MLflow client use to record MLflow entities and artifacts when running MLflow on a local machine with a SQLAlchemy-compatible database?\n",
"Topic: [(0, 0.014289577), (1, 0.014289909), (2, 0.94276434), (3, 0.014325481), (4, 0.014330726)]\n",
"Question: What is the default backend store used by MLflow?\n",
"Topic: [(0, 0.033753525), (1, 0.03379533), (2, 0.033777602), (3, 0.86454684), (4, 0.0341267)]\n",
"Question: What information does autologging capture when launching short-lived MLflow runs?\n",
"Topic: [(0, 0.028579954), (1, 0.02858069), (2, 0.8851724), (3, 0.029027484), (4, 0.028639426)]\n",
"Question: What is the purpose of the --serve-artifacts flag?\n",
"Topic: [(0, 0.06670548), (1, 0.066708855), (2, 0.067003354), (3, 0.3969311), (4, 0.40265122)]\n",
"\n",
"Topics found are:\n",
"Topic: 0 \n",
"Words: 0.059*\"inference\" + 0.032*\"models\" + 0.032*\"used\" + 0.032*\"configuration\" + 0.032*\"common\" + 0.032*\"transformers\" + 0.032*\"total\" + 0.032*\"within\" + 0.032*\"pytorch\" + 0.032*\"pipelines\"\n",
"\n",
"Topic: 1 \n",
"Words: 0.036*\"file\" + 0.035*\"mlproject\" + 0.035*\"used\" + 0.035*\"components\" + 0.035*\"entry\" + 0.035*\"parameters\" + 0.035*\"specify\" + 0.035*\"final\" + 0.035*\"points\" + 0.035*\"time\"\n",
"\n",
"Topic: 2 \n",
"Words: 0.142*\"mlflow\" + 0.066*\"project\" + 0.028*\"information\" + 0.028*\"use\" + 0.028*\"record\" + 0.028*\"run\" + 0.015*\"key\" + 0.015*\"running\" + 0.015*\"artifacts\" + 0.015*\"client\"\n",
"\n",
"Topic: 3 \n",
"Words: 0.066*\"models\" + 0.066*\"model\" + 0.066*\"mlflow\" + 0.041*\"using\" + 0.041*\"registry\" + 0.028*\"api\" + 0.028*\"registered\" + 0.028*\"runs\" + 0.028*\"syntax\" + 0.028*\"searching\"\n",
"\n",
"Topic: 4 \n",
"Words: 0.089*\"model\" + 0.074*\"purpose\" + 0.074*\"mlflow\" + 0.046*\"registry\" + 0.031*\"used\" + 0.031*\"signatures\" + 0.017*\"kubernetes\" + 0.017*\"fields\" + 0.017*\"job\" + 0.017*\"replaced\"\n",
"\n"
]
}
],
"source": [
"lda_model, corpus, dictionary = topical_analysis(hit_questions)\n",
"vis_data = gensimvis.prepare(lda_model, corpus, dictionary)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "a0587a0f-b35d-488d-9054-55435a9585bf",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": [
"# Uncomment the following line to render the interactive widget\n",
"# pyLDAvis.display(vis_data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {
"byteLimit": 2048000,
"rowLimit": 10000
},
"inputWidgets": {},
"nuid": "1375250d-9818-4503-87ec-f14020d87c81",
"showTitle": false,
"title": ""
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Question: What is the purpose of the mlflow.sklearn.log_model() method?\n",
"Topic: [(0, 0.0669118), (1, 0.06701085), (2, 0.06667974), (3, 0.73235476), (4, 0.06704286)]\n",
"Question: How can you fetch a specific model version?\n",
"Topic: [(0, 0.83980393), (1, 0.040003464), (2, 0.04000601), (3, 0.040101767), (4, 0.040084846)]\n",
"Question: How can you fetch the latest model version in a specific stage?\n",
"Topic: [(0, 0.88561153), (1, 0.028575428), (2, 0.028578365), (3, 0.0286214), (4, 0.028613236)]\n",
"Question: What can you do to promote MLflow Models across environments?\n",
"Topic: [(0, 0.8661927), (1, 0.0333396), (2, 0.03362743), (3, 0.033428304), (4, 0.033411972)]\n",
"Question: What is the name of the model and its version details?\n",
"Topic: [(0, 0.83978903), (1, 0.04000637), (2, 0.04001106), (3, 0.040105395), (4, 0.040088095)]\n",
"Question: What is the purpose of saving the model in pickled format?\n",
"Topic: [(0, 0.033948876), (1, 0.03339717), (2, 0.033340737), (3, 0.86575514), (4, 0.033558063)]\n",
"Question: What is an MLflow Model and what is its purpose?\n",
"Topic: [(0, 0.7940762), (1, 0.05068333), (2, 0.050770763), (3, 0.053328265), (4, 0.05114142)]\n",
"Question: What are the flavors defined in the MLmodel file for the mlflow.sklearn library?\n",
"Topic: [(0, 0.86628276), (1, 0.033341788), (2, 0.03334801), (3, 0.03368498), (4, 0.033342462)]\n",
"Question: What command can be used to package and deploy models to AWS SageMaker?\n",
"Topic: [(0, 0.89991224), (1, 0.025005225), (2, 0.025009066), (3, 0.025006713), (4, 0.025066752)]\n",
"Question: What is the purpose of the --build-image flag when running mlflow run?\n",
"Topic: [(0, 0.033957016), (1, 0.033506736), (2, 0.034095332), (3, 0.034164555), (4, 0.86427635)]\n",
"Question: What is the relative path to the python_env YAML file within the MLflow project's directory?\n",
"Topic: [(0, 0.02243), (1, 0.02222536), (2, 0.022470985), (3, 0.9105873), (4, 0.02228631)]\n",
"Question: What are the additional local volume mounted and environment variables in the docker container?\n",
"Topic: [(0, 0.022225259), (1, 0.9110914), (2, 0.02222932), (3, 0.022227468), (4, 0.022226628)]\n",
"Question: What are some examples of entity names that contain special characters?\n",
"Topic: [(0, 0.028575381), (1, 0.88568854), (2, 0.02858065), (3, 0.028578246), (4, 0.028577149)]\n",
"Question: What type of constant does the RHS need to be if LHS is a metric?\n",
"Topic: [(0, 0.028575381), (1, 0.8856886), (2, 0.028580645), (3, 0.028578239), (4, 0.028577147)]\n",
"Question: How can you get all active runs from experiments IDs 3, 4, and 17 that used a CNN model with 10 layers and had a prediction accuracy of 94.5% or higher?\n",
"Topic: [(0, 0.015563371), (1, 0.015387185), (2, 0.015389071), (3, 0.015427767), (4, 0.9382326)]\n",
"Question: What is the purpose of the 'experimentIds' variable in the given paragraph?\n",
"Topic: [(0, 0.040206533), (1, 0.8384999), (2, 0.040013183), (3, 0.040967643), (4, 0.040312726)]\n",
"Question: What is the MLflow Tracking component used for?\n",
"Topic: [(0, 0.8390845), (1, 0.04000697), (2, 0.040462855), (3, 0.04014182), (4, 0.040303845)]\n",
"Question: How can you create an experiment in MLflow?\n",
"Topic: [(0, 0.050333958), (1, 0.0500024), (2, 0.7993825), (3, 0.050153885), (4, 0.05012722)]\n",
"Question: How can you create an experiment using MLflow?\n",
"Topic: [(0, 0.04019285), (1, 0.04000254), (2, 0.8396381), (3, 0.040091105), (4, 0.04007539)]\n",
"Question: What is the architecture depicted in this example scenario?\n",
"Topic: [(0, 0.04000523), (1, 0.040007014), (2, 0.040012203), (3, 0.04000902), (4, 0.83996654)]\n",
"\n",
"Topics found are:\n",
"Topic: 0 \n",
"Words: 0.078*\"model\" + 0.059*\"mlflow\" + 0.059*\"version\" + 0.041*\"models\" + 0.041*\"fetch\" + 0.041*\"specific\" + 0.041*\"used\" + 0.022*\"command\" + 0.022*\"deploy\" + 0.022*\"sagemaker\"\n",
"\n",
"Topic: 1 \n",
"Words: 0.030*\"local\" + 0.030*\"container\" + 0.030*\"variables\" + 0.030*\"docker\" + 0.030*\"mounted\" + 0.030*\"environment\" + 0.030*\"volume\" + 0.030*\"additional\" + 0.030*\"special\" + 0.030*\"names\"\n",
"\n",
"Topic: 2 \n",
"Words: 0.096*\"experiment\" + 0.096*\"create\" + 0.096*\"mlflow\" + 0.051*\"using\" + 0.009*\"purpose\" + 0.009*\"model\" + 0.009*\"method\" + 0.009*\"file\" + 0.009*\"version\" + 0.009*\"used\"\n",
"\n",
"Topic: 3 \n",
"Words: 0.071*\"purpose\" + 0.039*\"file\" + 0.039*\"mlflow\" + 0.039*\"yaml\" + 0.039*\"directory\" + 0.039*\"relative\" + 0.039*\"within\" + 0.039*\"path\" + 0.039*\"project\" + 0.039*\"format\"\n",
"\n",
"Topic: 4 \n",
"Words: 0.032*\"purpose\" + 0.032*\"used\" + 0.032*\"model\" + 0.032*\"prediction\" + 0.032*\"get\" + 0.032*\"accuracy\" + 0.032*\"active\" + 0.032*\"layers\" + 0.032*\"higher\" + 0.032*\"experiments\"\n",
"\n"
]
}
],
"source": [
"lda_model, corpus, dictionary = topical_analysis(miss_questions)\n",
"vis_data = gensimvis.prepare(lda_model, corpus, dictionary)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "724db985-5382-43a6-ada5-0ac1c2d49c18",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": [
"# Uncomment the following line to render the interactive widget\n",
"# pyLDAvis.display(vis_data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"application/vnd.databricks.v1+cell": {
"cellMetadata": {},
"inputWidgets": {},
"nuid": "31945151-7cf9-4f25-af30-d9b9bd526e7b",
"showTitle": false,
"title": ""
}
},
"outputs": [],
"source": []
}
],
"metadata": {
"application/vnd.databricks.v1+notebook": {
"dashboards": [],
"language": "python",
"notebookMetadata": {
"pythonIndentUnit": 4
},
"notebookName": "retriever-evaluation-tutorial",
"widgets": {}
},
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"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.9.19"
}
},
"nbformat": 4,
"nbformat_minor": 1
}
|