File size: 152,511 Bytes
78aa4ee |
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 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 |
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"accelerator": "GPU",
"colab": {
"name": "starter_notebook.ipynb",
"provenance": [],
"collapsed_sections": [],
"toc_visible": true,
"include_colab_link": true
},
"kernelspec": {
"display_name": "Python 3",
"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.5.6"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/github/bamtak/masakhane/blob/master/en-yo/jw300-baseline-improve/en_yo_jw300_notebook_gdrive.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "Igc5itf-xMGj"
},
"source": [
"# Masakhane - Machine Translation for African Languages (Using JoeyNMT)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "x4fXCKCf36IK"
},
"source": [
"## Note before beginning:\n",
"### - The idea is that you should be able to make minimal changes to this in order to get SOME result for your own translation corpus. \n",
"\n",
"### - The tl;dr: Go to the **\"TODO\"** comments which will tell you what to update to get up and running\n",
"\n",
"### - If you actually want to have a clue what you're doing, read the text and peek at the links\n",
"\n",
"### - With 100 epochs, it should take around 7 hours to run in Google Colab\n",
"\n",
"### - Once you've gotten a result for your language, please attach and email your notebook that generated it to [email protected]\n",
"\n",
"### - If you care enough and get a chance, doing a brief background on your language would be amazing. See examples in [(Martinus, 2019)](https://arxiv.org/abs/1906.05685)"
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "l929HimrxS0a"
},
"source": [
"## Retrieve your data & make a parallel corpus\n",
"\n",
"If you are wanting to use the JW300 data referenced on the Masakhane website or in our GitHub repo, you can use `opus-tools` to convert the data into a convenient format. `opus_read` from that package provides a convenient tool for reading the native aligned XML files and to convert them to TMX format. The tool can also be used to fetch relevant files from OPUS on the fly and to filter the data as necessary. [Read the documentation](https://pypi.org/project/opustools-pkg/) for more details.\n",
"\n",
"Once you have your corpus files in TMX format (an xml structure which will include the sentences in your target language and your source language in a single file), we recommend reading them into a pandas dataframe. Thankfully, Jade wrote a silly `tmx2dataframe` package which converts your tmx file to a pandas dataframe. "
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "oGRmDELn7Az0",
"outputId": "98551454-5471-46f5-81fc-fa483f28d350",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 127
}
},
"source": [
"from google.colab import drive\n",
"drive.mount('/content/drive')"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&response_type=code&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly\n",
"\n",
"Enter your authorization code:\n",
"··········\n",
"Mounted at /content/drive\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "Cn3tgQLzUxwn",
"colab": {}
},
"source": [
"# TODO: Set your source and target languages. Keep in mind, these traditionally use language codes as found here:\n",
"# These will also become the suffix's of all vocab and corpus files used throughout\n",
"import os\n",
"source_language = \"en\"\n",
"target_language = \"yo\" \n",
"lc = False # If True, lowercase the data.\n",
"seed = 42 # Random seed for shuffling.\n",
"tag = \"baseline\" # Give a unique name to your folder - this is to ensure you don't rewrite any models you've already submitted\n",
"\n",
"os.environ[\"src\"] = source_language # Sets them in bash as well, since we often use bash scripts\n",
"os.environ[\"tgt\"] = target_language\n",
"os.environ[\"tag\"] = tag\n",
"\n",
"# This will save it to a folder in our gdrive instead! \n",
"!mkdir -p \"/content/drive/My Drive/masakhane/$src-$tgt-$tag\"\n",
"g_drive_path = \"/content/drive/My Drive/masakhane/%s-%s-%s\" % (source_language, target_language, tag)\n",
"os.environ[\"gdrive_path\"] = g_drive_path\n",
"models_path = '%s/models/%s%s_transformer'% (g_drive_path, source_language, target_language)\n",
"# model temporary directory for training\n",
"model_temp_dir = \"/content/drive/My Drive/masakhane/model-temp\"\n",
"# model permanent storage on the drive\n",
"!mkdir -p \"$gdrive_path/models/${src}${tgt}_transformer/\""
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "kBSgJHEw7Nvx",
"outputId": "0af3ab77-2c6a-431e-a299-9ea9f7904869",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
}
},
"source": [
"!echo $gdrive_path"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"/content/drive/My Drive/masakhane/en-yo-baseline\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "gA75Fs9ys8Y9",
"outputId": "835f0426-5e3e-4c70-8737-d1f1677ee041",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
}
},
"source": [
"#TODO: Skip for retrain\n",
"# Install opus-tools\n",
"! pip install opustools-pkg "
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"Requirement already satisfied: opustools-pkg in /usr/local/lib/python3.6/dist-packages (0.0.52)\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "xq-tDZVks7ZD",
"outputId": "96da3b64-d252-4747-95e9-38645b578431",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 215
}
},
"source": [
"#TODO: Skip for retrain\n",
"# Downloading our corpus\n",
"! opus_read -d JW300 -s $src -t $tgt -wm moses -w jw300.$src jw300.$tgt -q\n",
"\n",
"# extract the corpus file\n",
"! gunzip JW300_latest_xml_$src-$tgt.xml.gz"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"\n",
"Alignment file /proj/nlpl/data/OPUS/JW300/latest/xml/en-yo.xml.gz not found. The following files are available for downloading:\n",
"\n",
" ./JW300_latest_xml_en.zip already exists\n",
" ./JW300_latest_xml_yo.zip already exists\n",
" 4 MB https://object.pouta.csc.fi/OPUS-JW300/v1/xml/en-yo.xml.gz\n",
"\n",
" 4 MB Total size\n",
"./JW300_latest_xml_en-yo.xml.gz ... 100% of 4 MB\n",
"gzip: JW300_latest_xml_en-yo.xml already exists; do you wish to overwrite (y or n)? n\n",
"\tnot overwritten\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "n48GDRnP8y2G",
"colab_type": "code",
"outputId": "10dc77a6-1b2c-4db7-dea0-90648614af5b",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 611
}
},
"source": [
"#TODO: Skip for retrain\n",
"# Download the global test set.\n",
"! wget https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-any.en\n",
" \n",
"# And the specific test set for this language pair.\n",
"os.environ[\"trg\"] = target_language \n",
"os.environ[\"src\"] = source_language \n",
"\n",
"! wget https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-$trg.en \n",
"! mv test.en-$trg.en test.en\n",
"! wget https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-$trg.$trg \n",
"! mv test.en-$trg.$trg test.$trg"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"--2020-04-12 10:38:37-- https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-any.en\n",
"Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...\n",
"Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 277791 (271K) [text/plain]\n",
"Saving to: ‘test.en-any.en’\n",
"\n",
"\rtest.en-any.en 0%[ ] 0 --.-KB/s \rtest.en-any.en 100%[===================>] 271.28K --.-KB/s in 0.02s \n",
"\n",
"2020-04-12 10:38:38 (17.4 MB/s) - ‘test.en-any.en’ saved [277791/277791]\n",
"\n",
"--2020-04-12 10:38:40-- https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-yo.en\n",
"Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...\n",
"Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 201994 (197K) [text/plain]\n",
"Saving to: ‘test.en-yo.en’\n",
"\n",
"test.en-yo.en 100%[===================>] 197.26K --.-KB/s in 0.02s \n",
"\n",
"2020-04-12 10:38:40 (12.4 MB/s) - ‘test.en-yo.en’ saved [201994/201994]\n",
"\n",
"--2020-04-12 10:38:45-- https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-yo.yo\n",
"Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...\n",
"Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.\n",
"HTTP request sent, awaiting response... 200 OK\n",
"Length: 280073 (274K) [text/plain]\n",
"Saving to: ‘test.en-yo.yo’\n",
"\n",
"test.en-yo.yo 100%[===================>] 273.51K --.-KB/s in 0.02s \n",
"\n",
"2020-04-12 10:38:45 (13.8 MB/s) - ‘test.en-yo.yo’ saved [280073/280073]\n",
"\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "NqDG-CI28y2L",
"colab_type": "code",
"outputId": "58edfffd-d1fe-47e4-aed8-bed2d882b389",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
}
},
"source": [
"#TODO: Skip for retrain\n",
"# Read the test data to filter from train and dev splits.\n",
"# Store english portion in set for quick filtering checks.\n",
"en_test_sents = set()\n",
"filter_test_sents = \"test.en-any.en\"\n",
"j = 0\n",
"with open(filter_test_sents) as f:\n",
" for line in f:\n",
" en_test_sents.add(line.strip())\n",
" j += 1\n",
"print('Loaded {} global test sentences to filter from the training/dev data.'.format(j))"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"Loaded 3571 global test sentences to filter from the training/dev data.\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "3CNdwLBCfSIl",
"outputId": "7dd3286b-6348-4c6a-bdea-bd43a4c04dfb",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 160
}
},
"source": [
"#TODO: Skip for retrain\n",
"import pandas as pd\n",
"\n",
"# TMX file to dataframe\n",
"source_file = 'jw300.' + source_language\n",
"target_file = 'jw300.' + target_language\n",
"\n",
"source = []\n",
"target = []\n",
"skip_lines = [] # Collect the line numbers of the source portion to skip the same lines for the target portion.\n",
"with open(source_file) as f:\n",
" for i, line in enumerate(f):\n",
" # Skip sentences that are contained in the test set.\n",
" if line.strip() not in en_test_sents:\n",
" source.append(line.strip())\n",
" else:\n",
" skip_lines.append(i) \n",
"with open(target_file) as f:\n",
" for j, line in enumerate(f):\n",
" # Only add to corpus if corresponding source was not skipped.\n",
" if j not in skip_lines:\n",
" target.append(line.strip())\n",
" \n",
"print('Loaded data and skipped {}/{} lines since contained in test set.'.format(len(skip_lines), i))\n",
" \n",
"df = pd.DataFrame(zip(source, target), columns=['source_sentence', 'target_sentence'])\n",
"# if you get TypeError: data argument can't be an iterator is because of your zip version run this below\n",
"#df = pd.DataFrame(list(zip(source, target)), columns=['source_sentence', 'target_sentence'])\n",
"df.head(3)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"Loaded data and skipped 5663/474986 lines since contained in test set.\n"
],
"name": "stdout"
},
{
"output_type": "execute_result",
"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>source_sentence</th>\n",
" <th>target_sentence</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Using Ladders — Do You Make These Safety Checks ?</td>\n",
" <td>Lílo Àkàbà — Ǹjẹ́ O Máa Ń Ṣe Àyẹ̀wò Wọ̀nyí Tó...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>By Awake !</td>\n",
" <td>Látọwọ́ akọ̀ròyìn Jí !</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>correspondent in Ireland</td>\n",
" <td>ní Ireland</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" source_sentence target_sentence\n",
"0 Using Ladders — Do You Make These Safety Checks ? Lílo Àkàbà — Ǹjẹ́ O Máa Ń Ṣe Àyẹ̀wò Wọ̀nyí Tó...\n",
"1 By Awake ! Látọwọ́ akọ̀ròyìn Jí !\n",
"2 correspondent in Ireland ní Ireland"
]
},
"metadata": {
"tags": []
},
"execution_count": 25
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "PvLN2qO1_NuA",
"colab_type": "code",
"outputId": "5f6e31c7-2d79-4ca5-d404-368b86bf261d",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
}
},
"source": [
"print(df.shape)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"(469324, 2)\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "YkuK3B4p2AkN"
},
"source": [
"## Pre-processing and export\n",
"\n",
"It is generally a good idea to remove duplicate translations and conflicting translations from the corpus. In practice, these public corpora include some number of these that need to be cleaned.\n",
"\n",
"In addition we will split our data into dev/test/train and export to the filesystem."
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "M_2ouEOH1_1q",
"outputId": "29f8a1d0-a910-44a6-955a-40c6a3d4cb28",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 197
}
},
"source": [
"#TODO: Skip for retrain\n",
"# drop duplicate translations\n",
"df_pp = df.drop_duplicates()\n",
"\n",
"# drop conflicting translations\n",
"# (this is optional and something that you might want to comment out \n",
"# depending on the size of your corpus)\n",
"df_pp.drop_duplicates(subset='source_sentence', inplace=True)\n",
"df_pp.drop_duplicates(subset='target_sentence', inplace=True)\n",
"\n",
"# Shuffle the data to remove bias in dev set selection.\n",
"df_pp = df_pp.sample(frac=1, random_state=seed).reset_index(drop=True)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:6: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" \n",
"/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:7: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" import sys\n"
],
"name": "stderr"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "Z_1BwAApEtMk",
"colab_type": "code",
"outputId": "9cb9e1c7-df14-4985-c08b-650dab4239c3",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
}
},
"source": [
"#TODO: Skip for retrain\n",
"# Install fuzzy wuzzy to remove \"almost duplicate\" sentences in the\n",
"# test and training sets.\n",
"! pip install fuzzywuzzy\n",
"! pip install python-Levenshtein\n",
"import time\n",
"from fuzzywuzzy import process\n",
"import numpy as np\n",
"\n",
"# reset the index of the training set after previous filtering\n",
"df_pp.reset_index(drop=False, inplace=True)\n",
"\n",
"# Remove samples from the training data set if they \"almost overlap\" with the\n",
"# samples in the test set.\n",
"\n",
"# Filtering function. Adjust pad to narrow down the candidate matches to\n",
"# within a certain length of characters of the given sample.\n",
"def fuzzfilter(sample, candidates, pad):\n",
" candidates = [x for x in candidates if len(x) <= len(sample)+pad and len(x) >= len(sample)-pad] \n",
" if len(candidates) > 0:\n",
" return process.extractOne(sample, candidates)[1]\n",
" else:\n",
" return np.nan\n",
"\n",
"# NOTE - This might run slow depending on the size of your training set. We are\n",
"# printing some information to help you track how long it would take. \n",
"scores = []\n",
"start_time = time.time()\n",
"for idx, row in df_pp.iterrows():\n",
" scores.append(fuzzfilter(row['source_sentence'], list(en_test_sents), 5))\n",
" if idx % 1000 == 0:\n",
" hours, rem = divmod(time.time() - start_time, 3600)\n",
" minutes, seconds = divmod(rem, 60)\n",
" print(\"{:0>2}:{:0>2}:{:05.2f}\".format(int(hours),int(minutes),seconds), \"%0.2f percent complete\" % (100.0*float(idx)/float(len(df_pp))))\n",
"\n",
"# Filter out \"almost overlapping samples\"\n",
"df_pp['scores'] = scores\n",
"df_pp = df_pp[df_pp['scores'] < 95]"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"Collecting fuzzywuzzy\n",
" Downloading https://files.pythonhosted.org/packages/43/ff/74f23998ad2f93b945c0309f825be92e04e0348e062026998b5eefef4c33/fuzzywuzzy-0.18.0-py2.py3-none-any.whl\n",
"Installing collected packages: fuzzywuzzy\n",
"Successfully installed fuzzywuzzy-0.18.0\n",
"Collecting python-Levenshtein\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/42/a9/d1785c85ebf9b7dfacd08938dd028209c34a0ea3b1bcdb895208bd40a67d/python-Levenshtein-0.12.0.tar.gz (48kB)\n",
"\u001b[K |████████████████████████████████| 51kB 3.7MB/s \n",
"\u001b[?25hRequirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from python-Levenshtein) (46.1.3)\n",
"Building wheels for collected packages: python-Levenshtein\n",
" Building wheel for python-Levenshtein (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for python-Levenshtein: filename=python_Levenshtein-0.12.0-cp36-cp36m-linux_x86_64.whl size=144791 sha256=a1c171e3c3fe2182059c6a83ce2ae60e74751a04db7685b0ea524689d1f62695\n",
" Stored in directory: /root/.cache/pip/wheels/de/c2/93/660fd5f7559049268ad2dc6d81c4e39e9e36518766eaf7e342\n",
"Successfully built python-Levenshtein\n",
"Installing collected packages: python-Levenshtein\n",
"Successfully installed python-Levenshtein-0.12.0\n",
"00:00:00.14 0.00 percent complete\n",
"00:00:19.48 0.24 percent complete\n",
"00:00:38.24 0.48 percent complete\n",
"00:00:57.35 0.72 percent complete\n",
"00:01:16.41 0.96 percent complete\n",
"00:01:36.32 1.20 percent complete\n",
"00:01:54.42 1.43 percent complete\n",
"00:02:13.76 1.67 percent complete\n",
"00:02:32.86 1.91 percent complete\n",
"00:02:51.77 2.15 percent complete\n",
"00:03:10.64 2.39 percent complete\n",
"00:03:29.13 2.63 percent complete\n",
"00:03:48.32 2.87 percent complete\n",
"00:04:08.03 3.11 percent complete\n",
"00:04:27.79 3.35 percent complete\n",
"00:04:47.30 3.59 percent complete\n",
"00:05:06.58 3.82 percent complete\n",
"00:05:26.26 4.06 percent complete\n",
"00:05:45.64 4.30 percent complete\n",
"00:06:04.54 4.54 percent complete\n",
"00:06:23.68 4.78 percent complete\n",
"00:06:43.17 5.02 percent complete\n",
"00:07:02.45 5.26 percent complete\n",
"00:07:22.16 5.50 percent complete\n",
"00:07:41.64 5.74 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '↓']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"00:08:01.48 5.98 percent complete\n",
"00:08:21.53 6.22 percent complete\n",
"00:08:40.78 6.45 percent complete\n",
"00:09:00.17 6.69 percent complete\n",
"00:09:19.45 6.93 percent complete\n",
"00:09:39.29 7.17 percent complete\n",
"00:09:59.40 7.41 percent complete\n",
"00:10:18.60 7.65 percent complete\n",
"00:10:38.11 7.89 percent complete\n",
"00:10:57.05 8.13 percent complete\n",
"00:11:16.07 8.37 percent complete\n",
"00:11:34.85 8.61 percent complete\n",
"00:11:54.55 8.84 percent complete\n",
"00:12:13.53 9.08 percent complete\n",
"00:12:33.17 9.32 percent complete\n",
"00:12:52.62 9.56 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '” *']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"00:13:11.97 9.80 percent complete\n",
"00:13:30.86 10.04 percent complete\n",
"00:13:50.00 10.28 percent complete\n",
"00:14:08.82 10.52 percent complete\n",
"00:14:27.63 10.76 percent complete\n",
"00:14:46.80 11.00 percent complete\n",
"00:15:06.59 11.24 percent complete\n",
"00:15:25.99 11.47 percent complete\n",
"00:15:45.38 11.71 percent complete\n",
"00:16:04.40 11.95 percent complete\n",
"00:16:24.45 12.19 percent complete\n",
"00:16:44.30 12.43 percent complete\n",
"00:17:03.79 12.67 percent complete\n",
"00:17:23.06 12.91 percent complete\n",
"00:17:42.35 13.15 percent complete\n",
"00:18:01.42 13.39 percent complete\n",
"00:18:20.67 13.63 percent complete\n",
"00:18:39.97 13.86 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '. .']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"00:18:59.55 14.10 percent complete\n",
"00:19:18.33 14.34 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '․ ․']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"00:19:37.46 14.58 percent complete\n",
"00:19:56.46 14.82 percent complete\n",
"00:20:15.45 15.06 percent complete\n",
"00:20:34.26 15.30 percent complete\n",
"00:20:53.51 15.54 percent complete\n",
"00:21:12.89 15.78 percent complete\n",
"00:21:33.00 16.02 percent complete\n",
"00:21:51.93 16.26 percent complete\n",
"00:22:11.19 16.49 percent complete\n",
"00:22:30.35 16.73 percent complete\n",
"00:22:49.70 16.97 percent complete\n",
"00:23:08.82 17.21 percent complete\n",
"00:23:27.89 17.45 percent complete\n",
"00:23:46.97 17.69 percent complete\n",
"00:24:06.84 17.93 percent complete\n",
"00:24:27.01 18.17 percent complete\n",
"00:24:46.83 18.41 percent complete\n",
"00:25:06.58 18.65 percent complete\n",
"00:25:25.83 18.88 percent complete\n",
"00:25:44.76 19.12 percent complete\n",
"00:26:04.07 19.36 percent complete\n",
"00:26:23.82 19.60 percent complete\n",
"00:26:43.21 19.84 percent complete\n",
"00:27:02.60 20.08 percent complete\n",
"00:27:21.80 20.32 percent complete\n",
"00:27:40.93 20.56 percent complete\n",
"00:28:00.87 20.80 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '․ ․ ․']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"00:28:21.00 21.04 percent complete\n",
"00:28:40.58 21.28 percent complete\n",
"00:29:00.14 21.51 percent complete\n",
"00:29:19.55 21.75 percent complete\n",
"00:29:38.64 21.99 percent complete\n",
"00:29:58.39 22.23 percent complete\n",
"00:30:18.61 22.47 percent complete\n",
"00:30:37.60 22.71 percent complete\n",
"00:30:57.43 22.95 percent complete\n",
"00:31:17.22 23.19 percent complete\n",
"00:31:36.00 23.43 percent complete\n",
"00:31:55.60 23.67 percent complete\n",
"00:32:14.69 23.90 percent complete\n",
"00:32:34.38 24.14 percent complete\n",
"00:32:54.37 24.38 percent complete\n",
"00:33:13.84 24.62 percent complete\n",
"00:33:33.13 24.86 percent complete\n",
"00:33:52.54 25.10 percent complete\n",
"00:34:11.92 25.34 percent complete\n",
"00:34:31.24 25.58 percent complete\n",
"00:34:50.33 25.82 percent complete\n",
"00:35:09.71 26.06 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '→ →']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"00:35:28.90 26.29 percent complete\n",
"00:35:49.15 26.53 percent complete\n",
"00:36:09.29 26.77 percent complete\n",
"00:36:29.17 27.01 percent complete\n",
"00:36:48.44 27.25 percent complete\n",
"00:37:07.91 27.49 percent complete\n",
"00:37:27.28 27.73 percent complete\n",
"00:37:46.68 27.97 percent complete\n",
"00:38:06.01 28.21 percent complete\n",
"00:38:25.17 28.45 percent complete\n",
"00:38:43.85 28.69 percent complete\n",
"00:39:02.70 28.92 percent complete\n",
"00:39:21.71 29.16 percent complete\n",
"00:39:40.86 29.40 percent complete\n",
"00:39:59.39 29.64 percent complete\n",
"00:40:18.25 29.88 percent complete\n",
"00:40:37.33 30.12 percent complete\n",
"00:40:55.96 30.36 percent complete\n",
"00:41:15.03 30.60 percent complete\n",
"00:41:34.04 30.84 percent complete\n",
"00:41:53.28 31.08 percent complete\n",
"00:42:11.78 31.31 percent complete\n",
"00:42:30.65 31.55 percent complete\n",
"00:42:49.16 31.79 percent complete\n",
"00:43:08.59 32.03 percent complete\n",
"00:43:28.07 32.27 percent complete\n",
"00:43:47.07 32.51 percent complete\n",
"00:44:05.67 32.75 percent complete\n",
"00:44:24.69 32.99 percent complete\n",
"00:44:43.52 33.23 percent complete\n",
"00:45:02.12 33.47 percent complete\n",
"00:45:20.69 33.71 percent complete\n",
"00:45:40.03 33.94 percent complete\n",
"00:45:59.24 34.18 percent complete\n",
"00:46:18.22 34.42 percent complete\n",
"00:46:37.17 34.66 percent complete\n",
"00:46:56.24 34.90 percent complete\n",
"00:47:15.74 35.14 percent complete\n",
"00:47:34.56 35.38 percent complete\n",
"00:47:53.57 35.62 percent complete\n",
"00:48:13.48 35.86 percent complete\n",
"00:48:32.86 36.10 percent complete\n",
"00:48:52.11 36.33 percent complete\n",
"00:49:10.67 36.57 percent complete\n",
"00:49:29.52 36.81 percent complete\n",
"00:49:48.74 37.05 percent complete\n",
"00:50:07.61 37.29 percent complete\n",
"00:50:27.28 37.53 percent complete\n",
"00:50:47.25 37.77 percent complete\n",
"00:51:05.67 38.01 percent complete\n",
"00:51:25.20 38.25 percent complete\n",
"00:51:43.96 38.49 percent complete\n",
"00:52:03.39 38.73 percent complete\n",
"00:52:22.39 38.96 percent complete\n",
"00:52:41.97 39.20 percent complete\n",
"00:53:00.97 39.44 percent complete\n",
"00:53:21.17 39.68 percent complete\n",
"00:53:40.23 39.92 percent complete\n",
"00:53:59.55 40.16 percent complete\n",
"00:54:19.29 40.40 percent complete\n",
"00:54:37.83 40.64 percent complete\n",
"00:54:56.81 40.88 percent complete\n",
"00:55:16.31 41.12 percent complete\n",
"00:55:36.08 41.35 percent complete\n",
"00:55:55.85 41.59 percent complete\n",
"00:56:14.97 41.83 percent complete\n",
"00:56:34.66 42.07 percent complete\n",
"00:56:53.64 42.31 percent complete\n",
"00:57:13.45 42.55 percent complete\n",
"00:57:33.47 42.79 percent complete\n",
"00:57:53.12 43.03 percent complete\n",
"00:58:12.20 43.27 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '↓ ↓']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"00:58:32.08 43.51 percent complete\n",
"00:58:51.55 43.75 percent complete\n",
"00:59:10.78 43.98 percent complete\n",
"00:59:29.87 44.22 percent complete\n",
"00:59:49.41 44.46 percent complete\n",
"01:00:08.94 44.70 percent complete\n",
"01:00:28.17 44.94 percent complete\n",
"01:00:47.95 45.18 percent complete\n",
"01:01:07.58 45.42 percent complete\n",
"01:01:26.95 45.66 percent complete\n",
"01:01:46.50 45.90 percent complete\n",
"01:02:05.59 46.14 percent complete\n",
"01:02:25.13 46.37 percent complete\n",
"01:02:44.58 46.61 percent complete\n",
"01:03:04.08 46.85 percent complete\n",
"01:03:23.16 47.09 percent complete\n",
"01:03:43.64 47.33 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '*']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"01:04:03.31 47.57 percent complete\n",
"01:04:23.01 47.81 percent complete\n",
"01:04:42.57 48.05 percent complete\n",
"01:05:02.17 48.29 percent complete\n",
"01:05:21.78 48.53 percent complete\n",
"01:05:41.50 48.77 percent complete\n",
"01:06:01.03 49.00 percent complete\n",
"01:06:20.08 49.24 percent complete\n",
"01:06:39.39 49.48 percent complete\n",
"01:06:59.05 49.72 percent complete\n",
"01:07:18.55 49.96 percent complete\n",
"01:07:37.54 50.20 percent complete\n",
"01:07:56.74 50.44 percent complete\n",
"01:08:15.77 50.68 percent complete\n",
"01:08:35.36 50.92 percent complete\n",
"01:08:55.00 51.16 percent complete\n",
"01:09:14.66 51.39 percent complete\n",
"01:09:34.11 51.63 percent complete\n",
"01:09:52.83 51.87 percent complete\n",
"01:10:12.29 52.11 percent complete\n",
"01:10:32.19 52.35 percent complete\n",
"01:10:52.16 52.59 percent complete\n",
"01:11:11.94 52.83 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '⇩']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"01:11:31.35 53.07 percent complete\n",
"01:11:50.96 53.31 percent complete\n",
"01:12:10.04 53.55 percent complete\n",
"01:12:29.43 53.79 percent complete\n",
"01:12:49.31 54.02 percent complete\n",
"01:13:08.41 54.26 percent complete\n",
"01:13:27.83 54.50 percent complete\n",
"01:13:47.41 54.74 percent complete\n",
"01:14:06.99 54.98 percent complete\n",
"01:14:26.57 55.22 percent complete\n",
"01:14:45.85 55.46 percent complete\n",
"01:15:05.62 55.70 percent complete\n",
"01:15:25.60 55.94 percent complete\n",
"01:15:45.42 56.18 percent complete\n",
"01:16:05.41 56.41 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '”']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"01:16:25.79 56.65 percent complete\n",
"01:16:45.75 56.89 percent complete\n",
"01:17:05.58 57.13 percent complete\n",
"01:17:25.10 57.37 percent complete\n",
"01:17:45.24 57.61 percent complete\n",
"01:18:05.41 57.85 percent complete\n",
"01:18:24.90 58.09 percent complete\n",
"01:18:44.64 58.33 percent complete\n",
"01:19:04.44 58.57 percent complete\n",
"01:19:25.12 58.81 percent complete\n",
"01:19:45.56 59.04 percent complete\n",
"01:20:05.63 59.28 percent complete\n",
"01:20:25.81 59.52 percent complete\n",
"01:20:45.91 59.76 percent complete\n",
"01:21:05.27 60.00 percent complete\n",
"01:21:25.29 60.24 percent complete\n",
"01:21:44.55 60.48 percent complete\n",
"01:22:04.45 60.72 percent complete\n",
"01:22:24.81 60.96 percent complete\n",
"01:22:44.36 61.20 percent complete\n",
"01:23:04.16 61.43 percent complete\n",
"01:23:23.03 61.67 percent complete\n",
"01:23:42.99 61.91 percent complete\n",
"01:24:02.77 62.15 percent complete\n",
"01:24:23.07 62.39 percent complete\n",
"01:24:42.63 62.63 percent complete\n",
"01:25:02.01 62.87 percent complete\n",
"01:25:21.57 63.11 percent complete\n",
"01:25:40.93 63.35 percent complete\n",
"01:26:00.62 63.59 percent complete\n",
"01:26:20.30 63.83 percent complete\n",
"01:26:39.92 64.06 percent complete\n",
"01:26:59.41 64.30 percent complete\n",
"01:27:18.80 64.54 percent complete\n",
"01:27:38.64 64.78 percent complete\n",
"01:27:58.23 65.02 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '↓ ↓ ↓ ↓']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"01:28:17.56 65.26 percent complete\n",
"01:28:36.69 65.50 percent complete\n",
"01:28:55.87 65.74 percent complete\n",
"01:29:15.58 65.98 percent complete\n",
"01:29:34.82 66.22 percent complete\n",
"01:29:54.19 66.45 percent complete\n",
"01:30:13.99 66.69 percent complete\n",
"01:30:33.75 66.93 percent complete\n",
"01:30:53.24 67.17 percent complete\n",
"01:31:12.51 67.41 percent complete\n",
"01:31:31.99 67.65 percent complete\n",
"01:31:51.55 67.89 percent complete\n",
"01:32:10.31 68.13 percent complete\n",
"01:32:29.96 68.37 percent complete\n",
"01:32:50.08 68.61 percent complete\n",
"01:33:10.33 68.85 percent complete\n",
"01:33:30.22 69.08 percent complete\n",
"01:33:49.70 69.32 percent complete\n",
"01:34:09.18 69.56 percent complete\n",
"01:34:28.07 69.80 percent complete\n",
"01:34:46.97 70.04 percent complete\n",
"01:35:06.03 70.28 percent complete\n",
"01:35:26.04 70.52 percent complete\n",
"01:35:45.87 70.76 percent complete\n",
"01:36:05.54 71.00 percent complete\n",
"01:36:25.32 71.24 percent complete\n",
"01:36:45.05 71.47 percent complete\n",
"01:37:04.41 71.71 percent complete\n",
"01:37:23.57 71.95 percent complete\n",
"01:37:43.14 72.19 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '\\']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"01:38:03.03 72.43 percent complete\n",
"01:38:22.67 72.67 percent complete\n",
"01:38:42.48 72.91 percent complete\n",
"01:39:02.12 73.15 percent complete\n",
"01:39:21.48 73.39 percent complete\n",
"01:39:41.34 73.63 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '●']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"01:40:01.28 73.86 percent complete\n",
"01:40:20.93 74.10 percent complete\n",
"01:40:40.14 74.34 percent complete\n",
"01:41:00.03 74.58 percent complete\n",
"01:41:20.40 74.82 percent complete\n",
"01:41:39.97 75.06 percent complete\n",
"01:41:59.30 75.30 percent complete\n",
"01:42:18.86 75.54 percent complete\n",
"01:42:38.21 75.78 percent complete\n",
"01:42:56.99 76.02 percent complete\n",
"01:43:15.90 76.26 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '․ ․ ․ ․ ․']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"01:43:35.48 76.49 percent complete\n",
"01:43:55.55 76.73 percent complete\n",
"01:44:14.82 76.97 percent complete\n",
"01:44:34.10 77.21 percent complete\n",
"01:44:53.94 77.45 percent complete\n",
"01:45:13.17 77.69 percent complete\n",
"01:45:32.40 77.93 percent complete\n",
"01:45:52.10 78.17 percent complete\n",
"01:46:12.18 78.41 percent complete\n",
"01:46:32.08 78.65 percent complete\n",
"01:46:51.92 78.88 percent complete\n",
"01:47:10.54 79.12 percent complete\n",
"01:47:30.26 79.36 percent complete\n",
"01:47:50.22 79.60 percent complete\n",
"01:48:09.37 79.84 percent complete\n",
"01:48:28.54 80.08 percent complete\n",
"01:48:47.98 80.32 percent complete\n",
"01:49:07.93 80.56 percent complete\n",
"01:49:27.37 80.80 percent complete\n",
"01:49:46.70 81.04 percent complete\n",
"01:50:05.55 81.28 percent complete\n",
"01:50:25.02 81.51 percent complete\n",
"01:50:43.80 81.75 percent complete\n",
"01:51:03.04 81.99 percent complete\n",
"01:51:22.42 82.23 percent complete\n",
"01:51:41.95 82.47 percent complete\n",
"01:52:01.26 82.71 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '□ ․ ․ ․ ․ ․']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"01:52:21.23 82.95 percent complete\n",
"01:52:40.37 83.19 percent complete\n",
"01:52:59.68 83.43 percent complete\n",
"01:53:19.09 83.67 percent complete\n",
"01:53:38.76 83.90 percent complete\n",
"01:53:58.42 84.14 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '— ― ― ― ― ― ― ―']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"01:54:17.73 84.38 percent complete\n",
"01:54:37.15 84.62 percent complete\n",
"01:54:56.52 84.86 percent complete\n",
"01:55:15.57 85.10 percent complete\n",
"01:55:35.53 85.34 percent complete\n",
"01:55:54.96 85.58 percent complete\n",
"01:56:14.84 85.82 percent complete\n",
"01:56:34.90 86.06 percent complete\n",
"01:56:55.15 86.30 percent complete\n",
"01:57:14.53 86.53 percent complete\n",
"01:57:33.78 86.77 percent complete\n",
"01:57:53.07 87.01 percent complete\n",
"01:58:12.39 87.25 percent complete\n",
"01:58:31.64 87.49 percent complete\n",
"01:58:50.68 87.73 percent complete\n",
"01:59:09.88 87.97 percent complete\n",
"01:59:29.71 88.21 percent complete\n",
"01:59:48.88 88.45 percent complete\n",
"02:00:08.40 88.69 percent complete\n",
"02:00:27.13 88.92 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '⇧']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"02:00:46.08 89.16 percent complete\n",
"02:01:05.66 89.40 percent complete\n",
"02:01:25.05 89.64 percent complete\n",
"02:01:44.92 89.88 percent complete\n",
"02:02:04.86 90.12 percent complete\n",
"02:02:24.68 90.36 percent complete\n",
"02:02:43.69 90.60 percent complete\n",
"02:03:03.36 90.84 percent complete\n",
"02:03:22.94 91.08 percent complete\n",
"02:03:42.05 91.32 percent complete\n",
"02:04:01.85 91.55 percent complete\n",
"02:04:20.88 91.79 percent complete\n",
"02:04:40.39 92.03 percent complete\n",
"02:04:59.71 92.27 percent complete\n",
"02:05:19.84 92.51 percent complete\n",
"02:05:39.14 92.75 percent complete\n",
"02:05:59.21 92.99 percent complete\n",
"02:06:18.53 93.23 percent complete\n",
"02:06:38.62 93.47 percent complete\n",
"02:06:59.31 93.71 percent complete\n",
"02:07:19.17 93.94 percent complete\n",
"02:07:38.72 94.18 percent complete\n",
"02:07:58.08 94.42 percent complete\n",
"02:08:17.85 94.66 percent complete\n",
"02:08:37.15 94.90 percent complete\n",
"02:08:57.10 95.14 percent complete\n",
"02:09:16.13 95.38 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '․ ․ ․ ․ ․ ․ ․ ․ ․ ․']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"02:09:36.09 95.62 percent complete\n",
"02:09:55.25 95.86 percent complete\n",
"02:10:14.43 96.10 percent complete\n",
"02:10:34.19 96.34 percent complete\n",
"02:10:53.38 96.57 percent complete\n",
"02:11:12.67 96.81 percent complete\n",
"02:11:32.19 97.05 percent complete\n",
"02:11:51.43 97.29 percent complete\n"
],
"name": "stdout"
},
{
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '']\n"
],
"name": "stderr"
},
{
"output_type": "stream",
"text": [
"02:12:11.22 97.53 percent complete\n",
"02:12:31.26 97.77 percent complete\n",
"02:12:50.80 98.01 percent complete\n",
"02:13:10.16 98.25 percent complete\n",
"02:13:29.41 98.49 percent complete\n",
"02:13:48.66 98.73 percent complete\n",
"02:14:08.34 98.96 percent complete\n",
"02:14:27.76 99.20 percent complete\n",
"02:14:48.28 99.44 percent complete\n",
"02:15:08.40 99.68 percent complete\n",
"02:15:28.13 99.92 percent complete\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "hxxBOCA-xXhy",
"outputId": "d764afe7-2675-4fc3-80f0-bad7dcad720a",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 865
}
},
"source": [
"#TODO: Skip for retrain\n",
"# This section does the split between train/dev for the parallel corpora then saves them as separate files\n",
"# We use 1000 dev test and the given test set.\n",
"import csv\n",
"\n",
"# Do the split between dev/train and create parallel corpora\n",
"num_dev_patterns = 1000\n",
"\n",
"# Optional: lower case the corpora - this will make it easier to generalize, but without proper casing.\n",
"if lc: # Julia: making lowercasing optional\n",
" df_pp[\"source_sentence\"] = df_pp[\"source_sentence\"].str.lower()\n",
" df_pp[\"target_sentence\"] = df_pp[\"target_sentence\"].str.lower()\n",
"\n",
"# Julia: test sets are already generated\n",
"dev = df_pp.tail(num_dev_patterns) # Herman: Error in original\n",
"stripped = df_pp.drop(df_pp.tail(num_dev_patterns).index)\n",
"\n",
"with open(\"train.\"+source_language, \"w\") as src_file, open(\"train.\"+target_language, \"w\") as trg_file:\n",
" for index, row in stripped.iterrows():\n",
" src_file.write(row[\"source_sentence\"]+\"\\n\")\n",
" trg_file.write(row[\"target_sentence\"]+\"\\n\")\n",
" \n",
"with open(\"dev.\"+source_language, \"w\") as src_file, open(\"dev.\"+target_language, \"w\") as trg_file:\n",
" for index, row in dev.iterrows():\n",
" src_file.write(row[\"source_sentence\"]+\"\\n\")\n",
" trg_file.write(row[\"target_sentence\"]+\"\\n\")\n",
"\n",
"#stripped[[\"source_sentence\"]].to_csv(\"train.\"+source_language, header=False, index=False) # Herman: Added `header=False` everywhere\n",
"#stripped[[\"target_sentence\"]].to_csv(\"train.\"+target_language, header=False, index=False) # Julia: Problematic handling of quotation marks.\n",
"\n",
"#dev[[\"source_sentence\"]].to_csv(\"dev.\"+source_language, header=False, index=False)\n",
"#dev[[\"target_sentence\"]].to_csv(\"dev.\"+target_language, header=False, index=False)\n",
"\n",
"# Doublecheck the format below. There should be no extra quotation marks or weird characters.\n",
"! head train.*\n",
"! head dev.*"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"==> train.en <==\n",
"TRAIN YOUR CHILDREN : “ I teach my children to check the expiration date of any packaged food items , such as snacks , before they buy them . ” — Ruth , Nigeria\n",
"When she replied that she was , he explained that he and his mother were trying to assist his sister with a school report on Canadians .\n",
"Through the prophet Zephaniah , Jehovah answers : “ That day is a day of fury , a day of distress and of anguish , a day of storm and of desolation , a day of darkness and of gloominess , a day of clouds and of thick gloom . ”\n",
"We do not require that people simply do as we tell them , but we give them convincing reasons to obey Christ’s command .\n",
"Still , Jehovah can annihilate any rebel in the lake of fire , denying him any hope of a resurrection .\n",
"Lucaris was arrested , and on July 27 , 1638 , he was taken on board a small boat as if for banishment .\n",
"Yes , Jehovah remembered their faithful course .\n",
"□ To appear tough\n",
"During the ensuing confrontation , we Witnesses had to make our position clear to the agitated rebels and also explain our stand to the military guards .\n",
"( See opening image . ) ( c ) Why should this Bible account about Samuel be of special interest to elders today ?\n",
"\n",
"==> train.yo <==\n",
"KỌ́ ÀWỌN ỌMỌ RẸ : “ Mo kọ́ àwọn ọmọ mi pé kí wọ́n tó ra oúnjẹ bí ìpápánu , tó wà nínú agolo , ike , bébà , tàbí ọ̀rá , kí wọ́n máa yẹ ara oúnjẹ náà wò kí wọ́n lè mọ déètì tó máa bà jẹ́ . ” — Ruth , Nàìjíríà\n",
"Nígbà tó sọ fún ọ̀dọ́kùnrin náà pé Kánádà lòun ti wá , ọ̀dọ́kùnrin náà sọ fún un pé òun àti màmá òun fẹ́ ran àbúrò òun obìnrin kan lọ́wọ́ láti kó ọ̀rọ̀ kan jọ nípa àwọn ará Kánádà , èyí tó fẹ́ mu lọ sílé ìwé .\n",
"Jèhófà gbẹnu wòlíì Sefanáyà sọ ìdí rẹ̀ fún wa , ó ní : “ Ọjọ́ yẹn jẹ́ ọjọ́ ìbínú kíkan , ọjọ́ wàhálà àti làásìgbò , ọjọ́ ìjì àti ìsọdahoro , ọjọ́ òkùnkùn àti ìṣúdùdù , ọjọ́ àwọsánmà àti ìṣúdùdù tí ó nípọn . ”\n",
"A ò fẹ́ káwọn èèyàn wulẹ̀ ṣe ohun tá a sọ fún wọn nìkan , àmọ́ à tún ń fún wọn ní ẹ̀rí tó dájú nípa ìdí tó fi yẹ kí wọ́n ṣègbọràn sí àṣẹ Kristi .\n",
"Síbẹ̀ , Jèhófà lè pa ọlọ̀tẹ̀ èyíkéyìí run nípa sísọ ọ sínú adágún iná , tó túmọ̀ sí pé onítọ̀hún máa kú láìsí ìrètí kankan láti tún jíǹde .\n",
"Ní wọ́n bá fi ọlọ́pàá mú Lucaris , nígbà tó sì di July 27 , 1638 , wọ́n fi ọkọ̀ ojú omi wà á lọ bí ẹni pé wọ́n fẹ́ gbé e lọ sí ilẹ̀ mìíràn .\n",
"Bẹ́ẹ̀ ni o , Jèhófà kò gbàgbé ìṣòtítọ́ wọn .\n",
"□ Kí wọ́n má bàa fojú ọ̀dẹ̀ wò mí\n",
"Lákòókò tí àríyànjiyàn náà ń lọ lọ́wọ́ , àwa Ẹlẹ́rìí jẹ́ káwọn ọlọ̀tẹ̀ tínú ń bí yìí mọ̀ pé a ò lọ́wọ́ sí nǹkan tí wọ́n ń ṣe , a sì tún ṣàlàyé irú ẹni tá a jẹ́ fáwọn ológun tó ń ṣọ́ ọgbà ẹ̀wọ̀n náà .\n",
"( Wo àwòrán tó wà níbẹ̀rẹ̀ àpilẹ̀kọ yìí . ) ( d ) Kí nìdí tó fi yẹ kí àwọn alàgbà lóde òní fún àkọsílẹ̀ Bíbélì yìí nípa Sámúẹ́lì láfiyèsí àrà ọ̀tọ̀ ?\n",
"==> dev.en <==\n",
"He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"Now I had to find a legitimate line of work .\n",
"Do I value material things more than my relationship with Jehovah and with people ?\n",
"He has far more experience and stamina than you do , but he patiently walks near you .\n",
"According to Harkavy’s Students ’ Hebrew and Chaldee Dictionary , ʽadh means “ duration , everlastingness , eternity , for ever . ”\n",
"Why is rendering proper honor to elders a concern ?\n",
"Jeremiah would rather be alone than be corrupted by bad companions .\n",
"In years gone by , we believed that Jehovah became displeased with his people because they did not have a zealous share in the preaching work during World War I .\n",
"Rather , they need to use a translation of the Bible in their own language .\n",
"On a more personal level , showing honor to those to whom it is due keeps us from becoming self - centered .\n",
"\n",
"==> dev.yo <==\n",
"Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"Gẹ́gẹ́ bí Harkavy’s Students ’ Hebrew and Chaldee Dictionary ṣe sọ , ʽadh túmọ̀ sí “ àkókò gígùn , àìnípẹ̀kun , títí gbére , títí láé . ”\n",
"Kí nìdí tí kò fi yẹ ká máa gbé àwọn alàgbà gẹ̀gẹ̀ ju bó ṣe yẹ lọ ?\n",
"Jeremáyà gbà kóun dá wà ju pé káwọn ọ̀rẹ́ burúkú wá kéèràn ran òun .\n",
"Láwọn ọdún mélòó kan sẹ́yìn , a gbà pé inú Jèhófà ò dùn sáwọn èèyàn rẹ̀ torí pé wọn ò fìtara wàásù lásìkò Ogun Àgbáyé Kìíní .\n",
"Àfi kí wọ́n ka Bíbélì tí wọ́n tú sí èdè wọn .\n",
"Tó bá ti mọ́ wa lára láti máa bọlá fáwọn míì , a ò ní máa ro tara wa nìkan .\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "epeCydmCyS8X"
},
"source": [
"\n",
"\n",
"---\n",
"\n",
"\n",
"## Installation of JoeyNMT\n",
"\n",
"JoeyNMT is a simple, minimalist NMT package which is useful for learning and teaching. Check out the documentation for JoeyNMT [here](https://joeynmt.readthedocs.io) "
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "iBRMm4kMxZ8L",
"outputId": "6cd58945-4935-4bfb-b392-c15b49e937ad",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
}
},
"source": [
"# Install JoeyNMT\n",
"! git clone https://github.com/joeynmt/joeynmt.git\n",
"! cd joeynmt; pip3 install ."
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"Cloning into 'joeynmt'...\n",
"remote: Enumerating objects: 3, done.\u001b[K\n",
"remote: Counting objects: 100% (3/3), done.\u001b[K\n",
"remote: Compressing objects: 100% (3/3), done.\u001b[K\n",
"remote: Total 2380 (delta 0), reused 0 (delta 0), pack-reused 2377\u001b[K\n",
"Receiving objects: 100% (2380/2380), 2.60 MiB | 4.24 MiB/s, done.\n",
"Resolving deltas: 100% (1670/1670), done.\n",
"Processing /content/joeynmt\n",
"Requirement already satisfied: future in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (0.16.0)\n",
"Requirement already satisfied: pillow in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (7.0.0)\n",
"Requirement already satisfied: numpy<2.0,>=1.14.5 in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (1.18.2)\n",
"Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (46.1.3)\n",
"Requirement already satisfied: torch>=1.1 in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (1.4.0)\n",
"Requirement already satisfied: tensorflow>=1.14 in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (2.2.0rc2)\n",
"Requirement already satisfied: torchtext in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (0.3.1)\n",
"Collecting sacrebleu>=1.3.6\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/f5/58/5c6cc352ea6271125325950715cf8b59b77abe5e93cf29f6e60b491a31d9/sacrebleu-1.4.6-py3-none-any.whl (59kB)\n",
"\u001b[K |████████████████████████████████| 61kB 4.3MB/s \n",
"\u001b[?25hCollecting subword-nmt\n",
" Downloading https://files.pythonhosted.org/packages/74/60/6600a7bc09e7ab38bc53a48a20d8cae49b837f93f5842a41fe513a694912/subword_nmt-0.3.7-py2.py3-none-any.whl\n",
"Requirement already satisfied: matplotlib in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (3.2.1)\n",
"Requirement already satisfied: seaborn in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (0.10.0)\n",
"Collecting pyyaml>=5.1\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/64/c2/b80047c7ac2478f9501676c988a5411ed5572f35d1beff9cae07d321512c/PyYAML-5.3.1.tar.gz (269kB)\n",
"\u001b[K |████████████████████████████████| 276kB 24.4MB/s \n",
"\u001b[?25hCollecting pylint\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/e9/59/43fc36c5ee316bb9aeb7cf5329cdbdca89e5749c34d5602753827c0aa2dc/pylint-2.4.4-py3-none-any.whl (302kB)\n",
"\u001b[K |████████████████████████████████| 307kB 55.1MB/s \n",
"\u001b[?25hRequirement already satisfied: six==1.12 in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (1.12.0)\n",
"Collecting wrapt==1.11.1\n",
" Downloading https://files.pythonhosted.org/packages/67/b2/0f71ca90b0ade7fad27e3d20327c996c6252a2ffe88f50a95bba7434eda9/wrapt-1.11.1.tar.gz\n",
"Requirement already satisfied: gast==0.3.3 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (0.3.3)\n",
"Requirement already satisfied: tensorflow-estimator<2.3.0,>=2.2.0rc0 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (2.2.0rc0)\n",
"Requirement already satisfied: keras-preprocessing>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.1.0)\n",
"Requirement already satisfied: tensorboard<2.3.0,>=2.2.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (2.2.0)\n",
"Requirement already satisfied: scipy==1.4.1; python_version >= \"3\" in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.4.1)\n",
"Requirement already satisfied: protobuf>=3.8.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (3.10.0)\n",
"Requirement already satisfied: opt-einsum>=2.3.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (3.2.0)\n",
"Requirement already satisfied: absl-py>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (0.9.0)\n",
"Requirement already satisfied: wheel>=0.26; python_version >= \"3\" in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (0.34.2)\n",
"Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.1.0)\n",
"Requirement already satisfied: astunparse==1.6.3 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.6.3)\n",
"Requirement already satisfied: h5py<2.11.0,>=2.10.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (2.10.0)\n",
"Requirement already satisfied: google-pasta>=0.1.8 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (0.2.0)\n",
"Requirement already satisfied: grpcio>=1.8.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.28.1)\n",
"Requirement already satisfied: tqdm in /usr/local/lib/python3.6/dist-packages (from torchtext->joeynmt==0.0.1) (4.38.0)\n",
"Requirement already satisfied: requests in /usr/local/lib/python3.6/dist-packages (from torchtext->joeynmt==0.0.1) (2.21.0)\n",
"Collecting mecab-python3\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/18/49/b55a839a77189042960bf96490640c44816073f917d489acbc5d79fa5cc3/mecab_python3-0.996.5-cp36-cp36m-manylinux2010_x86_64.whl (17.1MB)\n",
"\u001b[K |████████████████████████████████| 17.1MB 201kB/s \n",
"\u001b[?25hCollecting portalocker\n",
" Downloading https://files.pythonhosted.org/packages/64/03/9abfb3374d67838daf24f1a388528714bec1debb1d13749f0abd7fb07cfb/portalocker-1.6.0-py2.py3-none-any.whl\n",
"Requirement already satisfied: typing in /usr/local/lib/python3.6/dist-packages (from sacrebleu>=1.3.6->joeynmt==0.0.1) (3.6.6)\n",
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib->joeynmt==0.0.1) (0.10.0)\n",
"Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->joeynmt==0.0.1) (2.8.1)\n",
"Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->joeynmt==0.0.1) (1.2.0)\n",
"Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->joeynmt==0.0.1) (2.4.7)\n",
"Requirement already satisfied: pandas>=0.22.0 in /usr/local/lib/python3.6/dist-packages (from seaborn->joeynmt==0.0.1) (1.0.3)\n",
"Collecting isort<5,>=4.2.5\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/e5/b0/c121fd1fa3419ea9bfd55c7f9c4fedfec5143208d8c7ad3ce3db6c623c21/isort-4.3.21-py2.py3-none-any.whl (42kB)\n",
"\u001b[K |████████████████████████████████| 51kB 7.6MB/s \n",
"\u001b[?25hCollecting mccabe<0.7,>=0.6\n",
" Downloading https://files.pythonhosted.org/packages/87/89/479dc97e18549e21354893e4ee4ef36db1d237534982482c3681ee6e7b57/mccabe-0.6.1-py2.py3-none-any.whl\n",
"Collecting astroid<2.4,>=2.3.0\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/ad/ae/86734823047962e7b8c8529186a1ac4a7ca19aaf1aa0c7713c022ef593fd/astroid-2.3.3-py3-none-any.whl (205kB)\n",
"\u001b[K |████████████████████████████████| 215kB 54.1MB/s \n",
"\u001b[?25hRequirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (3.2.1)\n",
"Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (1.0.1)\n",
"Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (1.6.0.post3)\n",
"Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (0.4.1)\n",
"Requirement already satisfied: google-auth<2,>=1.6.3 in /usr/local/lib/python3.6/dist-packages (from tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (1.7.2)\n",
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests->torchtext->joeynmt==0.0.1) (2020.4.5.1)\n",
"Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests->torchtext->joeynmt==0.0.1) (1.24.3)\n",
"Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests->torchtext->joeynmt==0.0.1) (3.0.4)\n",
"Requirement already satisfied: idna<2.9,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests->torchtext->joeynmt==0.0.1) (2.8)\n",
"Requirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas>=0.22.0->seaborn->joeynmt==0.0.1) (2018.9)\n",
"Collecting lazy-object-proxy==1.4.*\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/0b/dd/b1e3407e9e6913cf178e506cd0dee818e58694d9a5cd1984e3f6a8b9a10f/lazy_object_proxy-1.4.3-cp36-cp36m-manylinux1_x86_64.whl (55kB)\n",
"\u001b[K |████████████████████████████████| 61kB 8.1MB/s \n",
"\u001b[?25hCollecting typed-ast<1.5,>=1.4.0; implementation_name == \"cpython\" and python_version < \"3.8\"\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/90/ed/5459080d95eb87a02fe860d447197be63b6e2b5e9ff73c2b0a85622994f4/typed_ast-1.4.1-cp36-cp36m-manylinux1_x86_64.whl (737kB)\n",
"\u001b[K |████████████████████████████████| 747kB 54.4MB/s \n",
"\u001b[?25hRequirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.6/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (1.3.0)\n",
"Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (0.2.8)\n",
"Requirement already satisfied: cachetools<3.2,>=2.0.0 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (3.1.1)\n",
"Requirement already satisfied: rsa<4.1,>=3.1.4 in /usr/local/lib/python3.6/dist-packages (from google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (4.0)\n",
"Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.6/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (3.1.0)\n",
"Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.6/dist-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard<2.3.0,>=2.2.0->tensorflow>=1.14->joeynmt==0.0.1) (0.4.8)\n",
"Building wheels for collected packages: joeynmt, pyyaml, wrapt\n",
" Building wheel for joeynmt (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for joeynmt: filename=joeynmt-0.0.1-cp36-none-any.whl size=73768 sha256=09642adb3c413596b594cde12da531b842bf2007c75f258d0eed07fa3b152a3d\n",
" Stored in directory: /tmp/pip-ephem-wheel-cache-5ss0uo8b/wheels/db/01/db/751cc9f3e7f6faec127c43644ba250a3ea7ad200594aeda70a\n",
" Building wheel for pyyaml (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for pyyaml: filename=PyYAML-5.3.1-cp36-cp36m-linux_x86_64.whl size=44621 sha256=326c10062d3be997e2721f4a455fa10fb95cb616ebf9d6957aac343e4fc9e7b7\n",
" Stored in directory: /root/.cache/pip/wheels/a7/c1/ea/cf5bd31012e735dc1dfea3131a2d5eae7978b251083d6247bd\n",
" Building wheel for wrapt (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for wrapt: filename=wrapt-1.11.1-cp36-cp36m-linux_x86_64.whl size=67435 sha256=ce4852f0ad71dc23caee5cfbf233c9da664c3e4716f81b23348701d716acff35\n",
" Stored in directory: /root/.cache/pip/wheels/89/67/41/63cbf0f6ac0a6156588b9587be4db5565f8c6d8ccef98202fc\n",
"Successfully built joeynmt pyyaml wrapt\n",
"Installing collected packages: mecab-python3, portalocker, sacrebleu, subword-nmt, pyyaml, isort, mccabe, wrapt, lazy-object-proxy, typed-ast, astroid, pylint, joeynmt\n",
" Found existing installation: PyYAML 3.13\n",
" Uninstalling PyYAML-3.13:\n",
" Successfully uninstalled PyYAML-3.13\n",
" Found existing installation: wrapt 1.12.1\n",
" Uninstalling wrapt-1.12.1:\n",
" Successfully uninstalled wrapt-1.12.1\n",
"Successfully installed astroid-2.3.3 isort-4.3.21 joeynmt-0.0.1 lazy-object-proxy-1.4.3 mccabe-0.6.1 mecab-python3-0.996.5 portalocker-1.6.0 pylint-2.4.4 pyyaml-5.3.1 sacrebleu-1.4.6 subword-nmt-0.3.7 typed-ast-1.4.1 wrapt-1.11.1\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "AaE77Tcppex9"
},
"source": [
"# Preprocessing the Data into Subword BPE Tokens\n",
"\n",
"- One of the most powerful improvements for agglutinative languages (a feature of most Bantu languages) is using BPE tokenization [ (Sennrich, 2015) ](https://arxiv.org/abs/1508.07909).\n",
"\n",
"- It was also shown that by optimizing the umber of BPE codes we significantly improve results for low-resourced languages [(Sennrich, 2019)](https://www.aclweb.org/anthology/P19-1021) [(Martinus, 2019)](https://arxiv.org/abs/1906.05685)\n",
"\n",
"- Below we have the scripts for doing BPE tokenization of our data. We use 4000 tokens as recommended by [(Sennrich, 2019)](https://www.aclweb.org/anthology/P19-1021). You do not need to change anything. Simply running the below will be suitable. "
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "H-TyjtmXB1mL",
"outputId": "6a7b3ce9-239a-4a21-cc63-37107d521733",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 431
}
},
"source": [
"#TODO: Skip for retrain\n",
"# One of the huge boosts in NMT performance was to use a different method of tokenizing. \n",
"# Usually, NMT would tokenize by words. However, using a method called BPE gave amazing boosts to performance\n",
"\n",
"# Do subword NMT\n",
"from os import path\n",
"os.environ[\"src\"] = source_language # Sets them in bash as well, since we often use bash scripts\n",
"os.environ[\"tgt\"] = target_language\n",
"\n",
"# Learn BPEs on the training data.\n",
"os.environ[\"data_path\"] = path.join(\"joeynmt\", \"data\", source_language + target_language) # Herman! \n",
"! subword-nmt learn-joint-bpe-and-vocab --input train.$src train.$tgt -s 4000 -o bpe.codes.4000 --write-vocabulary vocab.$src vocab.$tgt\n",
"\n",
"# Apply BPE splits to the development and test data.\n",
"! subword-nmt apply-bpe -c bpe.codes.4000 --vocabulary vocab.$src < train.$src > train.bpe.$src\n",
"! subword-nmt apply-bpe -c bpe.codes.4000 --vocabulary vocab.$tgt < train.$tgt > train.bpe.$tgt\n",
"\n",
"! subword-nmt apply-bpe -c bpe.codes.4000 --vocabulary vocab.$src < dev.$src > dev.bpe.$src\n",
"! subword-nmt apply-bpe -c bpe.codes.4000 --vocabulary vocab.$tgt < dev.$tgt > dev.bpe.$tgt\n",
"! subword-nmt apply-bpe -c bpe.codes.4000 --vocabulary vocab.$src < test.$src > test.bpe.$src\n",
"! subword-nmt apply-bpe -c bpe.codes.4000 --vocabulary vocab.$tgt < test.$tgt > test.bpe.$tgt\n",
"\n",
"# Create directory, move everyone we care about to the correct location\n",
"! mkdir -p $data_path\n",
"! cp train.* $data_path\n",
"! cp test.* $data_path\n",
"! cp dev.* $data_path\n",
"! cp bpe.codes.4000 $data_path\n",
"! ls $data_path\n",
"\n",
"# Also move everything we care about to a mounted location in google drive (relevant if running in colab) at gdrive_path\n",
"! cp train.* \"$gdrive_path\"\n",
"! cp test.* \"$gdrive_path\"\n",
"! cp dev.* \"$gdrive_path\"\n",
"! cp bpe.codes.4000 \"$gdrive_path\"\n",
"! ls \"$gdrive_path\"\n",
"\n",
"# Create that vocab using build_vocab\n",
"! sudo chmod 777 joeynmt/scripts/build_vocab.py\n",
"! joeynmt/scripts/build_vocab.py joeynmt/data/$src$tgt/train.bpe.$src joeynmt/data/$src$tgt/train.bpe.$tgt --output_path \"$gdrive_path/vocab.txt\"\n",
"\n",
"# Some output\n",
"! echo \"BPE Xhosa Sentences\"\n",
"! tail -n 5 test.bpe.$tgt\n",
"! echo \"Combined BPE Vocab\"\n",
"! tail -n 10 \"$gdrive_path/vocab.txt\" # Herman"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"bpe.codes.4000\tdev.en\t test.bpe.yo test.yo\t train.en\n",
"dev.bpe.en\tdev.yo\t test.en\t train.bpe.en train.yo\n",
"dev.bpe.yo\ttest.bpe.en test.en-any.en train.bpe.yo\n",
"bpe.codes.4000\tdev.en\ttest.bpe.en test.en-any.en train.bpe.yo vocab.txt\n",
"dev.bpe.en\tdev.yo\ttest.bpe.yo test.yo\t train.en\n",
"dev.bpe.yo\tmodels\ttest.en train.bpe.en train.yo\n",
"BPE Xhosa Sentences\n",
"A@@ p@@ at@@ a ńlá ti ìgbàgbọ́ ( Wo ìpín@@ rọ̀ 12 - 14 )\n",
"À@@ ṣí@@ borí ìgb@@ àlà ( Wo ìpín@@ rọ̀ 15 - 18 )\n",
"Mo ti rí i pé àwọn èèyàn máa ń fẹ́ gb@@ ọ́@@ rọ̀ wa tí wọ́n bá rí i pé a lóye Bíbélì dáadáa , a sì fẹ́ ran àwọn lọ́wọ́ . ”\n",
"I@@ dà ẹ̀mí ( Wo ìpín@@ rọ̀ 19 - 20 )\n",
"Ó dájú pé lọ́@@ lá ìt@@ ì@@ lẹ́yìn Jèhófà , a máa dúró gb@@ ọ@@ in - in , Èṣù ò sì ní rí wa gbé ṣe .\n",
"Combined BPE Vocab\n",
"œ@@\n",
"Ísír@@\n",
"Isra@@\n",
"̃\n",
"×\n",
"ô\n",
"ʺ\n",
"bítì\n",
"Pété@@\n",
"Jóò@@\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "Ixmzi60WsUZ8"
},
"source": [
"# Creating the JoeyNMT Config\n",
"\n",
"JoeyNMT requires a yaml config. We provide a template below. We've also set a number of defaults with it, that you may play with!\n",
"\n",
"- We used Transformer architecture \n",
"- We set our dropout to reasonably high: 0.3 (recommended in [(Sennrich, 2019)](https://www.aclweb.org/anthology/P19-1021))\n",
"\n",
"Things worth playing with:\n",
"- The batch size (also recommended to change for low-resourced languages)\n",
"- The number of epochs (we've set it at 30 just so it runs in about an hour, for testing purposes)\n",
"- The decoder options (beam_size, alpha)\n",
"- Evaluation metrics (BLEU versus Crhf4)"
]
},
{
"cell_type": "code",
"metadata": {
"id": "Wc47fvWqyxbd",
"colab_type": "code",
"colab": {}
},
"source": [
"def get_last_checkpoint(directory):\n",
" last_checkpoint = ''\n",
" try:\n",
" for filename in os.listdir(directory):\n",
" if 'best' in filename and filename.endswith(\".ckpt\"):\n",
" return filename\n",
" if not 'best' in filename and filename.endswith(\".ckpt\"):\n",
" if not last_checkpoint or int(filename.split('.')[0]) > int(last_checkpoint.split('.')[0]):\n",
" last_checkpoint = filename\n",
" except FileNotFoundError as e:\n",
" print('Error Occur ', e)\n",
" return last_checkpoint"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "x_ffEoFdy1Qo",
"colab_type": "code",
"outputId": "03eca8de-dd2b-4a95-d43e-4b6456f62294",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 35
}
},
"source": [
"# Copy the created models from the temporary storage to main storage on google drive for persistant storage \n",
"# the content of te folder will be overwrite when you start trainin\n",
"# !cp -r \"/content/drive/My Drive/masakhane/model-temp/\"* \"$gdrive_path/models/${src}${tgt}_transformer/\"\n",
"last_checkpoint = get_last_checkpoint(models_path)\n",
"print('Last checkpoint :',last_checkpoint)"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"Last checkpoint : best.ckpt\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "PIs1lY2hxMsl",
"colab": {}
},
"source": [
"# This creates the config file for our JoeyNMT system. It might seem overwhelming so we've provided a couple of useful parameters you'll need to update\n",
"# (You can of course play with all the parameters if you'd like!)\n",
"\n",
"name = '%s%s' % (source_language, target_language)\n",
"gdrive_path = os.environ[\"gdrive_path\"]\n",
"\n",
"# Create the config\n",
"config = \"\"\"\n",
"name: \"{name}_transformer\"\n",
"\n",
"data:\n",
" src: \"{source_language}\"\n",
" trg: \"{target_language}\"\n",
" train: \"{gdrive_path}/train.bpe\"\n",
" dev: \"{gdrive_path}/dev.bpe\"\n",
" test: \"{gdrive_path}/test.bpe\"\n",
" level: \"bpe\"\n",
" lowercase: False\n",
" max_sent_length: 100\n",
" src_vocab: \"{gdrive_path}/vocab.txt\"\n",
" trg_vocab: \"{gdrive_path}/vocab.txt\"\n",
"\n",
"testing:\n",
" beam_size: 5\n",
" alpha: 1.0\n",
"\n",
"training:\n",
" load_model: \"{gdrive_path}/models/{name}_transformer/{last_checkpoint}\" # uncommented to load a pre-trained model from last checkpoint\n",
" random_seed: 42\n",
" optimizer: \"adam\"\n",
" normalization: \"tokens\"\n",
" adam_betas: [0.9, 0.999] \n",
" scheduling: \"plateau\" # TODO: try switching from plateau to Noam scheduling\n",
" patience: 5 # For plateau: decrease learning rate by decrease_factor if validation score has not improved for this many validation rounds.\n",
" learning_rate_factor: 0.5 # factor for Noam scheduler (used with Transformer)\n",
" learning_rate_warmup: 1000 # warmup steps for Noam scheduler (used with Transformer)\n",
" decrease_factor: 0.7\n",
" loss: \"crossentropy\"\n",
" learning_rate: 0.0003\n",
" learning_rate_min: 0.00000001\n",
" weight_decay: 0.0\n",
" label_smoothing: 0.1\n",
" batch_size: 4096\n",
" batch_type: \"token\"\n",
" eval_batch_size: 3600\n",
" eval_batch_type: \"token\"\n",
" batch_multiplier: 1\n",
" early_stopping_metric: \"ppl\"\n",
" epochs: 2 # TODO: Decrease for when playing around and checking of working. Around 30 is sufficient to check if its working at all\n",
" validation_freq: 1000 # TODO: Set to at least once per epoch.\n",
" logging_freq: 100\n",
" eval_metric: \"bleu\"\n",
" model_dir: \"{model_temp_dir}\"\n",
" overwrite: True # TODO: Set to True if you want to overwrite possibly existing models. \n",
" shuffle: True\n",
" use_cuda: True\n",
" max_output_length: 100\n",
" print_valid_sents: [0, 1, 2, 3]\n",
" keep_last_ckpts: 3\n",
"\n",
"model:\n",
" initializer: \"xavier\"\n",
" bias_initializer: \"zeros\"\n",
" init_gain: 1.0\n",
" embed_initializer: \"xavier\"\n",
" embed_init_gain: 1.0\n",
" tied_embeddings: True\n",
" tied_softmax: True\n",
" encoder:\n",
" type: \"transformer\"\n",
" num_layers: 6\n",
" num_heads: 4 # TODO: Increase to 8 for larger data.\n",
" embeddings:\n",
" embedding_dim: 256 # TODO: Increase to 512 for larger data.\n",
" scale: True\n",
" dropout: 0.2\n",
" # typically ff_size = 4 x hidden_size\n",
" hidden_size: 256 # TODO: Increase to 512 for larger data.\n",
" ff_size: 1024 # TODO: Increase to 2048 for larger data.\n",
" dropout: 0.3\n",
" decoder:\n",
" type: \"transformer\"\n",
" num_layers: 6\n",
" num_heads: 4 # TODO: Increase to 8 for larger data.\n",
" embeddings:\n",
" embedding_dim: 256 # TODO: Increase to 512 for larger data.\n",
" scale: True\n",
" dropout: 0.2\n",
" # typically ff_size = 4 x hidden_size\n",
" hidden_size: 256 # TODO: Increase to 512 for larger data.\n",
" ff_size: 1024 # TODO: Increase to 2048 for larger data.\n",
" dropout: 0.3\n",
"\"\"\".format(name=name, gdrive_path=os.environ[\"gdrive_path\"], source_language=source_language, target_language=target_language, model_temp_dir=model_temp_dir, last_checkpoint=last_checkpoint)\n",
"with open(\"joeynmt/configs/transformer_{name}.yaml\".format(name=name),'w') as f:\n",
" f.write(config)"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"colab_type": "text",
"id": "pIifxE3Qzuvs"
},
"source": [
"# Train the Model\n",
"\n",
"This single line of joeynmt runs the training using the config we made above"
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "6ZBPFwT94WpI",
"outputId": "842c925f-2f1a-4b4e-a6d1-f8439360c81f",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
}
},
"source": [
"# Train the model\n",
"# You can press Ctrl-C to stop. And then run the next cell to save your checkpoints! \n",
"!cd joeynmt; python3 -m joeynmt train configs/transformer_$src$tgt.yaml"
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"2020-04-12 14:27:14,687 Hello! This is Joey-NMT.\n",
"2020-04-12 14:27:14.845045: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1\n",
"2020-04-12 14:27:16,195 Total params: 12188160\n",
"2020-04-12 14:27:16,197 Trainable parameters: ['decoder.layer_norm.bias', 'decoder.layer_norm.weight', 'decoder.layers.0.dec_layer_norm.bias', 'decoder.layers.0.dec_layer_norm.weight', 'decoder.layers.0.feed_forward.layer_norm.bias', 'decoder.layers.0.feed_forward.layer_norm.weight', 'decoder.layers.0.feed_forward.pwff_layer.0.bias', 'decoder.layers.0.feed_forward.pwff_layer.0.weight', 'decoder.layers.0.feed_forward.pwff_layer.3.bias', 'decoder.layers.0.feed_forward.pwff_layer.3.weight', 'decoder.layers.0.src_trg_att.k_layer.bias', 'decoder.layers.0.src_trg_att.k_layer.weight', 'decoder.layers.0.src_trg_att.output_layer.bias', 'decoder.layers.0.src_trg_att.output_layer.weight', 'decoder.layers.0.src_trg_att.q_layer.bias', 'decoder.layers.0.src_trg_att.q_layer.weight', 'decoder.layers.0.src_trg_att.v_layer.bias', 'decoder.layers.0.src_trg_att.v_layer.weight', 'decoder.layers.0.trg_trg_att.k_layer.bias', 'decoder.layers.0.trg_trg_att.k_layer.weight', 'decoder.layers.0.trg_trg_att.output_layer.bias', 'decoder.layers.0.trg_trg_att.output_layer.weight', 'decoder.layers.0.trg_trg_att.q_layer.bias', 'decoder.layers.0.trg_trg_att.q_layer.weight', 'decoder.layers.0.trg_trg_att.v_layer.bias', 'decoder.layers.0.trg_trg_att.v_layer.weight', 'decoder.layers.0.x_layer_norm.bias', 'decoder.layers.0.x_layer_norm.weight', 'decoder.layers.1.dec_layer_norm.bias', 'decoder.layers.1.dec_layer_norm.weight', 'decoder.layers.1.feed_forward.layer_norm.bias', 'decoder.layers.1.feed_forward.layer_norm.weight', 'decoder.layers.1.feed_forward.pwff_layer.0.bias', 'decoder.layers.1.feed_forward.pwff_layer.0.weight', 'decoder.layers.1.feed_forward.pwff_layer.3.bias', 'decoder.layers.1.feed_forward.pwff_layer.3.weight', 'decoder.layers.1.src_trg_att.k_layer.bias', 'decoder.layers.1.src_trg_att.k_layer.weight', 'decoder.layers.1.src_trg_att.output_layer.bias', 'decoder.layers.1.src_trg_att.output_layer.weight', 'decoder.layers.1.src_trg_att.q_layer.bias', 'decoder.layers.1.src_trg_att.q_layer.weight', 'decoder.layers.1.src_trg_att.v_layer.bias', 'decoder.layers.1.src_trg_att.v_layer.weight', 'decoder.layers.1.trg_trg_att.k_layer.bias', 'decoder.layers.1.trg_trg_att.k_layer.weight', 'decoder.layers.1.trg_trg_att.output_layer.bias', 'decoder.layers.1.trg_trg_att.output_layer.weight', 'decoder.layers.1.trg_trg_att.q_layer.bias', 'decoder.layers.1.trg_trg_att.q_layer.weight', 'decoder.layers.1.trg_trg_att.v_layer.bias', 'decoder.layers.1.trg_trg_att.v_layer.weight', 'decoder.layers.1.x_layer_norm.bias', 'decoder.layers.1.x_layer_norm.weight', 'decoder.layers.2.dec_layer_norm.bias', 'decoder.layers.2.dec_layer_norm.weight', 'decoder.layers.2.feed_forward.layer_norm.bias', 'decoder.layers.2.feed_forward.layer_norm.weight', 'decoder.layers.2.feed_forward.pwff_layer.0.bias', 'decoder.layers.2.feed_forward.pwff_layer.0.weight', 'decoder.layers.2.feed_forward.pwff_layer.3.bias', 'decoder.layers.2.feed_forward.pwff_layer.3.weight', 'decoder.layers.2.src_trg_att.k_layer.bias', 'decoder.layers.2.src_trg_att.k_layer.weight', 'decoder.layers.2.src_trg_att.output_layer.bias', 'decoder.layers.2.src_trg_att.output_layer.weight', 'decoder.layers.2.src_trg_att.q_layer.bias', 'decoder.layers.2.src_trg_att.q_layer.weight', 'decoder.layers.2.src_trg_att.v_layer.bias', 'decoder.layers.2.src_trg_att.v_layer.weight', 'decoder.layers.2.trg_trg_att.k_layer.bias', 'decoder.layers.2.trg_trg_att.k_layer.weight', 'decoder.layers.2.trg_trg_att.output_layer.bias', 'decoder.layers.2.trg_trg_att.output_layer.weight', 'decoder.layers.2.trg_trg_att.q_layer.bias', 'decoder.layers.2.trg_trg_att.q_layer.weight', 'decoder.layers.2.trg_trg_att.v_layer.bias', 'decoder.layers.2.trg_trg_att.v_layer.weight', 'decoder.layers.2.x_layer_norm.bias', 'decoder.layers.2.x_layer_norm.weight', 'decoder.layers.3.dec_layer_norm.bias', 'decoder.layers.3.dec_layer_norm.weight', 'decoder.layers.3.feed_forward.layer_norm.bias', 'decoder.layers.3.feed_forward.layer_norm.weight', 'decoder.layers.3.feed_forward.pwff_layer.0.bias', 'decoder.layers.3.feed_forward.pwff_layer.0.weight', 'decoder.layers.3.feed_forward.pwff_layer.3.bias', 'decoder.layers.3.feed_forward.pwff_layer.3.weight', 'decoder.layers.3.src_trg_att.k_layer.bias', 'decoder.layers.3.src_trg_att.k_layer.weight', 'decoder.layers.3.src_trg_att.output_layer.bias', 'decoder.layers.3.src_trg_att.output_layer.weight', 'decoder.layers.3.src_trg_att.q_layer.bias', 'decoder.layers.3.src_trg_att.q_layer.weight', 'decoder.layers.3.src_trg_att.v_layer.bias', 'decoder.layers.3.src_trg_att.v_layer.weight', 'decoder.layers.3.trg_trg_att.k_layer.bias', 'decoder.layers.3.trg_trg_att.k_layer.weight', 'decoder.layers.3.trg_trg_att.output_layer.bias', 'decoder.layers.3.trg_trg_att.output_layer.weight', 'decoder.layers.3.trg_trg_att.q_layer.bias', 'decoder.layers.3.trg_trg_att.q_layer.weight', 'decoder.layers.3.trg_trg_att.v_layer.bias', 'decoder.layers.3.trg_trg_att.v_layer.weight', 'decoder.layers.3.x_layer_norm.bias', 'decoder.layers.3.x_layer_norm.weight', 'decoder.layers.4.dec_layer_norm.bias', 'decoder.layers.4.dec_layer_norm.weight', 'decoder.layers.4.feed_forward.layer_norm.bias', 'decoder.layers.4.feed_forward.layer_norm.weight', 'decoder.layers.4.feed_forward.pwff_layer.0.bias', 'decoder.layers.4.feed_forward.pwff_layer.0.weight', 'decoder.layers.4.feed_forward.pwff_layer.3.bias', 'decoder.layers.4.feed_forward.pwff_layer.3.weight', 'decoder.layers.4.src_trg_att.k_layer.bias', 'decoder.layers.4.src_trg_att.k_layer.weight', 'decoder.layers.4.src_trg_att.output_layer.bias', 'decoder.layers.4.src_trg_att.output_layer.weight', 'decoder.layers.4.src_trg_att.q_layer.bias', 'decoder.layers.4.src_trg_att.q_layer.weight', 'decoder.layers.4.src_trg_att.v_layer.bias', 'decoder.layers.4.src_trg_att.v_layer.weight', 'decoder.layers.4.trg_trg_att.k_layer.bias', 'decoder.layers.4.trg_trg_att.k_layer.weight', 'decoder.layers.4.trg_trg_att.output_layer.bias', 'decoder.layers.4.trg_trg_att.output_layer.weight', 'decoder.layers.4.trg_trg_att.q_layer.bias', 'decoder.layers.4.trg_trg_att.q_layer.weight', 'decoder.layers.4.trg_trg_att.v_layer.bias', 'decoder.layers.4.trg_trg_att.v_layer.weight', 'decoder.layers.4.x_layer_norm.bias', 'decoder.layers.4.x_layer_norm.weight', 'decoder.layers.5.dec_layer_norm.bias', 'decoder.layers.5.dec_layer_norm.weight', 'decoder.layers.5.feed_forward.layer_norm.bias', 'decoder.layers.5.feed_forward.layer_norm.weight', 'decoder.layers.5.feed_forward.pwff_layer.0.bias', 'decoder.layers.5.feed_forward.pwff_layer.0.weight', 'decoder.layers.5.feed_forward.pwff_layer.3.bias', 'decoder.layers.5.feed_forward.pwff_layer.3.weight', 'decoder.layers.5.src_trg_att.k_layer.bias', 'decoder.layers.5.src_trg_att.k_layer.weight', 'decoder.layers.5.src_trg_att.output_layer.bias', 'decoder.layers.5.src_trg_att.output_layer.weight', 'decoder.layers.5.src_trg_att.q_layer.bias', 'decoder.layers.5.src_trg_att.q_layer.weight', 'decoder.layers.5.src_trg_att.v_layer.bias', 'decoder.layers.5.src_trg_att.v_layer.weight', 'decoder.layers.5.trg_trg_att.k_layer.bias', 'decoder.layers.5.trg_trg_att.k_layer.weight', 'decoder.layers.5.trg_trg_att.output_layer.bias', 'decoder.layers.5.trg_trg_att.output_layer.weight', 'decoder.layers.5.trg_trg_att.q_layer.bias', 'decoder.layers.5.trg_trg_att.q_layer.weight', 'decoder.layers.5.trg_trg_att.v_layer.bias', 'decoder.layers.5.trg_trg_att.v_layer.weight', 'decoder.layers.5.x_layer_norm.bias', 'decoder.layers.5.x_layer_norm.weight', 'encoder.layer_norm.bias', 'encoder.layer_norm.weight', 'encoder.layers.0.feed_forward.layer_norm.bias', 'encoder.layers.0.feed_forward.layer_norm.weight', 'encoder.layers.0.feed_forward.pwff_layer.0.bias', 'encoder.layers.0.feed_forward.pwff_layer.0.weight', 'encoder.layers.0.feed_forward.pwff_layer.3.bias', 'encoder.layers.0.feed_forward.pwff_layer.3.weight', 'encoder.layers.0.layer_norm.bias', 'encoder.layers.0.layer_norm.weight', 'encoder.layers.0.src_src_att.k_layer.bias', 'encoder.layers.0.src_src_att.k_layer.weight', 'encoder.layers.0.src_src_att.output_layer.bias', 'encoder.layers.0.src_src_att.output_layer.weight', 'encoder.layers.0.src_src_att.q_layer.bias', 'encoder.layers.0.src_src_att.q_layer.weight', 'encoder.layers.0.src_src_att.v_layer.bias', 'encoder.layers.0.src_src_att.v_layer.weight', 'encoder.layers.1.feed_forward.layer_norm.bias', 'encoder.layers.1.feed_forward.layer_norm.weight', 'encoder.layers.1.feed_forward.pwff_layer.0.bias', 'encoder.layers.1.feed_forward.pwff_layer.0.weight', 'encoder.layers.1.feed_forward.pwff_layer.3.bias', 'encoder.layers.1.feed_forward.pwff_layer.3.weight', 'encoder.layers.1.layer_norm.bias', 'encoder.layers.1.layer_norm.weight', 'encoder.layers.1.src_src_att.k_layer.bias', 'encoder.layers.1.src_src_att.k_layer.weight', 'encoder.layers.1.src_src_att.output_layer.bias', 'encoder.layers.1.src_src_att.output_layer.weight', 'encoder.layers.1.src_src_att.q_layer.bias', 'encoder.layers.1.src_src_att.q_layer.weight', 'encoder.layers.1.src_src_att.v_layer.bias', 'encoder.layers.1.src_src_att.v_layer.weight', 'encoder.layers.2.feed_forward.layer_norm.bias', 'encoder.layers.2.feed_forward.layer_norm.weight', 'encoder.layers.2.feed_forward.pwff_layer.0.bias', 'encoder.layers.2.feed_forward.pwff_layer.0.weight', 'encoder.layers.2.feed_forward.pwff_layer.3.bias', 'encoder.layers.2.feed_forward.pwff_layer.3.weight', 'encoder.layers.2.layer_norm.bias', 'encoder.layers.2.layer_norm.weight', 'encoder.layers.2.src_src_att.k_layer.bias', 'encoder.layers.2.src_src_att.k_layer.weight', 'encoder.layers.2.src_src_att.output_layer.bias', 'encoder.layers.2.src_src_att.output_layer.weight', 'encoder.layers.2.src_src_att.q_layer.bias', 'encoder.layers.2.src_src_att.q_layer.weight', 'encoder.layers.2.src_src_att.v_layer.bias', 'encoder.layers.2.src_src_att.v_layer.weight', 'encoder.layers.3.feed_forward.layer_norm.bias', 'encoder.layers.3.feed_forward.layer_norm.weight', 'encoder.layers.3.feed_forward.pwff_layer.0.bias', 'encoder.layers.3.feed_forward.pwff_layer.0.weight', 'encoder.layers.3.feed_forward.pwff_layer.3.bias', 'encoder.layers.3.feed_forward.pwff_layer.3.weight', 'encoder.layers.3.layer_norm.bias', 'encoder.layers.3.layer_norm.weight', 'encoder.layers.3.src_src_att.k_layer.bias', 'encoder.layers.3.src_src_att.k_layer.weight', 'encoder.layers.3.src_src_att.output_layer.bias', 'encoder.layers.3.src_src_att.output_layer.weight', 'encoder.layers.3.src_src_att.q_layer.bias', 'encoder.layers.3.src_src_att.q_layer.weight', 'encoder.layers.3.src_src_att.v_layer.bias', 'encoder.layers.3.src_src_att.v_layer.weight', 'encoder.layers.4.feed_forward.layer_norm.bias', 'encoder.layers.4.feed_forward.layer_norm.weight', 'encoder.layers.4.feed_forward.pwff_layer.0.bias', 'encoder.layers.4.feed_forward.pwff_layer.0.weight', 'encoder.layers.4.feed_forward.pwff_layer.3.bias', 'encoder.layers.4.feed_forward.pwff_layer.3.weight', 'encoder.layers.4.layer_norm.bias', 'encoder.layers.4.layer_norm.weight', 'encoder.layers.4.src_src_att.k_layer.bias', 'encoder.layers.4.src_src_att.k_layer.weight', 'encoder.layers.4.src_src_att.output_layer.bias', 'encoder.layers.4.src_src_att.output_layer.weight', 'encoder.layers.4.src_src_att.q_layer.bias', 'encoder.layers.4.src_src_att.q_layer.weight', 'encoder.layers.4.src_src_att.v_layer.bias', 'encoder.layers.4.src_src_att.v_layer.weight', 'encoder.layers.5.feed_forward.layer_norm.bias', 'encoder.layers.5.feed_forward.layer_norm.weight', 'encoder.layers.5.feed_forward.pwff_layer.0.bias', 'encoder.layers.5.feed_forward.pwff_layer.0.weight', 'encoder.layers.5.feed_forward.pwff_layer.3.bias', 'encoder.layers.5.feed_forward.pwff_layer.3.weight', 'encoder.layers.5.layer_norm.bias', 'encoder.layers.5.layer_norm.weight', 'encoder.layers.5.src_src_att.k_layer.bias', 'encoder.layers.5.src_src_att.k_layer.weight', 'encoder.layers.5.src_src_att.output_layer.bias', 'encoder.layers.5.src_src_att.output_layer.weight', 'encoder.layers.5.src_src_att.q_layer.bias', 'encoder.layers.5.src_src_att.q_layer.weight', 'encoder.layers.5.src_src_att.v_layer.bias', 'encoder.layers.5.src_src_att.v_layer.weight', 'src_embed.lut.weight']\n",
"2020-04-12 14:27:19,825 Loading model from /content/drive/My Drive/masakhane/en-yo-baseline/models/enyo_transformer/best.ckpt\n",
"2020-04-12 14:27:20,177 cfg.name : enyo_transformer\n",
"2020-04-12 14:27:20,178 cfg.data.src : en\n",
"2020-04-12 14:27:20,178 cfg.data.trg : yo\n",
"2020-04-12 14:27:20,178 cfg.data.train : /content/drive/My Drive/masakhane/en-yo-baseline/train.bpe\n",
"2020-04-12 14:27:20,178 cfg.data.dev : /content/drive/My Drive/masakhane/en-yo-baseline/dev.bpe\n",
"2020-04-12 14:27:20,178 cfg.data.test : /content/drive/My Drive/masakhane/en-yo-baseline/test.bpe\n",
"2020-04-12 14:27:20,178 cfg.data.level : bpe\n",
"2020-04-12 14:27:20,179 cfg.data.lowercase : False\n",
"2020-04-12 14:27:20,179 cfg.data.max_sent_length : 100\n",
"2020-04-12 14:27:20,179 cfg.data.src_vocab : /content/drive/My Drive/masakhane/en-yo-baseline/vocab.txt\n",
"2020-04-12 14:27:20,179 cfg.data.trg_vocab : /content/drive/My Drive/masakhane/en-yo-baseline/vocab.txt\n",
"2020-04-12 14:27:20,179 cfg.testing.beam_size : 5\n",
"2020-04-12 14:27:20,179 cfg.testing.alpha : 1.0\n",
"2020-04-12 14:27:20,179 cfg.training.load_model : /content/drive/My Drive/masakhane/en-yo-baseline/models/enyo_transformer/best.ckpt\n",
"2020-04-12 14:27:20,180 cfg.training.random_seed : 42\n",
"2020-04-12 14:27:20,180 cfg.training.optimizer : adam\n",
"2020-04-12 14:27:20,180 cfg.training.normalization : tokens\n",
"2020-04-12 14:27:20,180 cfg.training.adam_betas : [0.9, 0.999]\n",
"2020-04-12 14:27:20,180 cfg.training.scheduling : plateau\n",
"2020-04-12 14:27:20,180 cfg.training.patience : 5\n",
"2020-04-12 14:27:20,180 cfg.training.learning_rate_factor : 0.5\n",
"2020-04-12 14:27:20,180 cfg.training.learning_rate_warmup : 1000\n",
"2020-04-12 14:27:20,180 cfg.training.decrease_factor : 0.7\n",
"2020-04-12 14:27:20,181 cfg.training.loss : crossentropy\n",
"2020-04-12 14:27:20,181 cfg.training.learning_rate : 0.0003\n",
"2020-04-12 14:27:20,181 cfg.training.learning_rate_min : 1e-08\n",
"2020-04-12 14:27:20,181 cfg.training.weight_decay : 0.0\n",
"2020-04-12 14:27:20,181 cfg.training.label_smoothing : 0.1\n",
"2020-04-12 14:27:20,181 cfg.training.batch_size : 4096\n",
"2020-04-12 14:27:20,181 cfg.training.batch_type : token\n",
"2020-04-12 14:27:20,181 cfg.training.eval_batch_size : 3600\n",
"2020-04-12 14:27:20,182 cfg.training.eval_batch_type : token\n",
"2020-04-12 14:27:20,182 cfg.training.batch_multiplier : 1\n",
"2020-04-12 14:27:20,182 cfg.training.early_stopping_metric : ppl\n",
"2020-04-12 14:27:20,182 cfg.training.epochs : 2\n",
"2020-04-12 14:27:20,182 cfg.training.validation_freq : 1000\n",
"2020-04-12 14:27:20,182 cfg.training.logging_freq : 100\n",
"2020-04-12 14:27:20,182 cfg.training.eval_metric : bleu\n",
"2020-04-12 14:27:20,183 cfg.training.model_dir : /content/drive/My Drive/masakhane/model-temp\n",
"2020-04-12 14:27:20,183 cfg.training.overwrite : True\n",
"2020-04-12 14:27:20,183 cfg.training.shuffle : True\n",
"2020-04-12 14:27:20,183 cfg.training.use_cuda : True\n",
"2020-04-12 14:27:20,183 cfg.training.max_output_length : 100\n",
"2020-04-12 14:27:20,183 cfg.training.print_valid_sents : [0, 1, 2, 3]\n",
"2020-04-12 14:27:20,183 cfg.training.keep_last_ckpts : 3\n",
"2020-04-12 14:27:20,183 cfg.model.initializer : xavier\n",
"2020-04-12 14:27:20,184 cfg.model.bias_initializer : zeros\n",
"2020-04-12 14:27:20,184 cfg.model.init_gain : 1.0\n",
"2020-04-12 14:27:20,184 cfg.model.embed_initializer : xavier\n",
"2020-04-12 14:27:20,184 cfg.model.embed_init_gain : 1.0\n",
"2020-04-12 14:27:20,184 cfg.model.tied_embeddings : True\n",
"2020-04-12 14:27:20,184 cfg.model.tied_softmax : True\n",
"2020-04-12 14:27:20,184 cfg.model.encoder.type : transformer\n",
"2020-04-12 14:27:20,185 cfg.model.encoder.num_layers : 6\n",
"2020-04-12 14:27:20,185 cfg.model.encoder.num_heads : 4\n",
"2020-04-12 14:27:20,185 cfg.model.encoder.embeddings.embedding_dim : 256\n",
"2020-04-12 14:27:20,185 cfg.model.encoder.embeddings.scale : True\n",
"2020-04-12 14:27:20,185 cfg.model.encoder.embeddings.dropout : 0.2\n",
"2020-04-12 14:27:20,185 cfg.model.encoder.hidden_size : 256\n",
"2020-04-12 14:27:20,185 cfg.model.encoder.ff_size : 1024\n",
"2020-04-12 14:27:20,185 cfg.model.encoder.dropout : 0.3\n",
"2020-04-12 14:27:20,186 cfg.model.decoder.type : transformer\n",
"2020-04-12 14:27:20,186 cfg.model.decoder.num_layers : 6\n",
"2020-04-12 14:27:20,186 cfg.model.decoder.num_heads : 4\n",
"2020-04-12 14:27:20,186 cfg.model.decoder.embeddings.embedding_dim : 256\n",
"2020-04-12 14:27:20,186 cfg.model.decoder.embeddings.scale : True\n",
"2020-04-12 14:27:20,186 cfg.model.decoder.embeddings.dropout : 0.2\n",
"2020-04-12 14:27:20,186 cfg.model.decoder.hidden_size : 256\n",
"2020-04-12 14:27:20,186 cfg.model.decoder.ff_size : 1024\n",
"2020-04-12 14:27:20,187 cfg.model.decoder.dropout : 0.3\n",
"2020-04-12 14:27:20,187 Data set sizes: \n",
"\ttrain 415100,\n",
"\tvalid 1000,\n",
"\ttest 2662\n",
"2020-04-12 14:27:20,187 First training example:\n",
"\t[SRC] T@@ R@@ A@@ IN Y@@ O@@ U@@ R C@@ H@@ I@@ L@@ D@@ R@@ E@@ N : “ I teach my children to ch@@ ec@@ k the exp@@ ir@@ ation d@@ ate of any p@@ ack@@ aged food it@@ em@@ s , such as s@@ n@@ ac@@ ks , before they bu@@ y them . ” — Ru@@ th , N@@ ig@@ er@@ ia\n",
"\t[TRG] K@@ Ọ́ ÀWỌN Ọ@@ M@@ Ọ R@@ Ẹ : “ Mo kọ́ àwọn ọmọ mi pé kí wọ́n tó ra oúnjẹ bí ìp@@ á@@ p@@ án@@ u , tó wà nínú ag@@ ol@@ o , i@@ ke , bé@@ bà , tàbí ọ̀r@@ á , kí wọ́n máa yẹ ara oúnjẹ náà wò kí wọ́n lè mọ dé@@ è@@ tì tó máa bà jẹ́ . ” — Ru@@ th , N@@ àì@@ jí@@ ríà\n",
"2020-04-12 14:27:20,187 First 10 words (src): (0) <unk> (1) <pad> (2) <s> (3) </s> (4) , (5) . (6) the (7) tó (8) a (9) to\n",
"2020-04-12 14:27:20,187 First 10 words (trg): (0) <unk> (1) <pad> (2) <s> (3) </s> (4) , (5) . (6) the (7) tó (8) a (9) to\n",
"2020-04-12 14:27:20,187 Number of Src words (types): 4406\n",
"2020-04-12 14:27:20,188 Number of Trg words (types): 4406\n",
"2020-04-12 14:27:20,188 Model(\n",
"\tencoder=TransformerEncoder(num_layers=6, num_heads=4),\n",
"\tdecoder=TransformerDecoder(num_layers=6, num_heads=4),\n",
"\tsrc_embed=Embeddings(embedding_dim=256, vocab_size=4406),\n",
"\ttrg_embed=Embeddings(embedding_dim=256, vocab_size=4406))\n",
"2020-04-12 14:27:20,198 EPOCH 1\n",
"2020-04-12 14:27:31,916 Epoch 1 Step: 384100 Batch Loss: 2.240336 Tokens per Sec: 19764, Lr: 0.000004\n",
"2020-04-12 14:27:42,982 Epoch 1 Step: 384200 Batch Loss: 1.883319 Tokens per Sec: 20576, Lr: 0.000004\n",
"2020-04-12 14:27:54,021 Epoch 1 Step: 384300 Batch Loss: 1.927691 Tokens per Sec: 20939, Lr: 0.000004\n",
"2020-04-12 14:28:05,130 Epoch 1 Step: 384400 Batch Loss: 1.918795 Tokens per Sec: 21147, Lr: 0.000004\n",
"2020-04-12 14:28:16,247 Epoch 1 Step: 384500 Batch Loss: 2.029218 Tokens per Sec: 20929, Lr: 0.000004\n",
"2020-04-12 14:28:27,333 Epoch 1 Step: 384600 Batch Loss: 1.894163 Tokens per Sec: 20946, Lr: 0.000004\n",
"2020-04-12 14:28:38,420 Epoch 1 Step: 384700 Batch Loss: 1.838998 Tokens per Sec: 20906, Lr: 0.000004\n",
"2020-04-12 14:28:49,432 Epoch 1 Step: 384800 Batch Loss: 1.793913 Tokens per Sec: 21056, Lr: 0.000004\n",
"2020-04-12 14:29:00,482 Epoch 1 Step: 384900 Batch Loss: 1.827213 Tokens per Sec: 20679, Lr: 0.000004\n",
"2020-04-12 14:29:11,456 Epoch 1 Step: 385000 Batch Loss: 1.768281 Tokens per Sec: 21078, Lr: 0.000004\n",
"2020-04-12 14:29:28,421 Example #0\n",
"2020-04-12 14:29:28,422 \tSource: He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"2020-04-12 14:29:28,422 \tReference: Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:29:28,422 \tHypothesis: Òun ni Orísun ìyè , Ẹni tí ń fi í fúnni gẹ́gẹ́ bí ẹ̀bùn àìlẹ́tọ̀ọ́sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:29:28,422 Example #1\n",
"2020-04-12 14:29:28,423 \tSource: Now I had to find a legitimate line of work .\n",
"2020-04-12 14:29:28,423 \tReference: Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"2020-04-12 14:29:28,423 \tHypothesis: Ní báyìí , mo ní láti wá iṣẹ́ tó yẹ kí n ṣe .\n",
"2020-04-12 14:29:28,423 Example #2\n",
"2020-04-12 14:29:28,424 \tSource: Do I value material things more than my relationship with Jehovah and with people ?\n",
"2020-04-12 14:29:28,424 \tReference: Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"2020-04-12 14:29:28,424 \tHypothesis: Ǹjẹ́ mo mọyì àwọn nǹkan tara ju àjọṣe mi pẹ̀lú Jèhófà àti pẹ̀lú àwọn èèyàn lọ ?\n",
"2020-04-12 14:29:28,424 Example #3\n",
"2020-04-12 14:29:28,424 \tSource: He has far more experience and stamina than you do , but he patiently walks near you .\n",
"2020-04-12 14:29:28,424 \tReference: Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"2020-04-12 14:29:28,425 \tHypothesis: Ó ní ìrírí tó pọ̀ gan - an , ó sì tún ní ìrírí tó ju tìẹ lọ , àmọ́ ó fi sùúrù rìn nítòsí rẹ .\n",
"2020-04-12 14:29:28,425 Validation result (greedy) at epoch 1, step 385000: bleu: 30.04, loss: 41967.2539, ppl: 4.0905, duration: 16.9679s\n",
"2020-04-12 14:29:39,582 Epoch 1 Step: 385100 Batch Loss: 2.121287 Tokens per Sec: 21098, Lr: 0.000004\n",
"2020-04-12 14:29:50,538 Epoch 1 Step: 385200 Batch Loss: 1.998006 Tokens per Sec: 20587, Lr: 0.000004\n",
"2020-04-12 14:30:01,615 Epoch 1 Step: 385300 Batch Loss: 1.912782 Tokens per Sec: 21209, Lr: 0.000004\n",
"2020-04-12 14:30:12,660 Epoch 1 Step: 385400 Batch Loss: 1.806685 Tokens per Sec: 20871, Lr: 0.000004\n",
"2020-04-12 14:30:23,759 Epoch 1 Step: 385500 Batch Loss: 2.052587 Tokens per Sec: 21211, Lr: 0.000004\n",
"2020-04-12 14:30:34,653 Epoch 1 Step: 385600 Batch Loss: 1.783153 Tokens per Sec: 20515, Lr: 0.000004\n",
"2020-04-12 14:30:45,723 Epoch 1 Step: 385700 Batch Loss: 1.835905 Tokens per Sec: 21566, Lr: 0.000004\n",
"2020-04-12 14:30:56,709 Epoch 1 Step: 385800 Batch Loss: 1.911717 Tokens per Sec: 20845, Lr: 0.000004\n",
"2020-04-12 14:31:07,630 Epoch 1 Step: 385900 Batch Loss: 1.921858 Tokens per Sec: 21159, Lr: 0.000004\n",
"2020-04-12 14:31:18,512 Epoch 1 Step: 386000 Batch Loss: 1.973545 Tokens per Sec: 20908, Lr: 0.000004\n",
"2020-04-12 14:31:35,396 Example #0\n",
"2020-04-12 14:31:35,397 \tSource: He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"2020-04-12 14:31:35,397 \tReference: Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:31:35,397 \tHypothesis: Òun ni Orísun ìyè , Ẹni tí ń fi í fúnni gẹ́gẹ́ bí ẹ̀bùn àìlẹ́tọ̀ọ́sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:31:35,397 Example #1\n",
"2020-04-12 14:31:35,398 \tSource: Now I had to find a legitimate line of work .\n",
"2020-04-12 14:31:35,398 \tReference: Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"2020-04-12 14:31:35,398 \tHypothesis: Ní báyìí , mo ní láti wá iṣẹ́ tó yẹ kí n ṣe .\n",
"2020-04-12 14:31:35,398 Example #2\n",
"2020-04-12 14:31:35,399 \tSource: Do I value material things more than my relationship with Jehovah and with people ?\n",
"2020-04-12 14:31:35,399 \tReference: Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"2020-04-12 14:31:35,399 \tHypothesis: Ǹjẹ́ mo mọyì àwọn nǹkan tara ju àjọṣe mi pẹ̀lú Jèhófà àti pẹ̀lú àwọn èèyàn lọ ?\n",
"2020-04-12 14:31:35,399 Example #3\n",
"2020-04-12 14:31:35,400 \tSource: He has far more experience and stamina than you do , but he patiently walks near you .\n",
"2020-04-12 14:31:35,400 \tReference: Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"2020-04-12 14:31:35,400 \tHypothesis: Ó ní ìrírí tó pọ̀ gan - an , ó sì tún ní ìrírí tó ju tìẹ lọ , àmọ́ ó fi sùúrù rìn nítòsí rẹ .\n",
"2020-04-12 14:31:35,400 Validation result (greedy) at epoch 1, step 386000: bleu: 29.92, loss: 42548.0859, ppl: 4.1711, duration: 16.8875s\n",
"2020-04-12 14:31:46,453 Epoch 1 Step: 386100 Batch Loss: 2.060577 Tokens per Sec: 21051, Lr: 0.000004\n",
"2020-04-12 14:31:57,360 Epoch 1 Step: 386200 Batch Loss: 1.789646 Tokens per Sec: 20830, Lr: 0.000004\n",
"2020-04-12 14:32:08,332 Epoch 1 Step: 386300 Batch Loss: 1.944916 Tokens per Sec: 21407, Lr: 0.000004\n",
"2020-04-12 14:32:19,253 Epoch 1 Step: 386400 Batch Loss: 1.973574 Tokens per Sec: 21195, Lr: 0.000004\n",
"2020-04-12 14:32:30,182 Epoch 1 Step: 386500 Batch Loss: 1.965004 Tokens per Sec: 21150, Lr: 0.000004\n",
"2020-04-12 14:32:41,084 Epoch 1 Step: 386600 Batch Loss: 1.814785 Tokens per Sec: 20966, Lr: 0.000004\n",
"2020-04-12 14:32:52,090 Epoch 1 Step: 386700 Batch Loss: 2.025830 Tokens per Sec: 20638, Lr: 0.000004\n",
"2020-04-12 14:33:03,165 Epoch 1 Step: 386800 Batch Loss: 1.706421 Tokens per Sec: 21197, Lr: 0.000004\n",
"2020-04-12 14:33:14,067 Epoch 1 Step: 386900 Batch Loss: 1.815666 Tokens per Sec: 20733, Lr: 0.000004\n",
"2020-04-12 14:33:24,980 Epoch 1 Step: 387000 Batch Loss: 1.893143 Tokens per Sec: 21026, Lr: 0.000004\n",
"2020-04-12 14:33:41,969 Example #0\n",
"2020-04-12 14:33:41,969 \tSource: He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"2020-04-12 14:33:41,969 \tReference: Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:33:41,970 \tHypothesis: Òun ni Orísun ìyè , Ẹni tí ń fi í fúnni gẹ́gẹ́ bí ẹ̀bùn àìlẹ́tọ̀ọ́sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:33:41,970 Example #1\n",
"2020-04-12 14:33:41,970 \tSource: Now I had to find a legitimate line of work .\n",
"2020-04-12 14:33:41,970 \tReference: Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"2020-04-12 14:33:41,971 \tHypothesis: Ní báyìí , mo ní láti wá iṣẹ́ tó dára .\n",
"2020-04-12 14:33:41,971 Example #2\n",
"2020-04-12 14:33:41,972 \tSource: Do I value material things more than my relationship with Jehovah and with people ?\n",
"2020-04-12 14:33:41,972 \tReference: Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"2020-04-12 14:33:41,972 \tHypothesis: Ǹjẹ́ mo mọyì àwọn nǹkan tara ju àjọṣe mi pẹ̀lú Jèhófà àti pẹ̀lú àwọn èèyàn lọ ?\n",
"2020-04-12 14:33:41,972 Example #3\n",
"2020-04-12 14:33:41,973 \tSource: He has far more experience and stamina than you do , but he patiently walks near you .\n",
"2020-04-12 14:33:41,973 \tReference: Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"2020-04-12 14:33:41,973 \tHypothesis: Ó ní ìrírí tó pọ̀ gan - an , ó sì tún ní ìrírí tó ju tìẹ lọ , àmọ́ ó fi sùúrù rìn nítòsí rẹ .\n",
"2020-04-12 14:33:41,973 Validation result (greedy) at epoch 1, step 387000: bleu: 29.87, loss: 42807.0391, ppl: 4.2075, duration: 16.9932s\n",
"2020-04-12 14:33:52,943 Epoch 1 Step: 387100 Batch Loss: 1.831305 Tokens per Sec: 20895, Lr: 0.000004\n",
"2020-04-12 14:34:03,745 Epoch 1 Step: 387200 Batch Loss: 1.805957 Tokens per Sec: 20377, Lr: 0.000004\n",
"2020-04-12 14:34:14,840 Epoch 1 Step: 387300 Batch Loss: 1.742952 Tokens per Sec: 21086, Lr: 0.000004\n",
"2020-04-12 14:34:25,757 Epoch 1 Step: 387400 Batch Loss: 2.395472 Tokens per Sec: 21045, Lr: 0.000004\n",
"2020-04-12 14:34:36,705 Epoch 1 Step: 387500 Batch Loss: 1.808187 Tokens per Sec: 20949, Lr: 0.000004\n",
"2020-04-12 14:34:47,693 Epoch 1 Step: 387600 Batch Loss: 1.924356 Tokens per Sec: 21305, Lr: 0.000004\n",
"2020-04-12 14:34:58,665 Epoch 1 Step: 387700 Batch Loss: 1.883427 Tokens per Sec: 20812, Lr: 0.000004\n",
"2020-04-12 14:35:09,662 Epoch 1 Step: 387800 Batch Loss: 1.921607 Tokens per Sec: 21186, Lr: 0.000004\n",
"2020-04-12 14:35:20,718 Epoch 1 Step: 387900 Batch Loss: 1.909007 Tokens per Sec: 21307, Lr: 0.000004\n",
"2020-04-12 14:35:31,647 Epoch 1 Step: 388000 Batch Loss: 1.892324 Tokens per Sec: 20464, Lr: 0.000004\n",
"2020-04-12 14:35:48,532 Example #0\n",
"2020-04-12 14:35:48,533 \tSource: He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"2020-04-12 14:35:48,533 \tReference: Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:35:48,533 \tHypothesis: Òun ni Orísun ìyè , Ẹni tí ń fi í fúnni gẹ́gẹ́ bí ẹ̀bùn àìlẹ́tọ̀ọ́sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:35:48,533 Example #1\n",
"2020-04-12 14:35:48,533 \tSource: Now I had to find a legitimate line of work .\n",
"2020-04-12 14:35:48,534 \tReference: Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"2020-04-12 14:35:48,534 \tHypothesis: Ní báyìí , mo ní láti wá iṣẹ́ tó dára .\n",
"2020-04-12 14:35:48,534 Example #2\n",
"2020-04-12 14:35:48,534 \tSource: Do I value material things more than my relationship with Jehovah and with people ?\n",
"2020-04-12 14:35:48,534 \tReference: Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"2020-04-12 14:35:48,534 \tHypothesis: Ǹjẹ́ mo mọyì àwọn nǹkan tara ju àjọṣe mi pẹ̀lú Jèhófà àti pẹ̀lú àwọn èèyàn lọ ?\n",
"2020-04-12 14:35:48,535 Example #3\n",
"2020-04-12 14:35:48,535 \tSource: He has far more experience and stamina than you do , but he patiently walks near you .\n",
"2020-04-12 14:35:48,535 \tReference: Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"2020-04-12 14:35:48,535 \tHypothesis: Ó ní ìrírí tó pọ̀ gan - an , ó sì tún ní ìrírí tó ju tìẹ lọ , àmọ́ ó fi sùúrù rìn nítòsí rẹ .\n",
"2020-04-12 14:35:48,535 Validation result (greedy) at epoch 1, step 388000: bleu: 29.81, loss: 42958.7578, ppl: 4.2290, duration: 16.8883s\n",
"2020-04-12 14:35:59,503 Epoch 1 Step: 388100 Batch Loss: 1.835913 Tokens per Sec: 21177, Lr: 0.000004\n",
"2020-04-12 14:36:10,367 Epoch 1 Step: 388200 Batch Loss: 1.863079 Tokens per Sec: 21249, Lr: 0.000004\n",
"2020-04-12 14:36:21,399 Epoch 1 Step: 388300 Batch Loss: 1.825538 Tokens per Sec: 20914, Lr: 0.000004\n",
"2020-04-12 14:36:32,421 Epoch 1 Step: 388400 Batch Loss: 1.788421 Tokens per Sec: 21343, Lr: 0.000004\n",
"2020-04-12 14:36:43,501 Epoch 1 Step: 388500 Batch Loss: 2.025025 Tokens per Sec: 21474, Lr: 0.000004\n",
"2020-04-12 14:36:54,499 Epoch 1 Step: 388600 Batch Loss: 1.974475 Tokens per Sec: 20873, Lr: 0.000004\n",
"2020-04-12 14:37:05,496 Epoch 1 Step: 388700 Batch Loss: 1.740090 Tokens per Sec: 20847, Lr: 0.000004\n",
"2020-04-12 14:37:16,508 Epoch 1 Step: 388800 Batch Loss: 1.982534 Tokens per Sec: 21475, Lr: 0.000004\n",
"2020-04-12 14:37:27,535 Epoch 1 Step: 388900 Batch Loss: 1.769454 Tokens per Sec: 21121, Lr: 0.000004\n",
"2020-04-12 14:37:38,498 Epoch 1 Step: 389000 Batch Loss: 2.170954 Tokens per Sec: 21243, Lr: 0.000004\n",
"2020-04-12 14:37:55,188 Example #0\n",
"2020-04-12 14:37:55,189 \tSource: He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"2020-04-12 14:37:55,189 \tReference: Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:37:55,189 \tHypothesis: Òun ni Orísun ìyè , Ẹni tí ń fi í fúnni gẹ́gẹ́ bí ẹ̀bùn àìlẹ́tọ̀ọ́sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:37:55,189 Example #1\n",
"2020-04-12 14:37:55,190 \tSource: Now I had to find a legitimate line of work .\n",
"2020-04-12 14:37:55,190 \tReference: Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"2020-04-12 14:37:55,190 \tHypothesis: Ní báyìí , mo ní láti wá iṣẹ́ tó dára .\n",
"2020-04-12 14:37:55,190 Example #2\n",
"2020-04-12 14:37:55,190 \tSource: Do I value material things more than my relationship with Jehovah and with people ?\n",
"2020-04-12 14:37:55,190 \tReference: Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"2020-04-12 14:37:55,191 \tHypothesis: Ǹjẹ́ mo mọyì àwọn nǹkan tara ju àjọṣe mi pẹ̀lú Jèhófà àti pẹ̀lú àwọn èèyàn lọ ?\n",
"2020-04-12 14:37:55,191 Example #3\n",
"2020-04-12 14:37:55,191 \tSource: He has far more experience and stamina than you do , but he patiently walks near you .\n",
"2020-04-12 14:37:55,191 \tReference: Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"2020-04-12 14:37:55,191 \tHypothesis: Ó ní ìrírí tó pọ̀ gan - an , ó sì tún ní ìrírí tó ju tìẹ lọ , àmọ́ ó fi sùúrù rìn nítòsí rẹ .\n",
"2020-04-12 14:37:55,192 Validation result (greedy) at epoch 1, step 389000: bleu: 29.81, loss: 43055.4961, ppl: 4.2427, duration: 16.6934s\n",
"2020-04-12 14:38:06,145 Epoch 1 Step: 389100 Batch Loss: 2.074862 Tokens per Sec: 20912, Lr: 0.000004\n",
"2020-04-12 14:38:17,133 Epoch 1 Step: 389200 Batch Loss: 1.827384 Tokens per Sec: 21191, Lr: 0.000004\n",
"2020-04-12 14:38:22,901 Epoch 1: total training loss 9948.21\n",
"2020-04-12 14:38:22,901 EPOCH 2\n",
"2020-04-12 14:38:28,719 Epoch 2 Step: 389300 Batch Loss: 1.760182 Tokens per Sec: 18760, Lr: 0.000004\n",
"2020-04-12 14:38:39,664 Epoch 2 Step: 389400 Batch Loss: 1.873315 Tokens per Sec: 21172, Lr: 0.000004\n",
"2020-04-12 14:38:50,639 Epoch 2 Step: 389500 Batch Loss: 1.902953 Tokens per Sec: 20788, Lr: 0.000004\n",
"2020-04-12 14:39:01,574 Epoch 2 Step: 389600 Batch Loss: 1.809665 Tokens per Sec: 21479, Lr: 0.000004\n",
"2020-04-12 14:39:12,512 Epoch 2 Step: 389700 Batch Loss: 1.766662 Tokens per Sec: 20945, Lr: 0.000004\n",
"2020-04-12 14:39:23,531 Epoch 2 Step: 389800 Batch Loss: 1.920965 Tokens per Sec: 21257, Lr: 0.000004\n",
"2020-04-12 14:39:34,589 Epoch 2 Step: 389900 Batch Loss: 1.631354 Tokens per Sec: 20831, Lr: 0.000004\n",
"2020-04-12 14:39:45,624 Epoch 2 Step: 390000 Batch Loss: 1.987037 Tokens per Sec: 21283, Lr: 0.000004\n",
"2020-04-12 14:40:02,345 Example #0\n",
"2020-04-12 14:40:02,346 \tSource: He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"2020-04-12 14:40:02,346 \tReference: Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:40:02,346 \tHypothesis: Òun ni Orísun ìyè , Ẹni tí ń fi í fúnni gẹ́gẹ́ bí ẹ̀bùn àìlẹ́tọ̀ọ́sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:40:02,346 Example #1\n",
"2020-04-12 14:40:02,347 \tSource: Now I had to find a legitimate line of work .\n",
"2020-04-12 14:40:02,347 \tReference: Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"2020-04-12 14:40:02,347 \tHypothesis: Ní báyìí , mo ní láti wá iṣẹ́ tó dára .\n",
"2020-04-12 14:40:02,347 Example #2\n",
"2020-04-12 14:40:02,348 \tSource: Do I value material things more than my relationship with Jehovah and with people ?\n",
"2020-04-12 14:40:02,348 \tReference: Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"2020-04-12 14:40:02,348 \tHypothesis: Ǹjẹ́ mo mọyì àwọn nǹkan tara ju àjọṣe mi pẹ̀lú Jèhófà àti pẹ̀lú àwọn èèyàn lọ ?\n",
"2020-04-12 14:40:02,348 Example #3\n",
"2020-04-12 14:40:02,348 \tSource: He has far more experience and stamina than you do , but he patiently walks near you .\n",
"2020-04-12 14:40:02,348 \tReference: Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"2020-04-12 14:40:02,349 \tHypothesis: Ó ní ìrírí tó pọ̀ gan - an , ó sì tún ní ìrírí tó ju tìẹ lọ , àmọ́ ó fi sùúrù rìn nítòsí rẹ .\n",
"2020-04-12 14:40:02,349 Validation result (greedy) at epoch 2, step 390000: bleu: 29.73, loss: 43157.8398, ppl: 4.2573, duration: 16.7243s\n",
"2020-04-12 14:40:13,342 Epoch 2 Step: 390100 Batch Loss: 1.877792 Tokens per Sec: 21187, Lr: 0.000003\n",
"2020-04-12 14:40:24,329 Epoch 2 Step: 390200 Batch Loss: 2.167672 Tokens per Sec: 21032, Lr: 0.000003\n",
"2020-04-12 14:40:35,294 Epoch 2 Step: 390300 Batch Loss: 1.830189 Tokens per Sec: 21334, Lr: 0.000003\n",
"2020-04-12 14:40:46,276 Epoch 2 Step: 390400 Batch Loss: 1.821566 Tokens per Sec: 21062, Lr: 0.000003\n",
"2020-04-12 14:40:57,227 Epoch 2 Step: 390500 Batch Loss: 1.758496 Tokens per Sec: 20903, Lr: 0.000003\n",
"2020-04-12 14:41:08,233 Epoch 2 Step: 390600 Batch Loss: 1.762770 Tokens per Sec: 21055, Lr: 0.000003\n",
"2020-04-12 14:41:19,211 Epoch 2 Step: 390700 Batch Loss: 1.878187 Tokens per Sec: 21310, Lr: 0.000003\n",
"2020-04-12 14:41:30,212 Epoch 2 Step: 390800 Batch Loss: 1.967181 Tokens per Sec: 21377, Lr: 0.000003\n",
"2020-04-12 14:41:41,199 Epoch 2 Step: 390900 Batch Loss: 1.863368 Tokens per Sec: 21242, Lr: 0.000003\n",
"2020-04-12 14:41:52,307 Epoch 2 Step: 391000 Batch Loss: 1.980855 Tokens per Sec: 20991, Lr: 0.000003\n",
"2020-04-12 14:42:08,885 Example #0\n",
"2020-04-12 14:42:08,885 \tSource: He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"2020-04-12 14:42:08,886 \tReference: Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:42:08,886 \tHypothesis: Òun ni Orísun ìyè , Ẹni tí ń fi í fúnni gẹ́gẹ́ bí ẹ̀bùn àìlẹ́tọ̀ọ́sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:42:08,886 Example #1\n",
"2020-04-12 14:42:08,886 \tSource: Now I had to find a legitimate line of work .\n",
"2020-04-12 14:42:08,886 \tReference: Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"2020-04-12 14:42:08,887 \tHypothesis: Ní báyìí , mo ní láti wá iṣẹ́ tó dára .\n",
"2020-04-12 14:42:08,887 Example #2\n",
"2020-04-12 14:42:08,887 \tSource: Do I value material things more than my relationship with Jehovah and with people ?\n",
"2020-04-12 14:42:08,887 \tReference: Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"2020-04-12 14:42:08,887 \tHypothesis: Ǹjẹ́ mo mọyì àwọn nǹkan tara ju àjọṣe mi pẹ̀lú Jèhófà àti pẹ̀lú àwọn èèyàn lọ ?\n",
"2020-04-12 14:42:08,887 Example #3\n",
"2020-04-12 14:42:08,888 \tSource: He has far more experience and stamina than you do , but he patiently walks near you .\n",
"2020-04-12 14:42:08,888 \tReference: Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"2020-04-12 14:42:08,888 \tHypothesis: Ó ní ìrírí tó pọ̀ gan - an , ó sì tún ní ìrírí tó ju tìẹ lọ , àmọ́ ó fi sùúrù rìn nítòsí rẹ .\n",
"2020-04-12 14:42:08,888 Validation result (greedy) at epoch 2, step 391000: bleu: 29.64, loss: 43197.9961, ppl: 4.2631, duration: 16.5808s\n",
"2020-04-12 14:42:19,715 Epoch 2 Step: 391100 Batch Loss: 1.730690 Tokens per Sec: 20686, Lr: 0.000003\n",
"2020-04-12 14:42:30,694 Epoch 2 Step: 391200 Batch Loss: 1.928249 Tokens per Sec: 21463, Lr: 0.000003\n",
"2020-04-12 14:42:41,529 Epoch 2 Step: 391300 Batch Loss: 1.834248 Tokens per Sec: 21164, Lr: 0.000003\n",
"2020-04-12 14:42:52,423 Epoch 2 Step: 391400 Batch Loss: 1.513258 Tokens per Sec: 21443, Lr: 0.000003\n",
"2020-04-12 14:43:03,189 Epoch 2 Step: 391500 Batch Loss: 1.757843 Tokens per Sec: 21456, Lr: 0.000003\n",
"2020-04-12 14:43:14,143 Epoch 2 Step: 391600 Batch Loss: 1.844177 Tokens per Sec: 21430, Lr: 0.000003\n",
"2020-04-12 14:43:25,018 Epoch 2 Step: 391700 Batch Loss: 1.996000 Tokens per Sec: 21009, Lr: 0.000003\n",
"2020-04-12 14:43:35,837 Epoch 2 Step: 391800 Batch Loss: 1.765452 Tokens per Sec: 21162, Lr: 0.000003\n",
"2020-04-12 14:43:46,803 Epoch 2 Step: 391900 Batch Loss: 1.766898 Tokens per Sec: 21112, Lr: 0.000003\n",
"2020-04-12 14:43:57,670 Epoch 2 Step: 392000 Batch Loss: 1.725068 Tokens per Sec: 21219, Lr: 0.000003\n",
"2020-04-12 14:44:14,024 Example #0\n",
"2020-04-12 14:44:14,025 \tSource: He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"2020-04-12 14:44:14,025 \tReference: Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:44:14,025 \tHypothesis: Òun ni Orísun ìyè , Ẹni tí ń fi í fúnni gẹ́gẹ́ bí ẹ̀bùn àìlẹ́tọ̀ọ́sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:44:14,025 Example #1\n",
"2020-04-12 14:44:14,026 \tSource: Now I had to find a legitimate line of work .\n",
"2020-04-12 14:44:14,026 \tReference: Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"2020-04-12 14:44:14,026 \tHypothesis: Ní báyìí , mo ní láti wá iṣẹ́ tó dára .\n",
"2020-04-12 14:44:14,026 Example #2\n",
"2020-04-12 14:44:14,026 \tSource: Do I value material things more than my relationship with Jehovah and with people ?\n",
"2020-04-12 14:44:14,026 \tReference: Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"2020-04-12 14:44:14,027 \tHypothesis: Ǹjẹ́ mo mọyì àwọn nǹkan tara ju àjọṣe mi pẹ̀lú Jèhófà àti pẹ̀lú àwọn èèyàn lọ ?\n",
"2020-04-12 14:44:14,027 Example #3\n",
"2020-04-12 14:44:14,027 \tSource: He has far more experience and stamina than you do , but he patiently walks near you .\n",
"2020-04-12 14:44:14,027 \tReference: Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"2020-04-12 14:44:14,027 \tHypothesis: Ó ní ìrírí tó pọ̀ gan - an , ó sì tún ní ìrírí tó ju tìẹ lọ , àmọ́ ó fi sùúrù rìn nítòsí rẹ .\n",
"2020-04-12 14:44:14,028 Validation result (greedy) at epoch 2, step 392000: bleu: 29.65, loss: 43272.7344, ppl: 4.2738, duration: 16.3569s\n",
"2020-04-12 14:44:24,889 Epoch 2 Step: 392100 Batch Loss: 1.622569 Tokens per Sec: 21533, Lr: 0.000003\n",
"2020-04-12 14:44:35,730 Epoch 2 Step: 392200 Batch Loss: 1.807818 Tokens per Sec: 21542, Lr: 0.000003\n",
"2020-04-12 14:44:46,584 Epoch 2 Step: 392300 Batch Loss: 1.841716 Tokens per Sec: 21313, Lr: 0.000003\n",
"2020-04-12 14:44:57,337 Epoch 2 Step: 392400 Batch Loss: 1.885677 Tokens per Sec: 20886, Lr: 0.000003\n",
"2020-04-12 14:45:08,321 Epoch 2 Step: 392500 Batch Loss: 1.964448 Tokens per Sec: 21317, Lr: 0.000003\n",
"2020-04-12 14:45:19,193 Epoch 2 Step: 392600 Batch Loss: 2.000385 Tokens per Sec: 21782, Lr: 0.000003\n",
"2020-04-12 14:45:29,962 Epoch 2 Step: 392700 Batch Loss: 1.820094 Tokens per Sec: 21302, Lr: 0.000003\n",
"2020-04-12 14:45:40,818 Epoch 2 Step: 392800 Batch Loss: 1.933245 Tokens per Sec: 21218, Lr: 0.000003\n",
"2020-04-12 14:45:51,841 Epoch 2 Step: 392900 Batch Loss: 1.811371 Tokens per Sec: 21688, Lr: 0.000003\n",
"2020-04-12 14:46:02,880 Epoch 2 Step: 393000 Batch Loss: 1.792009 Tokens per Sec: 20785, Lr: 0.000003\n",
"2020-04-12 14:46:19,547 Example #0\n",
"2020-04-12 14:46:19,548 \tSource: He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"2020-04-12 14:46:19,548 \tReference: Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:46:19,548 \tHypothesis: Òun ni Orísun ìyè , Ẹni tí ń fi í fúnni gẹ́gẹ́ bí ẹ̀bùn àìlẹ́tọ̀ọ́sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:46:19,548 Example #1\n",
"2020-04-12 14:46:19,548 \tSource: Now I had to find a legitimate line of work .\n",
"2020-04-12 14:46:19,549 \tReference: Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"2020-04-12 14:46:19,549 \tHypothesis: Ní báyìí , mo ní láti wá iṣẹ́ tó dára .\n",
"2020-04-12 14:46:19,549 Example #2\n",
"2020-04-12 14:46:19,549 \tSource: Do I value material things more than my relationship with Jehovah and with people ?\n",
"2020-04-12 14:46:19,550 \tReference: Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"2020-04-12 14:46:19,550 \tHypothesis: Ǹjẹ́ mo mọyì àwọn nǹkan tara ju àjọṣe mi pẹ̀lú Jèhófà àti pẹ̀lú àwọn èèyàn lọ ?\n",
"2020-04-12 14:46:19,550 Example #3\n",
"2020-04-12 14:46:19,550 \tSource: He has far more experience and stamina than you do , but he patiently walks near you .\n",
"2020-04-12 14:46:19,550 \tReference: Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"2020-04-12 14:46:19,551 \tHypothesis: Ó ní ìrírí tó pọ̀ gan - an , ó sì tún ní ìrírí tó ju tìẹ lọ , àmọ́ ó fi sùúrù rìn nítòsí rẹ .\n",
"2020-04-12 14:46:19,551 Validation result (greedy) at epoch 2, step 393000: bleu: 29.67, loss: 43318.9180, ppl: 4.2804, duration: 16.6700s\n",
"2020-04-12 14:46:30,459 Epoch 2 Step: 393100 Batch Loss: 2.018415 Tokens per Sec: 21103, Lr: 0.000003\n",
"2020-04-12 14:46:41,361 Epoch 2 Step: 393200 Batch Loss: 1.778643 Tokens per Sec: 21226, Lr: 0.000003\n",
"2020-04-12 14:46:52,245 Epoch 2 Step: 393300 Batch Loss: 1.754664 Tokens per Sec: 21062, Lr: 0.000003\n",
"2020-04-12 14:47:03,210 Epoch 2 Step: 393400 Batch Loss: 1.905242 Tokens per Sec: 20484, Lr: 0.000003\n",
"2020-04-12 14:47:14,073 Epoch 2 Step: 393500 Batch Loss: 1.560444 Tokens per Sec: 21002, Lr: 0.000003\n",
"2020-04-12 14:47:24,945 Epoch 2 Step: 393600 Batch Loss: 1.909894 Tokens per Sec: 21049, Lr: 0.000003\n",
"2020-04-12 14:47:35,814 Epoch 2 Step: 393700 Batch Loss: 1.815693 Tokens per Sec: 21220, Lr: 0.000003\n",
"2020-04-12 14:47:46,909 Epoch 2 Step: 393800 Batch Loss: 1.723883 Tokens per Sec: 20311, Lr: 0.000003\n",
"2020-04-12 14:47:58,384 Epoch 2 Step: 393900 Batch Loss: 1.734728 Tokens per Sec: 21223, Lr: 0.000003\n",
"2020-04-12 14:48:09,625 Epoch 2 Step: 394000 Batch Loss: 1.688648 Tokens per Sec: 20607, Lr: 0.000003\n",
"2020-04-12 14:48:26,520 Example #0\n",
"2020-04-12 14:48:26,521 \tSource: He is the Source of life , the One giving it as an undeserved gift through Christ .\n",
"2020-04-12 14:48:26,521 \tReference: Òun ni Orísun ìyè , Ẹni tí ń fi ìyè fúnni gẹ́gẹ́ bí ẹbùn tí a kò lẹ́tọ̀ọ́ sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:48:26,521 \tHypothesis: Òun ni Orísun ìyè , Ẹni tí ń fi í fúnni gẹ́gẹ́ bí ẹ̀bùn àìlẹ́tọ̀ọ́sí nípasẹ̀ Kristi .\n",
"2020-04-12 14:48:26,521 Example #1\n",
"2020-04-12 14:48:26,522 \tSource: Now I had to find a legitimate line of work .\n",
"2020-04-12 14:48:26,522 \tReference: Torí náà , mo ní láti wá iṣẹ́ gidi .\n",
"2020-04-12 14:48:26,522 \tHypothesis: Ní báyìí , mo ní láti wá iṣẹ́ tó dára .\n",
"2020-04-12 14:48:26,522 Example #2\n",
"2020-04-12 14:48:26,522 \tSource: Do I value material things more than my relationship with Jehovah and with people ?\n",
"2020-04-12 14:48:26,523 \tReference: Ṣé àwọn nǹkan tara ló jẹ mí lógún jù àbí àjọṣe mi pẹ̀lú Jèhófà àtàwọn èèyàn ?\n",
"2020-04-12 14:48:26,523 \tHypothesis: Ǹjẹ́ mo mọyì àwọn nǹkan tara ju àjọṣe mi pẹ̀lú Jèhófà àti pẹ̀lú àwọn èèyàn lọ ?\n",
"2020-04-12 14:48:26,523 Example #3\n",
"2020-04-12 14:48:26,523 \tSource: He has far more experience and stamina than you do , but he patiently walks near you .\n",
"2020-04-12 14:48:26,523 \tReference: Ẹni tẹ́ ẹ jọ ń lọ yìí mọ ọ̀nà yẹn dáadáa .\n",
"2020-04-12 14:48:26,523 \tHypothesis: Ó ní ìrírí tó pọ̀ gan - an , ó sì tún ní ìrírí tó ju tìẹ lọ , àmọ́ ó fi sùúrù rìn nítòsí rẹ .\n",
"2020-04-12 14:48:26,524 Validation result (greedy) at epoch 2, step 394000: bleu: 29.73, loss: 43349.5234, ppl: 4.2848, duration: 16.8980s\n",
"2020-04-12 14:48:37,605 Epoch 2 Step: 394100 Batch Loss: 1.800462 Tokens per Sec: 20434, Lr: 0.000003\n",
"2020-04-12 14:48:48,705 Epoch 2 Step: 394200 Batch Loss: 1.878787 Tokens per Sec: 20894, Lr: 0.000003\n",
"2020-04-12 14:48:59,810 Epoch 2 Step: 394300 Batch Loss: 1.908489 Tokens per Sec: 20646, Lr: 0.000003\n",
"2020-04-12 14:49:10,987 Epoch 2 Step: 394400 Batch Loss: 1.732751 Tokens per Sec: 20868, Lr: 0.000003\n",
"2020-04-12 14:49:21,863 Epoch 2 Step: 394500 Batch Loss: 1.677493 Tokens per Sec: 20701, Lr: 0.000003\n",
"2020-04-12 14:49:21,877 Epoch 2: total training loss 9712.73\n",
"2020-04-12 14:49:21,878 Training ended after 2 epochs.\n",
"2020-04-12 14:49:21,878 Best validation result (greedy) at step 384000: 3.72 ppl.\n",
"2020-04-12 14:49:53,303 dev bleu: 31.03 [Beam search decoding with beam size = 5 and alpha = 1.0]\n",
"2020-04-12 14:49:53,328 Translations saved to: /content/drive/My Drive/masakhane/model-temp/00384000.hyps.dev\n",
"2020-04-12 14:50:31,869 test bleu: 38.62 [Beam search decoding with beam size = 5 and alpha = 1.0]\n",
"2020-04-12 14:50:31,876 Translations saved to: /content/drive/My Drive/masakhane/model-temp/00384000.hyps.test\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "MBoDS09JM807",
"colab": {}
},
"source": [
"# Copy the created models from the temporary storage to main storage on google drive for persistant storage \n",
"!cp -r \"/content/drive/My Drive/masakhane/model-temp/\"* \"$gdrive_path/models/${src}${tgt}_transformer/\""
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "n94wlrCjVc17",
"outputId": "90442631-4be7-4089-ac2d-18119a640d17",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 197
}
},
"source": [
"# Output our validation accuracy\n",
"! cat \"$gdrive_path/models/${src}${tgt}_transformer/validations.txt\""
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"Steps: 385000\tLoss: 41967.25391\tPPL: 4.09053\tbleu: 30.03572\tLR: 0.00000415\t\n",
"Steps: 386000\tLoss: 42548.08594\tPPL: 4.17107\tbleu: 29.91872\tLR: 0.00000415\t\n",
"Steps: 387000\tLoss: 42807.03906\tPPL: 4.20748\tbleu: 29.87333\tLR: 0.00000415\t\n",
"Steps: 388000\tLoss: 42958.75781\tPPL: 4.22896\tbleu: 29.81204\tLR: 0.00000415\t\n",
"Steps: 389000\tLoss: 43055.49609\tPPL: 4.24271\tbleu: 29.80630\tLR: 0.00000415\t\n",
"Steps: 390000\tLoss: 43157.83984\tPPL: 4.25731\tbleu: 29.72661\tLR: 0.00000291\t\n",
"Steps: 391000\tLoss: 43197.99609\tPPL: 4.26306\tbleu: 29.64012\tLR: 0.00000291\t\n",
"Steps: 392000\tLoss: 43272.73438\tPPL: 4.27376\tbleu: 29.64561\tLR: 0.00000291\t\n",
"Steps: 393000\tLoss: 43318.91797\tPPL: 4.28040\tbleu: 29.66845\tLR: 0.00000291\t\n",
"Steps: 394000\tLoss: 43349.52344\tPPL: 4.28479\tbleu: 29.72774\tLR: 0.00000291\t\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"colab_type": "code",
"id": "66WhRE9lIhoD",
"outputId": "16aacfc5-552a-4b2c-c264-198ac5b1d7a7",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 71
}
},
"source": [
"# Test our model\n",
"! cd joeynmt; python3 -m joeynmt test \"$gdrive_path/models/${src}${tgt}_transformer/config.yaml\""
],
"execution_count": 0,
"outputs": [
{
"output_type": "stream",
"text": [
"2020-04-12 14:54:41,810 Hello! This is Joey-NMT.\n",
"2020-04-12 14:55:15,182 dev bleu: 31.03 [Beam search decoding with beam size = 5 and alpha = 1.0]\n",
"2020-04-12 14:55:53,503 test bleu: 38.62 [Beam search decoding with beam size = 5 and alpha = 1.0]\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "KaXDFfm-zgjK",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
} |