File size: 123,407 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 |
{
"cells": [
{
"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",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"id": "oGRmDELn7Az0",
"outputId": "5dfcaf0a-4e8d-4f84-a1fa-42940b6f2252"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
]
}
],
"source": [
"from google.colab import drive\n",
"drive.mount('/content/drive')"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "Cn3tgQLzUxwn"
},
"outputs": [],
"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 = \"fon\" \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",
"os.environ[\"gdrive_path\"] = \"/content/drive/My Drive/masakhane/%s-%s-%s\" % (source_language, target_language, tag)"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"id": "kBSgJHEw7Nvx",
"outputId": "f006df06-8d99-432e-d9f5-1b2227b2d1f6"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"/content/drive/My Drive/masakhane/en-fon-baseline\n"
]
}
],
"source": [
"!echo $gdrive_path"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 102
},
"colab_type": "code",
"id": "gA75Fs9ys8Y9",
"outputId": "93dc8f60-2de8-45ba-9bb5-0afd9cf3b358"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting opustools-pkg\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/6c/9f/e829a0cceccc603450cd18e1ff80807b6237a88d9a8df2c0bb320796e900/opustools_pkg-0.0.52-py3-none-any.whl (80kB)\n",
"\r",
"\u001b[K |████ | 10kB 25.2MB/s eta 0:00:01\r",
"\u001b[K |████████ | 20kB 4.5MB/s eta 0:00:01\r",
"\u001b[K |████████████▏ | 30kB 6.3MB/s eta 0:00:01\r",
"\u001b[K |████████████████▏ | 40kB 8.1MB/s eta 0:00:01\r",
"\u001b[K |████████████████████▎ | 51kB 5.2MB/s eta 0:00:01\r",
"\u001b[K |████████████████████████▎ | 61kB 6.1MB/s eta 0:00:01\r",
"\u001b[K |████████████████████████████▎ | 71kB 6.9MB/s eta 0:00:01\r",
"\u001b[K |████████████████████████████████| 81kB 4.8MB/s \n",
"\u001b[?25hInstalling collected packages: opustools-pkg\n",
"Successfully installed opustools-pkg-0.0.52\n"
]
}
],
"source": [
"# Install opus-tools\n",
"! pip install opustools-pkg"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 187
},
"colab_type": "code",
"id": "xq-tDZVks7ZD",
"outputId": "e7343c5b-3bc2-4979-8fb3-b75b5a025164"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"Alignment file /proj/nlpl/data/OPUS/JW300/latest/xml/en-fon.xml.gz not found. The following files are available for downloading:\n",
"\n",
" ./JW300_latest_xml_fon.zip already exists\n",
" 324 KB https://object.pouta.csc.fi/OPUS-JW300/v1/xml/en-fon.xml.gz\n",
" 263 MB https://object.pouta.csc.fi/OPUS-JW300/v1/xml/en.zip\n",
"\n",
" 263 MB Total size\n",
"./JW300_latest_xml_en-fon.xml.gz ... 100% of 324 KB\n",
"./JW300_latest_xml_en.zip ... 100% of 263 MB\n"
]
}
],
"source": [
"# 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"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 578
},
"colab_type": "code",
"id": "n48GDRnP8y2G",
"outputId": "ed67a5b7-a1db-4d8b-bb37-58111706be8a"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"--2019-11-26 13:32:06-- 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",
"\r",
"test.en-any.en 0%[ ] 0 --.-KB/s \r",
"test.en-any.en 100%[===================>] 271.28K --.-KB/s in 0.02s \n",
"\n",
"2019-11-26 13:32:06 (12.5 MB/s) - ‘test.en-any.en’ saved [277791/277791]\n",
"\n",
"--2019-11-26 13:32:09-- https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-fon.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: 206191 (201K) [text/plain]\n",
"Saving to: ‘test.en-fon.en’\n",
"\n",
"test.en-fon.en 100%[===================>] 201.36K --.-KB/s in 0.02s \n",
"\n",
"2019-11-26 13:32:10 (11.5 MB/s) - ‘test.en-fon.en’ saved [206191/206191]\n",
"\n",
"--2019-11-26 13:32:16-- https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-fon.fon\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: 266332 (260K) [text/plain]\n",
"Saving to: ‘test.en-fon.fon’\n",
"\n",
"test.en-fon.fon 100%[===================>] 260.09K --.-KB/s in 0.02s \n",
"\n",
"2019-11-26 13:32:17 (11.2 MB/s) - ‘test.en-fon.fon’ saved [266332/266332]\n",
"\n"
]
}
],
"source": [
"# 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"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"id": "NqDG-CI28y2L",
"outputId": "1cae02eb-e883-4be6-a4ae-a55de11f0b8a"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Loaded 3571 global test sentences to filter from the training/dev data.\n"
]
}
],
"source": [
"# 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))"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 159
},
"colab_type": "code",
"id": "3CNdwLBCfSIl",
"outputId": "a8139b78-0751-4893-91dc-306662889805"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Loaded data and skipped 4199/34746 lines since contained in test set.\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>source_sentence</th>\n",
" <th>target_sentence</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>While reviewing a financial account with his s...</td>\n",
" <td>Hwenu e é ɖò akwɛzinzan ɖé lɛ́n xá gǎn tɔn wɛ ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>The interviewer responded , “ Your way of thin...</td>\n",
" <td>Mɛ e ɖò nǔ kanbyɔ ɛ wɛ é ɖɔ n’i ɖɔ : “ Linlin ...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>One form of dishonesty that is particularly wi...</td>\n",
" <td>Nugbǒmaɖɔ sín alɔkpa e gbakpé tawun ɖò égbé lɛ...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" source_sentence target_sentence\n",
"0 While reviewing a financial account with his s... Hwenu e é ɖò akwɛzinzan ɖé lɛ́n xá gǎn tɔn wɛ ...\n",
"1 The interviewer responded , “ Your way of thin... Mɛ e ɖò nǔ kanbyɔ ɛ wɛ é ɖɔ n’i ɖɔ : “ Linlin ...\n",
"2 One form of dishonesty that is particularly wi... Nugbǒmaɖɔ sín alɔkpa e gbakpé tawun ɖò égbé lɛ..."
]
},
"execution_count": 11,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"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)"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"id": "hvgFJhMy6178",
"outputId": "c6239ec1-8975-462f-d70a-aeb3af66cc03"
},
"outputs": [
{
"data": {
"text/plain": [
"'When two people trust each other , they feel safe and secure .'"
]
},
"execution_count": 15,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"df.source_sentence[10]"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"id": "luzCebRY7FP0",
"outputId": "1a013324-6412-4593-faf7-fff247d3bd86"
},
"outputs": [
{
"data": {
"text/plain": [
"'Hwenu e mɛ wè ɖeji dó yeɖée lɛ wu é ɔ , ayi yetɔn nɔ j’ayǐ dó yeɖée lɛ wu .'"
]
},
"execution_count": 16,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"df.target_sentence[10]"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"id": "TM6Uy1-W7Pxw",
"outputId": "7c13e867-5e88-419e-bbd4-ab5224a29e99"
},
"outputs": [
{
"data": {
"text/plain": [
"30548"
]
},
"execution_count": 14,
"metadata": {
"tags": []
},
"output_type": "execute_result"
}
],
"source": [
"len(df)"
]
},
{
"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",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 187
},
"colab_type": "code",
"id": "M_2ouEOH1_1q",
"outputId": "525b52d6-75d8-48ef-9d07-c169a071f614"
},
"outputs": [
{
"name": "stderr",
"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: http://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: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" import sys\n"
]
}
],
"source": [
"# 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)"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 819
},
"colab_type": "code",
"id": "Z_1BwAApEtMk",
"outputId": "7a7e4433-fe37-4424-d6e9-c4b0b237f648"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting fuzzywuzzy\n",
" Downloading https://files.pythonhosted.org/packages/d8/f1/5a267addb30ab7eaa1beab2b9323073815da4551076554ecc890a3595ec9/fuzzywuzzy-0.17.0-py2.py3-none-any.whl\n",
"Installing collected packages: fuzzywuzzy\n",
"Successfully installed fuzzywuzzy-0.17.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.0MB/s \n",
"\u001b[?25hRequirement already satisfied: setuptools in /usr/local/lib/python3.6/dist-packages (from python-Levenshtein) (41.6.0)\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=144666 sha256=68318040f392110ed6edcb5d5e3370b72f980fb5d1e118d8b8fe41ad12d0eb72\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.02 0.00 percent complete\n",
"00:00:24.63 3.49 percent complete\n",
"00:00:49.66 6.99 percent complete\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '']\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"00:01:16.43 10.48 percent complete\n",
"00:01:41.96 13.97 percent complete\n",
"00:02:06.36 17.47 percent complete\n",
"00:02:30.61 20.96 percent complete\n",
"00:02:55.65 24.45 percent complete\n",
"00:03:19.86 27.95 percent complete\n",
"00:03:45.11 31.44 percent complete\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '*']\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"00:04:09.90 34.93 percent complete\n",
"00:04:36.93 38.43 percent complete\n",
"00:05:01.21 41.92 percent complete\n",
"00:05:25.80 45.41 percent complete\n",
"00:05:50.23 48.91 percent complete\n",
"00:06:15.55 52.40 percent complete\n",
"00:06:39.99 55.89 percent complete\n",
"00:07:05.06 59.39 percent complete\n",
"00:07:29.83 62.88 percent complete\n",
"00:07:56.33 66.37 percent complete\n",
"00:08:20.68 69.87 percent complete\n",
"00:08:45.66 73.36 percent complete\n",
"00:09:10.41 76.85 percent complete\n",
"00:09:35.16 80.35 percent complete\n",
"00:10:00.10 83.84 percent complete\n",
"00:10:24.67 87.33 percent complete\n",
"00:10:49.82 90.83 percent complete\n",
"00:11:16.85 94.32 percent complete\n",
"00:11:41.60 97.81 percent complete\n"
]
}
],
"source": [
"# 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]"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 819
},
"colab_type": "code",
"id": "hxxBOCA-xXhy",
"outputId": "26b4e463-6d02-4a78-8002-2b331efe21f6"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"==> train.en <==\n",
"If we realize that our love for material things is eclipsing our love for the Christ , we should reflect on Jesus ’ words : “ Guard against every sort of greed . ”\n",
"The result ?\n",
"Then my grandmother’s sister , who was over 80 years of age , began to study and was baptized before she died .\n",
"If black Witnesses preached from door to door in a white neighborhood , they would be arrested — and likely beaten up .\n",
"Soon afterward Daniel died .\n",
"At a diplomatic function , Herod clothed himself “ with royal raiment . ”\n",
"( b ) How can we become effective in the ministry ?\n",
"Giving refugees practical help requires , not a lot of money , but mainly our time and concern .\n",
"Jesus gave an illustration about a king who forgave his slave a huge debt of 60,000,000 denarii .\n",
"Jesus explained a principle that helps us to know whom we should obey .\n",
"\n",
"==> train.fon <==\n",
"Nú mǐ ɖó ayi wu ɖɔ wanyiyi e mǐ ɖó nú agbaza sín nǔ lɛ é jɛ ta yí sín wanyiyi e mǐ ɖó nú Klisu é sí jí ɔ , mǐ ɖó na lin nǔ kpɔ́n dó xó e Jezu ɖɔ é jí : “ Mi cɔ́ miɖée dó nukúnkɛ́ndídó wu . ” ( Luk .\n",
"Etɛ ka jɛ túnú tɔn ?\n",
"Gɔ́ na ɔ , mamáa ce sín nagán , ee ko ɖó xwè 80 jɛji é lɔmɔ̌ jɛ Biblu kplɔ́n jí lobo bló baptɛm cobo kú .\n",
"Enyi kúnnuɖetɔ́ mɛwi ɖé ɖò wɛn jla wɛ sín hɔn ɖé kɔn jɛ hɔn ɖé kɔn ɖò yovó lɛ sín xá mɛ ɔ , ye na wlí i bo sixu xò è .\n",
"Enɛ gudo zaan ɔ , Daniel kú .\n",
"Ðó Elodu ɖò tɛn acɛkpikpa tɔn mɛ wutu ɔ , é dó “ axɔsuwu tɔn . ”\n",
"( b ) Nɛ̌ mǐ ka sixu bló gbɔn bɔ sinsɛnzɔ́ mǐtɔn na na sínsɛ́n hugǎn ?\n",
"Alɔ tawun tawun lɛ didó mɛ ɖěɖee hɔn sín tò yetɔn mɛ lɛ é byɔ ɖɔ è ni zán akwɛ gègě ǎ , loɔ , nǔ taji ɔ wɛ nyí ɖɔ mǐ na zán hwenu mǐtɔn bo lɛ́ xlɛ́ ɖɔ nǔ yetɔn nɔ ɖu ayi mɛ nú mǐ .\n",
"Jezu dó lǒ ɖé dó axɔsu e sɔ́ sikágankwɛ 10 000 , alǒ gankwɛ 60 000 000 kɛ mɛsɛntɔ́ tɔn lɛ ɖokpo é wu .\n",
"Jezu tinmɛ nugbodòdó e sixu d’alɔ mǐ bɔ mǐ na tuùn mɛ e mǐ ɖó na setónú na é .\n",
"==> dev.en <==\n",
"I love pioneering in this territory .\n",
"“ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"Before accepting a new assignment , a modest person will first find out what will be required of him .\n",
"Others who had admirable qualities failed to win God’s approval .\n",
"His momentary exuberance was not true joy . — Prov .\n",
"We can see that from the resurrections Jesus performed when outside of Nain and when in the home of Jairus .\n",
"According to Revelation 14 : 6 , 7 , how do angels assist God’s people today ?\n",
"Why do I obey God’s commands rather than imitate the world’s moral standards ?\n",
"\n",
"==> dev.fon <==\n",
"Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"“ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"Cobonu mɛ e nɔ nɔ jlɛ̌ jí é ɖé na yí gbè nú azɔ̌ yɔyɔ̌ ɖé ɔ , é nɔ gbéjé nǔ e azɔ̌ ɔ na byɔ ɖò así tɔn lɛ é kpɔ́n hwɛ̌ .\n",
"Mɛ ɖevo lɛ ka tíìn bo ɖó jijɔ ɖagbe lɛ có , nǔ yetɔn ka nyɔ́ nukún tɔn mɛ ǎ .\n",
"Jo e é ki nú táan kpɛɖé é nyí awǎjijɛ jɔ awǎjijɛ ǎ . — Nùx .\n",
"Mǐ mɔ ɖɔ Jezu fɔ́n mɛ sín kú hwenu e é tɔ́n sín Nayinu é kpo hwenu e é ɖò Jayilɔsi xwé é kpo .\n",
"Sɔgbe xá nǔ e Nǔɖexlɛ́mɛ 14 : 6 , 7 ɖɔ é ɔ , nɛ̌ wɛnsagun lɛ ka nɔ d’alɔ togun Mawu tɔn gbɔn ɖò égbé ?\n",
"Etɛwu un ka nɔ nyì sɛ́n Mawu tɔn lɛ , bo ma nɔ wà nǔ gbɛ̀ ɔ ɖɔhun ǎ ?\n"
]
}
],
"source": [
"# 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.*"
]
},
{
"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",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"colab_type": "code",
"id": "iBRMm4kMxZ8L",
"outputId": "71b591b8-0d99-43aa-f08a-4f3f6cd87998"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Cloning into 'joeynmt'...\n",
"remote: Enumerating objects: 15, done.\u001b[K\n",
"remote: Counting objects: 6% (1/15)\u001b[K\r",
"remote: Counting objects: 13% (2/15)\u001b[K\r",
"remote: Counting objects: 20% (3/15)\u001b[K\r",
"remote: Counting objects: 26% (4/15)\u001b[K\r",
"remote: Counting objects: 33% (5/15)\u001b[K\r",
"remote: Counting objects: 40% (6/15)\u001b[K\r",
"remote: Counting objects: 46% (7/15)\u001b[K\r",
"remote: Counting objects: 53% (8/15)\u001b[K\r",
"remote: Counting objects: 60% (9/15)\u001b[K\r",
"remote: Counting objects: 66% (10/15)\u001b[K\r",
"remote: Counting objects: 73% (11/15)\u001b[K\r",
"remote: Counting objects: 80% (12/15)\u001b[K\r",
"remote: Counting objects: 86% (13/15)\u001b[K\r",
"remote: Counting objects: 93% (14/15)\u001b[K\r",
"remote: Counting objects: 100% (15/15)\u001b[K\r",
"remote: Counting objects: 100% (15/15), done.\u001b[K\n",
"remote: Compressing objects: 100% (12/12), done.\u001b[K\n",
"remote: Total 2199 (delta 4), reused 5 (delta 3), pack-reused 2184\u001b[K\n",
"Receiving objects: 100% (2199/2199), 2.60 MiB | 4.29 MiB/s, done.\n",
"Resolving deltas: 100% (1525/1525), 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) (4.3.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.17.4)\n",
"Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (41.6.0)\n",
"Requirement already satisfied: torch>=1.1 in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (1.3.1)\n",
"Requirement already satisfied: tensorflow>=1.14 in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (1.15.0)\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",
" Downloading https://files.pythonhosted.org/packages/0e/e5/93d252182f7cbd4b59bb3ec5797e2ce33cfd6f5aadaf327db170cf4b7887/sacrebleu-1.4.2-py3-none-any.whl\n",
"Collecting 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.1.1)\n",
"Requirement already satisfied: seaborn in /usr/local/lib/python3.6/dist-packages (from joeynmt==0.0.1) (0.9.0)\n",
"Collecting pyyaml>=5.1\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/e3/e8/b3212641ee2718d556df0f23f78de8303f068fe29cdaa7a91018849582fe/PyYAML-5.1.2.tar.gz (265kB)\n",
"\u001b[K |████████████████████████████████| 266kB 16.9MB/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 49.9MB/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",
"Requirement already satisfied: olefile in /usr/local/lib/python3.6/dist-packages (from pillow->joeynmt==0.0.1) (0.46)\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.8.1)\n",
"Requirement already satisfied: keras-preprocessing>=1.0.5 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.1.0)\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: grpcio>=1.8.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.15.0)\n",
"Requirement already satisfied: keras-applications>=1.0.8 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.0.8)\n",
"Requirement already satisfied: tensorboard<1.16.0,>=1.15.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.15.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.1.0)\n",
"Requirement already satisfied: astor>=0.6.0 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (0.8.0)\n",
"Requirement already satisfied: google-pasta>=0.1.6 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (0.1.8)\n",
"Requirement already satisfied: gast==0.2.2 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (0.2.2)\n",
"Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (0.33.6)\n",
"Requirement already satisfied: wrapt>=1.11.1 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.11.2)\n",
"Requirement already satisfied: tensorflow-estimator==1.15.1 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (1.15.1)\n",
"Requirement already satisfied: protobuf>=3.6.1 in /usr/local/lib/python3.6/dist-packages (from tensorflow>=1.14->joeynmt==0.0.1) (3.10.0)\n",
"Requirement already satisfied: tqdm in /usr/local/lib/python3.6/dist-packages (from torchtext->joeynmt==0.0.1) (4.28.1)\n",
"Requirement already satisfied: requests in /usr/local/lib/python3.6/dist-packages (from torchtext->joeynmt==0.0.1) (2.21.0)\n",
"Collecting portalocker\n",
" Downloading https://files.pythonhosted.org/packages/91/db/7bc703c0760df726839e0699b7f78a4d8217fdc9c7fcb1b51b39c5a22a4e/portalocker-1.5.2-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: kiwisolver>=1.0.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->joeynmt==0.0.1) (1.1.0)\n",
"Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->joeynmt==0.0.1) (2.6.1)\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: 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.5)\n",
"Requirement already satisfied: scipy>=0.14.0 in /usr/local/lib/python3.6/dist-packages (from seaborn->joeynmt==0.0.1) (1.3.2)\n",
"Requirement already satisfied: pandas>=0.15.2 in /usr/local/lib/python3.6/dist-packages (from seaborn->joeynmt==0.0.1) (0.25.3)\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 51.0MB/s \n",
"\u001b[?25hCollecting 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 6.5MB/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",
"Requirement already satisfied: h5py in /usr/local/lib/python3.6/dist-packages (from keras-applications>=1.0.8->tensorflow>=1.14->joeynmt==0.0.1) (2.8.0)\n",
"Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.6/dist-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow>=1.14->joeynmt==0.0.1) (3.1.1)\n",
"Requirement already satisfied: werkzeug>=0.11.15 in /usr/local/lib/python3.6/dist-packages (from tensorboard<1.16.0,>=1.15.0->tensorflow>=1.14->joeynmt==0.0.1) (0.16.0)\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: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests->torchtext->joeynmt==0.0.1) (2019.9.11)\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: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas>=0.15.2->seaborn->joeynmt==0.0.1) (2018.9)\n",
"Collecting typed-ast<1.5,>=1.4.0; implementation_name == \"cpython\" and python_version < \"3.8\"\n",
"\u001b[?25l Downloading https://files.pythonhosted.org/packages/31/d3/9d1802c161626d0278bafb1ffb32f76b9d01e123881bbf9d91e8ccf28e18/typed_ast-1.4.0-cp36-cp36m-manylinux1_x86_64.whl (736kB)\n",
"\u001b[K |████████████████████████████████| 737kB 45.8MB/s \n",
"\u001b[?25hCollecting 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 7.8MB/s \n",
"\u001b[?25hBuilding wheels for collected packages: joeynmt, pyyaml\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=72136 sha256=d117593e05da9e532a469ebc2f269231fc80415f40bc9d316cda47919044b9b5\n",
" Stored in directory: /tmp/pip-ephem-wheel-cache-4hxgsvsh/wheels/db/01/db/751cc9f3e7f6faec127c43644ba250a3ea7ad200594aeda70a\n",
" Building wheel for pyyaml (setup.py) ... \u001b[?25l\u001b[?25hdone\n",
" Created wheel for pyyaml: filename=PyYAML-5.1.2-cp36-cp36m-linux_x86_64.whl size=44104 sha256=fb52239eedec1192734b9c05b0e67ddb748b25e86c2a5c09a444c72e1b0bf831\n",
" Stored in directory: /root/.cache/pip/wheels/d9/45/dd/65f0b38450c47cf7e5312883deb97d065e030c5cca0a365030\n",
"Successfully built joeynmt pyyaml\n",
"Installing collected packages: portalocker, sacrebleu, subword-nmt, pyyaml, typed-ast, lazy-object-proxy, astroid, isort, mccabe, pylint, joeynmt\n",
" Found existing installation: PyYAML 3.13\n",
" Uninstalling PyYAML-3.13:\n",
" Successfully uninstalled PyYAML-3.13\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 portalocker-1.5.2 pylint-2.4.4 pyyaml-5.1.2 sacrebleu-1.4.2 subword-nmt-0.3.7 typed-ast-1.4.0\n"
]
}
],
"source": [
"# Install JoeyNMT\n",
"! git clone https://github.com/joeynmt/joeynmt.git\n",
"! cd joeynmt; pip3 install ."
]
},
{
"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",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 408
},
"colab_type": "code",
"id": "H-TyjtmXB1mL",
"outputId": "4f85916b-5a94-419d-94c7-296f3e65c729"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bpe.codes.4000\tdev.en\t test.bpe.fon test.fon\t train.en\n",
"dev.bpe.en\tdev.fon test.en\t train.bpe.en train.fon\n",
"dev.bpe.fon\ttest.bpe.en test.en-any.en train.bpe.fon\n",
"bpe.codes.4000\tdev.en\t test.bpe.fon test.fon\t train.en\n",
"dev.bpe.en\tdev.fon test.en\t train.bpe.en train.fon\n",
"dev.bpe.fon\ttest.bpe.en test.en-any.en train.bpe.fon\n",
"BPE Xhosa Sentences\n",
"Ðɛhan 6@@ 4 : 2 - 5 d’alɔ mì bɔ un mɔ ɖɔ un kún jló na nɔ mɛ ɖěɖee mɛ ɖevo lɛ nɔ xoɖɛ ɖɔ Mawu ni hwlɛn emi ɖò ye sí é mɛ ó !\n",
"Un lɛ́vɔ wá mɔ nukúnnú jɛ wu ɖɔ enyi un kpò ɖò mɛ nú ɖɔ wɛ ɔ , un kún nyí kpɔ́ndéwú ɖagbe ɖé ó , b’ɛ na lɛ́ hɛn nyikɔ Jehovah tɔn k@@ wi@@ ji . ”\n",
"Lin@@ da : “ Un xà t@@ l@@ ati mǐtɔn lɛ ganji bo na dó sixu sɔnǔ bá xwlé ye mɛ .\n",
"Gbɛ@@ ̌@@ dido xá mɛ ɖěɖee nɔ ɖ’alɔ ɖò sinsɛnzɔ́ ɔ sín akpáxwé vovo lɛ mɛ é ko d’alɔ mì tawun .\n",
"Un lɛ́ kpó ɖò ɖɛ xò sɛ́dó Jehovah wɛ bo ganjɛ wǔ tɔn . ”\n",
"Combined BPE Vocab\n",
"Tod@@\n",
"righte@@\n",
"xamu\n",
"usal@@\n",
"Mɔyiz@@\n",
"ɔ́nd@@\n",
"fín@@\n",
"wɛli\n",
"ɔlu\n",
"mpli\n"
]
}
],
"source": [
"# 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 joeynmt/data/$src$tgt/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 joeynmt/data/$src$tgt/vocab.txt # Herman"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 68
},
"colab_type": "code",
"id": "IlMitUHR8Qy-",
"outputId": "9aa9345d-ad89-48ba-e9c6-03822b4d45e4"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"bpe.codes.4000\tdev.en\t test.bpe.fon test.fon\t train.en\n",
"dev.bpe.en\tdev.fon test.en\t train.bpe.en train.fon\n",
"dev.bpe.fon\ttest.bpe.en test.en-any.en train.bpe.fon\n"
]
}
],
"source": [
"# 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\""
]
},
{
"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",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "PIs1lY2hxMsl"
},
"outputs": [],
"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: \"data/{name}/train.bpe\"\n",
" dev: \"data/{name}/dev.bpe\"\n",
" test: \"data/{name}/test.bpe\"\n",
" level: \"bpe\"\n",
" lowercase: False\n",
" max_sent_length: 100\n",
" src_vocab: \"data/{name}/vocab.txt\"\n",
" trg_vocab: \"data/{name}/vocab.txt\"\n",
"\n",
"testing:\n",
" beam_size: 5\n",
" alpha: 1.0\n",
"\n",
"training:\n",
" #load_model: \"{gdrive_path}/models/{name}_transformer/1.ckpt\" # if uncommented, load a pre-trained model from this 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: 30 # 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: \"models/{name}_transformer\"\n",
" overwrite: False # 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)\n",
"with open(\"joeynmt/configs/transformer_{name}.yaml\".format(name=name),'w') as f:\n",
" f.write(config)"
]
},
{
"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",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
},
"colab_type": "code",
"id": "6ZBPFwT94WpI",
"outputId": "9d1ffcd3-3a70-45da-f734-0f532d14cb30"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2019-11-26 14:00:30,601 Hello! This is Joey-NMT.\n",
"2019-11-26 14:00:32,457 Total params: 12131328\n",
"2019-11-26 14:00:32,459 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",
"2019-11-26 14:00:38,324 cfg.name : enfon_transformer\n",
"2019-11-26 14:00:38,324 cfg.data.src : en\n",
"2019-11-26 14:00:38,324 cfg.data.trg : fon\n",
"2019-11-26 14:00:38,324 cfg.data.train : data/enfon/train.bpe\n",
"2019-11-26 14:00:38,325 cfg.data.dev : data/enfon/dev.bpe\n",
"2019-11-26 14:00:38,325 cfg.data.test : data/enfon/test.bpe\n",
"2019-11-26 14:00:38,325 cfg.data.level : bpe\n",
"2019-11-26 14:00:38,325 cfg.data.lowercase : False\n",
"2019-11-26 14:00:38,325 cfg.data.max_sent_length : 100\n",
"2019-11-26 14:00:38,325 cfg.data.src_vocab : data/enfon/vocab.txt\n",
"2019-11-26 14:00:38,325 cfg.data.trg_vocab : data/enfon/vocab.txt\n",
"2019-11-26 14:00:38,325 cfg.testing.beam_size : 5\n",
"2019-11-26 14:00:38,325 cfg.testing.alpha : 1.0\n",
"2019-11-26 14:00:38,325 cfg.training.random_seed : 42\n",
"2019-11-26 14:00:38,326 cfg.training.optimizer : adam\n",
"2019-11-26 14:00:38,326 cfg.training.normalization : tokens\n",
"2019-11-26 14:00:38,326 cfg.training.adam_betas : [0.9, 0.999]\n",
"2019-11-26 14:00:38,326 cfg.training.scheduling : plateau\n",
"2019-11-26 14:00:38,326 cfg.training.patience : 5\n",
"2019-11-26 14:00:38,326 cfg.training.learning_rate_factor : 0.5\n",
"2019-11-26 14:00:38,326 cfg.training.learning_rate_warmup : 1000\n",
"2019-11-26 14:00:38,326 cfg.training.decrease_factor : 0.7\n",
"2019-11-26 14:00:38,326 cfg.training.loss : crossentropy\n",
"2019-11-26 14:00:38,326 cfg.training.learning_rate : 0.0003\n",
"2019-11-26 14:00:38,327 cfg.training.learning_rate_min : 1e-08\n",
"2019-11-26 14:00:38,327 cfg.training.weight_decay : 0.0\n",
"2019-11-26 14:00:38,327 cfg.training.label_smoothing : 0.1\n",
"2019-11-26 14:00:38,327 cfg.training.batch_size : 4096\n",
"2019-11-26 14:00:38,327 cfg.training.batch_type : token\n",
"2019-11-26 14:00:38,327 cfg.training.eval_batch_size : 3600\n",
"2019-11-26 14:00:38,327 cfg.training.eval_batch_type : token\n",
"2019-11-26 14:00:38,327 cfg.training.batch_multiplier : 1\n",
"2019-11-26 14:00:38,327 cfg.training.early_stopping_metric : ppl\n",
"2019-11-26 14:00:38,327 cfg.training.epochs : 30\n",
"2019-11-26 14:00:38,328 cfg.training.validation_freq : 1000\n",
"2019-11-26 14:00:38,328 cfg.training.logging_freq : 100\n",
"2019-11-26 14:00:38,328 cfg.training.eval_metric : bleu\n",
"2019-11-26 14:00:38,328 cfg.training.model_dir : models/enfon_transformer\n",
"2019-11-26 14:00:38,328 cfg.training.overwrite : False\n",
"2019-11-26 14:00:38,328 cfg.training.shuffle : True\n",
"2019-11-26 14:00:38,328 cfg.training.use_cuda : True\n",
"2019-11-26 14:00:38,328 cfg.training.max_output_length : 100\n",
"2019-11-26 14:00:38,328 cfg.training.print_valid_sents : [0, 1, 2, 3]\n",
"2019-11-26 14:00:38,328 cfg.training.keep_last_ckpts : 3\n",
"2019-11-26 14:00:38,329 cfg.model.initializer : xavier\n",
"2019-11-26 14:00:38,329 cfg.model.bias_initializer : zeros\n",
"2019-11-26 14:00:38,329 cfg.model.init_gain : 1.0\n",
"2019-11-26 14:00:38,329 cfg.model.embed_initializer : xavier\n",
"2019-11-26 14:00:38,329 cfg.model.embed_init_gain : 1.0\n",
"2019-11-26 14:00:38,329 cfg.model.tied_embeddings : True\n",
"2019-11-26 14:00:38,329 cfg.model.tied_softmax : True\n",
"2019-11-26 14:00:38,329 cfg.model.encoder.type : transformer\n",
"2019-11-26 14:00:38,329 cfg.model.encoder.num_layers : 6\n",
"2019-11-26 14:00:38,329 cfg.model.encoder.num_heads : 4\n",
"2019-11-26 14:00:38,330 cfg.model.encoder.embeddings.embedding_dim : 256\n",
"2019-11-26 14:00:38,330 cfg.model.encoder.embeddings.scale : True\n",
"2019-11-26 14:00:38,330 cfg.model.encoder.embeddings.dropout : 0.2\n",
"2019-11-26 14:00:38,330 cfg.model.encoder.hidden_size : 256\n",
"2019-11-26 14:00:38,330 cfg.model.encoder.ff_size : 1024\n",
"2019-11-26 14:00:38,330 cfg.model.encoder.dropout : 0.3\n",
"2019-11-26 14:00:38,330 cfg.model.decoder.type : transformer\n",
"2019-11-26 14:00:38,330 cfg.model.decoder.num_layers : 6\n",
"2019-11-26 14:00:38,330 cfg.model.decoder.num_heads : 4\n",
"2019-11-26 14:00:38,330 cfg.model.decoder.embeddings.embedding_dim : 256\n",
"2019-11-26 14:00:38,331 cfg.model.decoder.embeddings.scale : True\n",
"2019-11-26 14:00:38,331 cfg.model.decoder.embeddings.dropout : 0.2\n",
"2019-11-26 14:00:38,331 cfg.model.decoder.hidden_size : 256\n",
"2019-11-26 14:00:38,331 cfg.model.decoder.ff_size : 1024\n",
"2019-11-26 14:00:38,331 cfg.model.decoder.dropout : 0.3\n",
"2019-11-26 14:00:38,331 Data set sizes: \n",
"\ttrain 27510,\n",
"\tvalid 1000,\n",
"\ttest 2713\n",
"2019-11-26 14:00:38,331 First training example:\n",
"\t[SRC] If we reali@@ ze that our love for material things is ec@@ li@@ p@@ sing our love for the Christ , we should reflect on Jesus ’ words : “ Gu@@ ard against every sor@@ t of gre@@ ed . ”\n",
"\t[TRG] Nú mǐ ɖó ayi wu ɖɔ wanyiyi e mǐ ɖó nú agbaza sín nǔ lɛ é jɛ ta yí sín wanyiyi e mǐ ɖó nú Klisu é sí jí ɔ , mǐ ɖó na lin nǔ kpɔ́n dó xó e Jezu ɖɔ é jí : “ Mi cɔ́ miɖée dó nukún@@ k@@ ɛ́n@@ dí@@ dó wu . ” ( Luk .\n",
"2019-11-26 14:00:38,331 First 10 words (src): (0) <unk> (1) <pad> (2) <s> (3) </s> (4) . (5) , (6) é (7) lɛ (8) ɔ (9) the\n",
"2019-11-26 14:00:38,332 First 10 words (trg): (0) <unk> (1) <pad> (2) <s> (3) </s> (4) . (5) , (6) é (7) lɛ (8) ɔ (9) the\n",
"2019-11-26 14:00:38,332 Number of Src words (types): 4184\n",
"2019-11-26 14:00:38,333 Number of Trg words (types): 4184\n",
"2019-11-26 14:00:38,333 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=4184),\n",
"\ttrg_embed=Embeddings(embedding_dim=256, vocab_size=4184))\n",
"2019-11-26 14:00:38,337 EPOCH 1\n",
"2019-11-26 14:01:08,765 Epoch 1 Step: 100 Batch Loss: 5.094642 Tokens per Sec: 7341, Lr: 0.000300\n",
"2019-11-26 14:01:39,090 Epoch 1 Step: 200 Batch Loss: 4.815321 Tokens per Sec: 7525, Lr: 0.000300\n",
"2019-11-26 14:02:09,438 Epoch 1 Step: 300 Batch Loss: 4.436522 Tokens per Sec: 7544, Lr: 0.000300\n",
"2019-11-26 14:02:26,611 Epoch 1: total training loss 1742.23\n",
"2019-11-26 14:02:26,612 EPOCH 2\n",
"2019-11-26 14:02:39,620 Epoch 2 Step: 400 Batch Loss: 4.331379 Tokens per Sec: 7479, Lr: 0.000300\n",
"2019-11-26 14:03:09,957 Epoch 2 Step: 500 Batch Loss: 4.236403 Tokens per Sec: 7448, Lr: 0.000300\n",
"2019-11-26 14:03:40,305 Epoch 2 Step: 600 Batch Loss: 3.822441 Tokens per Sec: 7380, Lr: 0.000300\n",
"2019-11-26 14:04:10,836 Epoch 2 Step: 700 Batch Loss: 3.890893 Tokens per Sec: 7423, Lr: 0.000300\n",
"2019-11-26 14:04:14,880 Epoch 2: total training loss 1396.25\n",
"2019-11-26 14:04:14,880 EPOCH 3\n",
"2019-11-26 14:04:41,409 Epoch 3 Step: 800 Batch Loss: 3.255218 Tokens per Sec: 7376, Lr: 0.000300\n",
"2019-11-26 14:05:11,843 Epoch 3 Step: 900 Batch Loss: 3.479604 Tokens per Sec: 7369, Lr: 0.000300\n",
"2019-11-26 14:05:42,564 Epoch 3 Step: 1000 Batch Loss: 3.530126 Tokens per Sec: 7480, Lr: 0.000300\n",
"2019-11-26 14:07:15,329 Hooray! New best validation result [ppl]!\n",
"2019-11-26 14:07:15,329 Saving new checkpoint.\n",
"2019-11-26 14:07:15,584 Example #0\n",
"2019-11-26 14:07:15,585 \tSource: I love pioneering in this territory .\n",
"2019-11-26 14:07:15,585 \tReference: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 14:07:15,585 \tHypothesis: É ɖò wɛn ɖɔ é ni mɔ nǔ e ɖò sinsɛnzɔ́ ɔ mɛ é .\n",
"2019-11-26 14:07:15,585 Example #1\n",
"2019-11-26 14:07:15,586 \tSource: “ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"2019-11-26 14:07:15,586 \tReference: “ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"2019-11-26 14:07:15,586 \tHypothesis: “ Un nɔ wà nǔ e ɖò sinsɛnzɔ́ ɔ mɛ lɛ é , bo nɔ nɔ wà nǔ e ɖò gbɛ̀ ɔ mɛ lɛ é .\n",
"2019-11-26 14:07:15,586 Example #2\n",
"2019-11-26 14:07:15,586 \tSource: Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"2019-11-26 14:07:15,586 \tReference: Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"2019-11-26 14:07:15,587 \tHypothesis: É ɖò wɛn ɖɔ xó dó wusyɛn lanmɛ nú mɛ e ɖò agun tɔn mɛ lɛ é jí , bɔ ye na nɔ wà nǔ e ɖò sinsɛnzɔ́ ɔ mɛ lɛ é .\n",
"2019-11-26 14:07:15,587 Example #3\n",
"2019-11-26 14:07:15,587 \tSource: You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"2019-11-26 14:07:15,587 \tReference: 1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"2019-11-26 14:07:15,587 \tHypothesis: É ɖò wɛn ɖɔ xó dó wusyɛn lanmɛ nú mɛ e ɖò sinsɛnzɔ́ ɔ mɛ é .\n",
"2019-11-26 14:07:15,587 Validation result (greedy) at epoch 3, step 1000: bleu: 2.72, loss: 99911.8359, ppl: 29.0535, duration: 93.0228s\n",
"2019-11-26 14:07:36,428 Epoch 3: total training loss 1254.81\n",
"2019-11-26 14:07:36,429 EPOCH 4\n",
"2019-11-26 14:07:45,842 Epoch 4 Step: 1100 Batch Loss: 3.662204 Tokens per Sec: 7252, Lr: 0.000300\n",
"2019-11-26 14:08:16,145 Epoch 4 Step: 1200 Batch Loss: 3.202804 Tokens per Sec: 7434, Lr: 0.000300\n",
"2019-11-26 14:08:46,301 Epoch 4 Step: 1300 Batch Loss: 3.270840 Tokens per Sec: 7407, Lr: 0.000300\n",
"2019-11-26 14:09:16,542 Epoch 4 Step: 1400 Batch Loss: 3.876655 Tokens per Sec: 7399, Lr: 0.000300\n",
"2019-11-26 14:09:25,135 Epoch 4: total training loss 1181.73\n",
"2019-11-26 14:09:25,135 EPOCH 5\n",
"2019-11-26 14:09:47,196 Epoch 5 Step: 1500 Batch Loss: 3.134502 Tokens per Sec: 7454, Lr: 0.000300\n",
"2019-11-26 14:10:17,600 Epoch 5 Step: 1600 Batch Loss: 3.284228 Tokens per Sec: 7403, Lr: 0.000300\n",
"2019-11-26 14:10:48,127 Epoch 5 Step: 1700 Batch Loss: 2.819642 Tokens per Sec: 7404, Lr: 0.000300\n",
"2019-11-26 14:11:13,530 Epoch 5: total training loss 1100.60\n",
"2019-11-26 14:11:13,530 EPOCH 6\n",
"2019-11-26 14:11:18,464 Epoch 6 Step: 1800 Batch Loss: 3.228624 Tokens per Sec: 7396, Lr: 0.000300\n",
"2019-11-26 14:11:48,768 Epoch 6 Step: 1900 Batch Loss: 2.696800 Tokens per Sec: 7410, Lr: 0.000300\n",
"2019-11-26 14:12:19,085 Epoch 6 Step: 2000 Batch Loss: 2.260545 Tokens per Sec: 7352, Lr: 0.000300\n",
"2019-11-26 14:13:52,290 Hooray! New best validation result [ppl]!\n",
"2019-11-26 14:13:52,291 Saving new checkpoint.\n",
"2019-11-26 14:13:52,551 Example #0\n",
"2019-11-26 14:13:52,551 \tSource: I love pioneering in this territory .\n",
"2019-11-26 14:13:52,551 \tReference: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 14:13:52,552 \tHypothesis: Un nɔ mɔ ɖɔ emi kún nɔ wà mɔ̌ ó .\n",
"2019-11-26 14:13:52,552 Example #1\n",
"2019-11-26 14:13:52,552 \tSource: “ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"2019-11-26 14:13:52,552 \tReference: “ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"2019-11-26 14:13:52,552 \tHypothesis: “ Mi nú mǐ ni kpɔ́n nǔ e mǐ nɔ wà nú mɛ e ɖò nǔ e ɖò nukún wɛ lɛ é jí , bo ɖɔ : “ Mi nú mǐ ni nɔ gbeji nú Jehovah , bo nɔ lɛ́ mɔ nǔ e mǐ nɔ wà é . ”\n",
"2019-11-26 14:13:52,552 Example #2\n",
"2019-11-26 14:13:52,553 \tSource: Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"2019-11-26 14:13:52,553 \tReference: Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"2019-11-26 14:13:52,553 \tHypothesis: Hwenu e è nɔ dó wusyɛn lanmɛ nú mɛ ɖevo lɛ é ɔ , ye nɔ mɔ ɖɔ emi kún nɔ mɔ ɖɔ emi kún nɔ wà nǔ xá emi ó .\n",
"2019-11-26 14:13:52,553 Example #3\n",
"2019-11-26 14:13:52,553 \tSource: You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"2019-11-26 14:13:52,553 \tReference: 1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"2019-11-26 14:13:52,553 \tHypothesis: A na ɖɔ xó dó nǔ e wu è na dó é wu ɖɔ xó dó é wu .\n",
"2019-11-26 14:13:52,554 Validation result (greedy) at epoch 6, step 2000: bleu: 5.03, loss: 83836.4688, ppl: 16.8957, duration: 93.4679s\n",
"2019-11-26 14:14:23,173 Epoch 6 Step: 2100 Batch Loss: 2.636636 Tokens per Sec: 7366, Lr: 0.000300\n",
"2019-11-26 14:14:36,074 Epoch 6: total training loss 1045.85\n",
"2019-11-26 14:14:36,074 EPOCH 7\n",
"2019-11-26 14:14:53,904 Epoch 7 Step: 2200 Batch Loss: 3.124637 Tokens per Sec: 7297, Lr: 0.000300\n",
"2019-11-26 14:15:24,789 Epoch 7 Step: 2300 Batch Loss: 2.172596 Tokens per Sec: 7446, Lr: 0.000300\n",
"2019-11-26 14:15:55,324 Epoch 7 Step: 2400 Batch Loss: 2.914614 Tokens per Sec: 7257, Lr: 0.000300\n",
"2019-11-26 14:16:25,749 Epoch 7: total training loss 990.90\n",
"2019-11-26 14:16:25,749 EPOCH 8\n",
"2019-11-26 14:16:26,109 Epoch 8 Step: 2500 Batch Loss: 2.662452 Tokens per Sec: 6874, Lr: 0.000300\n",
"2019-11-26 14:16:56,653 Epoch 8 Step: 2600 Batch Loss: 2.515854 Tokens per Sec: 7351, Lr: 0.000300\n",
"2019-11-26 14:17:27,406 Epoch 8 Step: 2700 Batch Loss: 2.303658 Tokens per Sec: 7268, Lr: 0.000300\n",
"2019-11-26 14:17:58,354 Epoch 8 Step: 2800 Batch Loss: 2.409138 Tokens per Sec: 7174, Lr: 0.000300\n",
"2019-11-26 14:18:16,437 Epoch 8: total training loss 958.06\n",
"2019-11-26 14:18:16,438 EPOCH 9\n",
"2019-11-26 14:18:29,356 Epoch 9 Step: 2900 Batch Loss: 2.426154 Tokens per Sec: 7355, Lr: 0.000300\n",
"2019-11-26 14:18:59,974 Epoch 9 Step: 3000 Batch Loss: 2.670738 Tokens per Sec: 7273, Lr: 0.000300\n",
"2019-11-26 14:20:33,350 Hooray! New best validation result [ppl]!\n",
"2019-11-26 14:20:33,351 Saving new checkpoint.\n",
"2019-11-26 14:20:33,598 Example #0\n",
"2019-11-26 14:20:33,598 \tSource: I love pioneering in this territory .\n",
"2019-11-26 14:20:33,599 \tReference: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 14:20:33,599 \tHypothesis: Un nɔ wà sinsɛnzɔ́ ɖò sinsɛnzɔ́ ɔ mɛ ɖò sinsɛnzɔ́ ɔ mɛ .\n",
"2019-11-26 14:20:33,599 Example #1\n",
"2019-11-26 14:20:33,600 \tSource: “ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"2019-11-26 14:20:33,600 \tReference: “ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"2019-11-26 14:20:33,600 \tHypothesis: “ Ahwanvu ” wɛ nyí ɖɔ è ni “ nɔ “ nɔ ” bo nɔ “ nɔ dó gbɔ nú Jehovah , bo nɔ lɛ́ nɔ gbeji nú Jehovah .\n",
"2019-11-26 14:20:33,600 Example #2\n",
"2019-11-26 14:20:33,600 \tSource: Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"2019-11-26 14:20:33,601 \tReference: Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"2019-11-26 14:20:33,601 \tHypothesis: Mɛjitɔ́ Klisanwun lɛ nɔ ɖó nukún ɖɔ mɛ winnyawinnya lɛ ni nɔ mɔ ɖɔ emi kún nɔ mɔ ɖɔ emi kún na wà nǔ e ye ɖó é ó .\n",
"2019-11-26 14:20:33,601 Example #3\n",
"2019-11-26 14:20:33,602 \tSource: You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"2019-11-26 14:20:33,602 \tReference: 1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"2019-11-26 14:20:33,602 \tHypothesis: ( Jaan 3 : 1 - 14 ) É ɖò wɛn ɖɔ è na ko ɖɔ xó dó mɛsɛ́dó Pɔlu wu ɖɔ : “ Mɛ e ɖò kú wɛ lɛ é .\n",
"2019-11-26 14:20:33,602 Validation result (greedy) at epoch 9, step 3000: bleu: 8.59, loss: 74603.6562, ppl: 12.3755, duration: 93.6282s\n",
"2019-11-26 14:21:04,261 Epoch 9 Step: 3100 Batch Loss: 2.652828 Tokens per Sec: 7283, Lr: 0.000300\n",
"2019-11-26 14:21:34,968 Epoch 9 Step: 3200 Batch Loss: 2.133620 Tokens per Sec: 7516, Lr: 0.000300\n",
"2019-11-26 14:21:39,535 Epoch 9: total training loss 911.46\n",
"2019-11-26 14:21:39,536 EPOCH 10\n",
"2019-11-26 14:22:05,404 Epoch 10 Step: 3300 Batch Loss: 2.298213 Tokens per Sec: 7238, Lr: 0.000300\n",
"2019-11-26 14:22:35,769 Epoch 10 Step: 3400 Batch Loss: 2.885549 Tokens per Sec: 7437, Lr: 0.000300\n",
"2019-11-26 14:23:06,231 Epoch 10 Step: 3500 Batch Loss: 2.850529 Tokens per Sec: 7403, Lr: 0.000300\n",
"2019-11-26 14:23:28,448 Epoch 10: total training loss 885.28\n",
"2019-11-26 14:23:28,448 EPOCH 11\n",
"2019-11-26 14:23:36,374 Epoch 11 Step: 3600 Batch Loss: 2.306839 Tokens per Sec: 7311, Lr: 0.000300\n",
"2019-11-26 14:24:06,560 Epoch 11 Step: 3700 Batch Loss: 2.788274 Tokens per Sec: 7385, Lr: 0.000300\n",
"2019-11-26 14:24:37,391 Epoch 11 Step: 3800 Batch Loss: 2.138618 Tokens per Sec: 7420, Lr: 0.000300\n",
"2019-11-26 14:25:07,753 Epoch 11 Step: 3900 Batch Loss: 2.272465 Tokens per Sec: 7262, Lr: 0.000300\n",
"2019-11-26 14:25:17,967 Epoch 11: total training loss 853.94\n",
"2019-11-26 14:25:17,968 EPOCH 12\n",
"2019-11-26 14:25:38,922 Epoch 12 Step: 4000 Batch Loss: 2.089157 Tokens per Sec: 7291, Lr: 0.000300\n",
"2019-11-26 14:27:12,572 Hooray! New best validation result [ppl]!\n",
"2019-11-26 14:27:12,572 Saving new checkpoint.\n",
"2019-11-26 14:27:12,857 Example #0\n",
"2019-11-26 14:27:12,857 \tSource: I love pioneering in this territory .\n",
"2019-11-26 14:27:12,858 \tReference: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 14:27:12,858 \tHypothesis: Un yí wǎn nú sinsɛnzɔ́ ɔ ɖò fí e un nɔ wà ɖò tò enɛ mɛ é .\n",
"2019-11-26 14:27:12,858 Example #1\n",
"2019-11-26 14:27:12,858 \tSource: “ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"2019-11-26 14:27:12,858 \tReference: “ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"2019-11-26 14:27:12,858 \tHypothesis: “ Akpá e è wlan dó “ mɛ e ɖò nǔ kplɔ́n wɛ ” é ” ɔ , mǐ sixu mɔ ɖɔ Jehovah na “ nɔ gbeji nú Jehovah .\n",
"2019-11-26 14:27:12,858 Example #2\n",
"2019-11-26 14:27:12,859 \tSource: Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"2019-11-26 14:27:12,859 \tReference: Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"2019-11-26 14:27:12,859 \tHypothesis: Mɛjitɔ́ Klisanwun ɖé lɛ nɔ ɖó nukún ɖɔ vǐ yetɔn lɛ nɔ mɔ nukúnnú jɛ nugbǒ ɔ mɛ , bo nɔ mɔ ɖɔ emi ɖó na mɔ nugbǒ nugbǒ ɔ .\n",
"2019-11-26 14:27:12,859 Example #3\n",
"2019-11-26 14:27:12,860 \tSource: You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"2019-11-26 14:27:12,860 \tReference: 1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"2019-11-26 14:27:12,860 \tHypothesis: É ɖò wɛn ɖɔ a tuùn Jwifu Jwifu lɛ tɔn e ko tuùn Timɔtée é ɖé .\n",
"2019-11-26 14:27:12,860 Validation result (greedy) at epoch 12, step 4000: bleu: 12.24, loss: 68261.9844, ppl: 9.9929, duration: 93.9380s\n",
"2019-11-26 14:27:43,810 Epoch 12 Step: 4100 Batch Loss: 1.972761 Tokens per Sec: 7340, Lr: 0.000300\n",
"2019-11-26 14:28:14,582 Epoch 12 Step: 4200 Batch Loss: 2.161382 Tokens per Sec: 7339, Lr: 0.000300\n",
"2019-11-26 14:28:41,368 Epoch 12: total training loss 826.62\n",
"2019-11-26 14:28:41,368 EPOCH 13\n",
"2019-11-26 14:28:45,448 Epoch 13 Step: 4300 Batch Loss: 2.056029 Tokens per Sec: 6982, Lr: 0.000300\n",
"2019-11-26 14:29:16,288 Epoch 13 Step: 4400 Batch Loss: 2.623316 Tokens per Sec: 7358, Lr: 0.000300\n",
"2019-11-26 14:29:47,095 Epoch 13 Step: 4500 Batch Loss: 2.337763 Tokens per Sec: 7360, Lr: 0.000300\n",
"2019-11-26 14:30:18,009 Epoch 13 Step: 4600 Batch Loss: 2.540540 Tokens per Sec: 7315, Lr: 0.000300\n",
"2019-11-26 14:30:30,997 Epoch 13: total training loss 803.65\n",
"2019-11-26 14:30:30,997 EPOCH 14\n",
"2019-11-26 14:30:48,852 Epoch 14 Step: 4700 Batch Loss: 2.418147 Tokens per Sec: 7226, Lr: 0.000300\n",
"2019-11-26 14:31:19,645 Epoch 14 Step: 4800 Batch Loss: 2.683759 Tokens per Sec: 7344, Lr: 0.000300\n",
"2019-11-26 14:31:50,235 Epoch 14 Step: 4900 Batch Loss: 1.871324 Tokens per Sec: 7352, Lr: 0.000300\n",
"2019-11-26 14:32:20,471 Epoch 14: total training loss 781.40\n",
"2019-11-26 14:32:20,471 EPOCH 15\n",
"2019-11-26 14:32:21,448 Epoch 15 Step: 5000 Batch Loss: 2.396113 Tokens per Sec: 7021, Lr: 0.000300\n",
"2019-11-26 14:33:54,721 Hooray! New best validation result [ppl]!\n",
"2019-11-26 14:33:54,721 Saving new checkpoint.\n",
"2019-11-26 14:33:55,037 Example #0\n",
"2019-11-26 14:33:55,037 \tSource: I love pioneering in this territory .\n",
"2019-11-26 14:33:55,037 \tReference: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 14:33:55,037 \tHypothesis: Un yí wǎn nú sinsɛnzɔ́ ɔ ɖò fí e un nɔ wà ɖò fí é .\n",
"2019-11-26 14:33:55,037 Example #1\n",
"2019-11-26 14:33:55,037 \tSource: “ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"2019-11-26 14:33:55,038 \tReference: “ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"2019-11-26 14:33:55,038 \tHypothesis: “ Mi kpɔ́n lee nǔ cí nú mǐ é , bo na dó wusyɛn lanmɛ nú mǐ ɖɔ mǐ ni nɔ gbeji nú Jehovah , bo na dó wusyɛn lanmɛ nú mǐ , bo na dó wusyɛn lanmɛ nú mǐ ɖɔ mǐ ni nɔ gbeji nú Jehovah !\n",
"2019-11-26 14:33:55,038 Example #2\n",
"2019-11-26 14:33:55,038 \tSource: Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"2019-11-26 14:33:55,038 \tReference: Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"2019-11-26 14:33:55,038 \tHypothesis: Mɛjitɔ́ Klisanwun ɖé lɛ nɔ sɛ̀n ɖò xá e mɛ winnyawinnya lɛ nɔ mɔ ɖɔ emi kún ɖó na mɔ nugbǒ ɔ ó é ɖé lɛ ó .\n",
"2019-11-26 14:33:55,038 Example #3\n",
"2019-11-26 14:33:55,038 \tSource: You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"2019-11-26 14:33:55,038 \tReference: 1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"2019-11-26 14:33:55,039 \tHypothesis: É ɖò wɛn ɖɔ a tuùn ɖɔ Jwifu lɛ ko tuùn ye .\n",
"2019-11-26 14:33:55,039 Validation result (greedy) at epoch 15, step 5000: bleu: 14.34, loss: 64531.0781, ppl: 8.8115, duration: 93.5903s\n",
"2019-11-26 14:34:25,789 Epoch 15 Step: 5100 Batch Loss: 2.222859 Tokens per Sec: 7383, Lr: 0.000300\n",
"2019-11-26 14:34:56,436 Epoch 15 Step: 5200 Batch Loss: 2.189746 Tokens per Sec: 7351, Lr: 0.000300\n",
"2019-11-26 14:35:27,218 Epoch 15 Step: 5300 Batch Loss: 2.335963 Tokens per Sec: 7297, Lr: 0.000300\n",
"2019-11-26 14:35:43,859 Epoch 15: total training loss 767.66\n",
"2019-11-26 14:35:43,860 EPOCH 16\n",
"2019-11-26 14:35:57,639 Epoch 16 Step: 5400 Batch Loss: 2.270057 Tokens per Sec: 7111, Lr: 0.000300\n",
"2019-11-26 14:36:28,032 Epoch 16 Step: 5500 Batch Loss: 2.056870 Tokens per Sec: 7154, Lr: 0.000300\n",
"2019-11-26 14:36:58,671 Epoch 16 Step: 5600 Batch Loss: 1.063942 Tokens per Sec: 7178, Lr: 0.000300\n",
"2019-11-26 14:37:29,562 Epoch 16 Step: 5700 Batch Loss: 2.415873 Tokens per Sec: 7487, Lr: 0.000300\n",
"2019-11-26 14:37:34,438 Epoch 16: total training loss 759.58\n",
"2019-11-26 14:37:34,439 EPOCH 17\n",
"2019-11-26 14:38:00,049 Epoch 17 Step: 5800 Batch Loss: 2.065362 Tokens per Sec: 7273, Lr: 0.000300\n",
"2019-11-26 14:38:30,954 Epoch 17 Step: 5900 Batch Loss: 2.120649 Tokens per Sec: 7279, Lr: 0.000300\n",
"2019-11-26 14:39:01,390 Epoch 17 Step: 6000 Batch Loss: 2.329014 Tokens per Sec: 7347, Lr: 0.000300\n",
"2019-11-26 14:40:34,786 Hooray! New best validation result [ppl]!\n",
"2019-11-26 14:40:34,787 Saving new checkpoint.\n",
"2019-11-26 14:40:35,087 Example #0\n",
"2019-11-26 14:40:35,088 \tSource: I love pioneering in this territory .\n",
"2019-11-26 14:40:35,088 \tReference: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 14:40:35,088 \tHypothesis: Un yí wǎn nú sinsɛnzɔ́ ɔ ɖò fí enɛ .\n",
"2019-11-26 14:40:35,088 Example #1\n",
"2019-11-26 14:40:35,088 \tSource: “ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"2019-11-26 14:40:35,088 \tReference: “ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"2019-11-26 14:40:35,088 \tHypothesis: “ È flín nǔ e mǐ sixu mɔ ɖò “ Aklunɔ sín akpá ” é , bo na dó wusyɛn lanmɛ nú mǐ , bo na dó wusyɛn lanmɛ nú Jehovah , bo lɛ́ dokú n’i .\n",
"2019-11-26 14:40:35,090 Example #2\n",
"2019-11-26 14:40:35,090 \tSource: Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"2019-11-26 14:40:35,090 \tReference: Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"2019-11-26 14:40:35,090 \tHypothesis: Mɛjitɔ́ Klisanwun ɖé lɛ nɔ sɛ̀n ɖò xá e mɛ winnyawinnya lɛ nɔ mɔ kpɔ́n ɖò wemaxɔmɛ é mɛ , bo nɔ mɔ ɖɔ nugbǒ ɔ ɖó na ɖó awǎjijɛ ɖò nugbǒ ɔ mɛ .\n",
"2019-11-26 14:40:35,090 Example #3\n",
"2019-11-26 14:40:35,091 \tSource: You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"2019-11-26 14:40:35,091 \tReference: 1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"2019-11-26 14:40:35,091 \tHypothesis: É ɖò wɛn ɖɔ a tuùn ɖɔ Jwifu lɛ kún tuùn ɖɔ emi kún nyí mɛsɛ́dó ó .\n",
"2019-11-26 14:40:35,091 Validation result (greedy) at epoch 17, step 6000: bleu: 16.15, loss: 61767.5156, ppl: 8.0275, duration: 93.7005s\n",
"2019-11-26 14:40:58,239 Epoch 17: total training loss 738.82\n",
"2019-11-26 14:40:58,239 EPOCH 18\n",
"2019-11-26 14:41:05,759 Epoch 18 Step: 6100 Batch Loss: 2.057728 Tokens per Sec: 7376, Lr: 0.000300\n",
"2019-11-26 14:41:36,034 Epoch 18 Step: 6200 Batch Loss: 1.926301 Tokens per Sec: 7317, Lr: 0.000300\n",
"2019-11-26 14:42:07,031 Epoch 18 Step: 6300 Batch Loss: 2.024534 Tokens per Sec: 7422, Lr: 0.000300\n",
"2019-11-26 14:42:37,848 Epoch 18 Step: 6400 Batch Loss: 2.170782 Tokens per Sec: 7388, Lr: 0.000300\n",
"2019-11-26 14:42:47,674 Epoch 18: total training loss 723.88\n",
"2019-11-26 14:42:47,674 EPOCH 19\n",
"2019-11-26 14:43:08,864 Epoch 19 Step: 6500 Batch Loss: 2.022346 Tokens per Sec: 7366, Lr: 0.000300\n",
"2019-11-26 14:43:39,532 Epoch 19 Step: 6600 Batch Loss: 1.915361 Tokens per Sec: 7285, Lr: 0.000300\n",
"2019-11-26 14:44:10,213 Epoch 19 Step: 6700 Batch Loss: 1.691444 Tokens per Sec: 7363, Lr: 0.000300\n",
"2019-11-26 14:44:37,292 Epoch 19: total training loss 708.88\n",
"2019-11-26 14:44:37,292 EPOCH 20\n",
"2019-11-26 14:44:40,694 Epoch 20 Step: 6800 Batch Loss: 1.902304 Tokens per Sec: 7373, Lr: 0.000300\n",
"2019-11-26 14:45:11,502 Epoch 20 Step: 6900 Batch Loss: 2.074996 Tokens per Sec: 7406, Lr: 0.000300\n",
"2019-11-26 14:45:42,154 Epoch 20 Step: 7000 Batch Loss: 2.250434 Tokens per Sec: 7260, Lr: 0.000300\n",
"2019-11-26 14:47:15,549 Hooray! New best validation result [ppl]!\n",
"2019-11-26 14:47:15,550 Saving new checkpoint.\n",
"2019-11-26 14:47:15,863 Example #0\n",
"2019-11-26 14:47:15,863 \tSource: I love pioneering in this territory .\n",
"2019-11-26 14:47:15,864 \tReference: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 14:47:15,864 \tHypothesis: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ ɖò fí enɛ .\n",
"2019-11-26 14:47:15,864 Example #1\n",
"2019-11-26 14:47:15,864 \tSource: “ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"2019-11-26 14:47:15,864 \tReference: “ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"2019-11-26 14:47:15,864 \tHypothesis: “ Togun ɔ ” ɔ , mǐ sixu mɔ ɖɔ ‘ Jehovah na kpa susu nú Jehovah , bo na kpa susu n’i .\n",
"2019-11-26 14:47:15,864 Example #2\n",
"2019-11-26 14:47:15,865 \tSource: Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"2019-11-26 14:47:15,865 \tReference: Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"2019-11-26 14:47:15,865 \tHypothesis: Mɛjitɔ́ Klisanwun ɖé lɛ nɔ sɛ̀n ɖò xá e mɛ vǐ yetɔn lɛ nɔ mɔ ɖɔ nugbǒ ɔ kún ɖó ayi wu ó lɛ é mɛ .\n",
"2019-11-26 14:47:15,865 Example #3\n",
"2019-11-26 14:47:15,866 \tSource: You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"2019-11-26 14:47:15,866 \tReference: 1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"2019-11-26 14:47:15,866 \tHypothesis: É ɖò wɛn ɖɔ a tuùn ɖɔ Jwifu e ko tuùn ɖɔ Jwifu lɛ wɛ nyí mɛsɛ́dó Pɔlu é ɔ , é wá tuùn i .\n",
"2019-11-26 14:47:15,866 Validation result (greedy) at epoch 20, step 7000: bleu: 17.57, loss: 59520.3320, ppl: 7.4417, duration: 93.7114s\n",
"2019-11-26 14:47:46,653 Epoch 20 Step: 7100 Batch Loss: 1.648879 Tokens per Sec: 7420, Lr: 0.000300\n",
"2019-11-26 14:48:00,386 Epoch 20: total training loss 693.25\n",
"2019-11-26 14:48:00,386 EPOCH 21\n",
"2019-11-26 14:48:17,234 Epoch 21 Step: 7200 Batch Loss: 1.636328 Tokens per Sec: 7419, Lr: 0.000300\n",
"2019-11-26 14:48:48,219 Epoch 21 Step: 7300 Batch Loss: 1.877475 Tokens per Sec: 7234, Lr: 0.000300\n",
"2019-11-26 14:49:18,934 Epoch 21 Step: 7400 Batch Loss: 1.953899 Tokens per Sec: 7246, Lr: 0.000300\n",
"2019-11-26 14:49:49,633 Epoch 21 Step: 7500 Batch Loss: 2.067929 Tokens per Sec: 7261, Lr: 0.000300\n",
"2019-11-26 14:49:50,886 Epoch 21: total training loss 690.18\n",
"2019-11-26 14:49:50,886 EPOCH 22\n",
"2019-11-26 14:50:20,324 Epoch 22 Step: 7600 Batch Loss: 2.043521 Tokens per Sec: 7264, Lr: 0.000300\n",
"2019-11-26 14:50:50,987 Epoch 22 Step: 7700 Batch Loss: 2.141779 Tokens per Sec: 7378, Lr: 0.000300\n",
"2019-11-26 14:51:21,543 Epoch 22 Step: 7800 Batch Loss: 2.099143 Tokens per Sec: 7436, Lr: 0.000300\n",
"2019-11-26 14:51:40,395 Epoch 22: total training loss 674.03\n",
"2019-11-26 14:51:40,395 EPOCH 23\n",
"2019-11-26 14:51:52,543 Epoch 23 Step: 7900 Batch Loss: 2.173620 Tokens per Sec: 7561, Lr: 0.000300\n",
"2019-11-26 14:52:23,387 Epoch 23 Step: 8000 Batch Loss: 2.227573 Tokens per Sec: 7290, Lr: 0.000300\n",
"2019-11-26 14:53:56,766 Hooray! New best validation result [ppl]!\n",
"2019-11-26 14:53:56,766 Saving new checkpoint.\n",
"2019-11-26 14:53:57,064 Example #0\n",
"2019-11-26 14:53:57,065 \tSource: I love pioneering in this territory .\n",
"2019-11-26 14:53:57,065 \tReference: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 14:53:57,065 \tHypothesis: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ ɔ ɖò fí enɛ .\n",
"2019-11-26 14:53:57,065 Example #1\n",
"2019-11-26 14:53:57,065 \tSource: “ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"2019-11-26 14:53:57,066 \tReference: “ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"2019-11-26 14:53:57,066 \tHypothesis: “ Togun ɔ ” jiwǔ tawun ɖɔ mǐ ni kpa susu nú Jehovah , bo lɛ́ dokú n’i n’i .\n",
"2019-11-26 14:53:57,066 Example #2\n",
"2019-11-26 14:53:57,067 \tSource: Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"2019-11-26 14:53:57,067 \tReference: Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"2019-11-26 14:53:57,067 \tHypothesis: Mɛjitɔ́ ɖé lɛ nɔ sɛ̀n ɖò xá e mɛ vǐ yetɔn lɛ nɔ dó gbè ɖevo mɛ é ɖé lɛ mɔ ɖɔ nugbǒ ɔ kún ɖó awǎjijɛ ó .\n",
"2019-11-26 14:53:57,067 Example #3\n",
"2019-11-26 14:53:57,067 \tSource: You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"2019-11-26 14:53:57,067 \tReference: 1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"2019-11-26 14:53:57,067 \tHypothesis: É ɖò wɛn ɖɔ a tuùn ɖɔ Jwifu e ko tuùn nǔ e ye tuùn lɛ é wɛ nyí mɛsɛ́dó Pɔlu .\n",
"2019-11-26 14:53:57,067 Validation result (greedy) at epoch 23, step 8000: bleu: 18.66, loss: 57724.9688, ppl: 7.0045, duration: 93.6799s\n",
"2019-11-26 14:54:27,396 Epoch 23 Step: 8100 Batch Loss: 1.993855 Tokens per Sec: 7262, Lr: 0.000300\n",
"2019-11-26 14:54:58,225 Epoch 23 Step: 8200 Batch Loss: 1.721530 Tokens per Sec: 7242, Lr: 0.000300\n",
"2019-11-26 14:55:03,931 Epoch 23: total training loss 664.34\n",
"2019-11-26 14:55:03,931 EPOCH 24\n",
"2019-11-26 14:55:28,869 Epoch 24 Step: 8300 Batch Loss: 1.609951 Tokens per Sec: 7309, Lr: 0.000300\n",
"2019-11-26 14:55:59,418 Epoch 24 Step: 8400 Batch Loss: 1.596233 Tokens per Sec: 7278, Lr: 0.000300\n",
"2019-11-26 14:56:30,194 Epoch 24 Step: 8500 Batch Loss: 0.993275 Tokens per Sec: 7256, Lr: 0.000300\n",
"2019-11-26 14:56:54,172 Epoch 24: total training loss 659.35\n",
"2019-11-26 14:56:54,173 EPOCH 25\n",
"2019-11-26 14:57:00,783 Epoch 25 Step: 8600 Batch Loss: 1.881945 Tokens per Sec: 7052, Lr: 0.000300\n",
"2019-11-26 14:57:31,541 Epoch 25 Step: 8700 Batch Loss: 1.651695 Tokens per Sec: 7310, Lr: 0.000300\n",
"2019-11-26 14:58:02,219 Epoch 25 Step: 8800 Batch Loss: 1.661671 Tokens per Sec: 7294, Lr: 0.000300\n",
"2019-11-26 14:58:33,202 Epoch 25 Step: 8900 Batch Loss: 2.083404 Tokens per Sec: 7341, Lr: 0.000300\n",
"2019-11-26 14:58:44,241 Epoch 25: total training loss 641.46\n",
"2019-11-26 14:58:44,241 EPOCH 26\n",
"2019-11-26 14:59:04,129 Epoch 26 Step: 9000 Batch Loss: 2.332623 Tokens per Sec: 7369, Lr: 0.000300\n",
"2019-11-26 15:00:36,933 Hooray! New best validation result [ppl]!\n",
"2019-11-26 15:00:36,933 Saving new checkpoint.\n",
"2019-11-26 15:00:37,275 Example #0\n",
"2019-11-26 15:00:37,276 \tSource: I love pioneering in this territory .\n",
"2019-11-26 15:00:37,276 \tReference: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 15:00:37,276 \tHypothesis: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 15:00:37,276 Example #1\n",
"2019-11-26 15:00:37,276 \tSource: “ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"2019-11-26 15:00:37,276 \tReference: “ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"2019-11-26 15:00:37,276 \tHypothesis: “ Togun ” ɔ , è nɔ mɔ nǔ jɛ wu ɖɔ mǐ sixu kpa susu nú Jehovah , bo dokú nú Jehovah .\n",
"2019-11-26 15:00:37,276 Example #2\n",
"2019-11-26 15:00:37,276 \tSource: Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"2019-11-26 15:00:37,277 \tReference: Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"2019-11-26 15:00:37,277 \tHypothesis: Mɛjitɔ́ Klisanwun ɖé lɛ nɔ sɛ̀n sinsɛnzɔ́ ɖò xá e mɛ vǐ yetɔn lɛ nɔ dó gbè ɖevo ɖè é ɖé lɛ mɔ ɖɔ emi ɖó ayi wu ɖɔ nugbǒ ɔ tɔn lɛ ɖó ayi wu .\n",
"2019-11-26 15:00:37,277 Example #3\n",
"2019-11-26 15:00:37,277 \tSource: You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"2019-11-26 15:00:37,277 \tReference: 1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"2019-11-26 15:00:37,277 \tHypothesis: É ɖò wɛn ɖɔ a tuùn ɖɔ Jwifu e nyí Jwifu lɛ é ɖokpo wɛ nyí mɛsɛ́dó Pɔlu .\n",
"2019-11-26 15:00:37,277 Validation result (greedy) at epoch 26, step 9000: bleu: 19.42, loss: 56730.3633, ppl: 6.7735, duration: 93.1475s\n",
"2019-11-26 15:01:07,938 Epoch 26 Step: 9100 Batch Loss: 1.694081 Tokens per Sec: 7233, Lr: 0.000300\n",
"2019-11-26 15:01:38,622 Epoch 26 Step: 9200 Batch Loss: 1.467636 Tokens per Sec: 7367, Lr: 0.000300\n",
"2019-11-26 15:02:07,152 Epoch 26: total training loss 629.64\n",
"2019-11-26 15:02:07,152 EPOCH 27\n",
"2019-11-26 15:02:09,702 Epoch 27 Step: 9300 Batch Loss: 1.865959 Tokens per Sec: 7843, Lr: 0.000300\n",
"2019-11-26 15:02:40,799 Epoch 27 Step: 9400 Batch Loss: 1.647859 Tokens per Sec: 7249, Lr: 0.000300\n",
"2019-11-26 15:03:11,592 Epoch 27 Step: 9500 Batch Loss: 1.956773 Tokens per Sec: 7326, Lr: 0.000300\n",
"2019-11-26 15:03:42,463 Epoch 27 Step: 9600 Batch Loss: 1.818972 Tokens per Sec: 7349, Lr: 0.000300\n",
"2019-11-26 15:03:56,874 Epoch 27: total training loss 617.07\n",
"2019-11-26 15:03:56,875 EPOCH 28\n",
"2019-11-26 15:04:13,630 Epoch 28 Step: 9700 Batch Loss: 1.014780 Tokens per Sec: 7280, Lr: 0.000300\n",
"2019-11-26 15:04:44,556 Epoch 28 Step: 9800 Batch Loss: 1.767276 Tokens per Sec: 7404, Lr: 0.000300\n",
"2019-11-26 15:05:15,211 Epoch 28 Step: 9900 Batch Loss: 2.007863 Tokens per Sec: 7223, Lr: 0.000300\n",
"2019-11-26 15:05:45,999 Epoch 28 Step: 10000 Batch Loss: 1.755681 Tokens per Sec: 7373, Lr: 0.000300\n",
"2019-11-26 15:07:19,565 Hooray! New best validation result [ppl]!\n",
"2019-11-26 15:07:19,565 Saving new checkpoint.\n",
"2019-11-26 15:07:19,864 Example #0\n",
"2019-11-26 15:07:19,864 \tSource: I love pioneering in this territory .\n",
"2019-11-26 15:07:19,865 \tReference: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ wiwa ɖò fí enɛ .\n",
"2019-11-26 15:07:19,865 \tHypothesis: Un yí wǎn nú gbexosin - alijitɔ́zɔ́ ɖò fí e un ɖè é .\n",
"2019-11-26 15:07:19,865 Example #1\n",
"2019-11-26 15:07:19,865 \tSource: “ Too numerous to recount ” are the “ wonderful works ” we can thank and praise Jehovah for daily !\n",
"2019-11-26 15:07:19,865 \tReference: “ Nùjiwǔ ” e Jehovah bló bɔ mǐ sixu dokú tɔn n’i bo lɛ́ kpa susu n’i ayihɔngbe ayihɔngbe é “ sukpɔ́ ” tawun .\n",
"2019-11-26 15:07:19,865 \tHypothesis: “ Togun Mawu tɔn ” jiwǔ tawun , bɔ mǐ sixu dokú nú Jehovah , bo dokú n’i .\n",
"2019-11-26 15:07:19,866 Example #2\n",
"2019-11-26 15:07:19,866 \tSource: Some Christian parents serving in a foreign - language field have come to realize that their children’s interest in the truth has waned .\n",
"2019-11-26 15:07:19,866 \tReference: Mɛjitɔ́ Klisanwun e ɖò sinsɛnzɔ́ wà wɛ ɖò ayǐ e jí è nɔ dó gbè ɖevo ɖè lɛ é ɖé lɛ wá ɖ’ayi wu ɖɔ jlǒ e vǐ emitɔn lɛ ɖó nú nugbǒ ɔ é ɖò ɖiɖekpo wɛ .\n",
"2019-11-26 15:07:19,866 \tHypothesis: Mɛjitɔ́ Klisanwun ɖé lɛ nɔ sɛ̀n sinsɛnzɔ́ ɖò xá e mɛ vǐ yetɔn lɛ nɔ dó gbè ɖevo mɛ é ɖé lɛ mɔ ɖɔ nugbǒ ɔ ɖó kpɔ́ .\n",
"2019-11-26 15:07:19,866 Example #3\n",
"2019-11-26 15:07:19,867 \tSource: You certainly recognize that Jewish man as the one who came to be known as the apostle Paul .\n",
"2019-11-26 15:07:19,867 \tReference: 1 : 14 ) É ɖò wɛn ɖɔ a tuùn nya Jwifu enɛ e è wá ylɔ ɖɔ mɛsɛ́dó Pɔlu é .\n",
"2019-11-26 15:07:19,867 \tHypothesis: É ɖò wɛn ɖɔ a tuùn ɖɔ Jwifu e wá tuùn mɛsɛ́dó Pɔlu é wɛ nyí mɛsɛ́dó Pɔlu .\n",
"2019-11-26 15:07:19,867 Validation result (greedy) at epoch 28, step 10000: bleu: 20.28, loss: 54994.6992, ppl: 6.3884, duration: 93.8673s\n",
"2019-11-26 15:07:20,499 Epoch 28: total training loss 611.54\n",
"2019-11-26 15:07:20,500 EPOCH 29\n",
"2019-11-26 15:07:50,840 Epoch 29 Step: 10100 Batch Loss: 1.650072 Tokens per Sec: 7307, Lr: 0.000300\n",
"2019-11-26 15:08:21,642 Epoch 29 Step: 10200 Batch Loss: 1.353416 Tokens per Sec: 7449, Lr: 0.000300\n",
"2019-11-26 15:08:52,008 Epoch 29 Step: 10300 Batch Loss: 1.798775 Tokens per Sec: 7367, Lr: 0.000300\n",
"2019-11-26 15:09:09,910 Epoch 29: total training loss 604.65\n",
"2019-11-26 15:09:09,911 EPOCH 30\n",
"2019-11-26 15:09:22,935 Epoch 30 Step: 10400 Batch Loss: 1.441740 Tokens per Sec: 7415, Lr: 0.000300\n",
"2019-11-26 15:09:53,582 Epoch 30 Step: 10500 Batch Loss: 2.227500 Tokens per Sec: 7292, Lr: 0.000300\n",
"2019-11-26 15:10:24,477 Epoch 30 Step: 10600 Batch Loss: 2.074497 Tokens per Sec: 7352, Lr: 0.000300\n",
"2019-11-26 15:10:55,341 Epoch 30 Step: 10700 Batch Loss: 2.114685 Tokens per Sec: 7480, Lr: 0.000300\n",
"2019-11-26 15:10:59,098 Epoch 30: total training loss 591.97\n",
"2019-11-26 15:10:59,098 Training ended after 30 epochs.\n",
"2019-11-26 15:10:59,098 Best validation result (greedy) at step 10000: 6.39 ppl.\n",
"2019-11-26 15:11:51,463 dev bleu: 21.61 [Beam search decoding with beam size = 5 and alpha = 1.0]\n",
"2019-11-26 15:11:51,464 Translations saved to: models/enfon_transformer/00010000.hyps.dev\n",
"2019-11-26 15:13:36,964 test bleu: 31.07 [Beam search decoding with beam size = 5 and alpha = 1.0]\n",
"2019-11-26 15:13:36,967 Translations saved to: models/enfon_transformer/00010000.hyps.test\n"
]
}
],
"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"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
},
"colab_type": "code",
"id": "MBoDS09JM807",
"outputId": "6cf7a2ff-fba7-4dd8-beb8-127ab80a5fe3"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"cp: cannot create symbolic link '/content/drive/My Drive/masakhane/en-fon-baseline/models/enfon_transformer/best.ckpt': Function not implemented\n"
]
}
],
"source": [
"# Copy the created models from the notebook storage to google drive for persistant storage \n",
"!cp -r joeynmt/models/${src}${tgt}_transformer/* \"$gdrive_path/models/${src}${tgt}_transformer/\""
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "AYCOImAVVCFJ"
},
"outputs": [],
"source": [
"# Copy the created models from the notebook storage to google drive for persistant storage \n",
"!cp joeynmt/models/${src}${tgt}_transformer/best.ckpt \"$gdrive_path/models/${src}${tgt}_transformer/\""
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 102
},
"colab_type": "code",
"id": "cSoGZWeeUFob",
"outputId": "0f33d9fc-7df4-4593-96b0-860099939aba"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"00010000.hyps.dev 2000.hyps 7000.hyps best.ckpt\t trg_vocab.txt\n",
"00010000.hyps.test 3000.hyps 8000.ckpt config.yaml\t validations.txt\n",
"10000.ckpt\t 4000.hyps 8000.hyps src_vocab.txt\n",
"10000.hyps\t 5000.hyps 9000.ckpt tensorboard\n",
"1000.hyps\t 6000.hyps 9000.hyps train.log\n"
]
}
],
"source": [
"!ls joeynmt/models/${src}${tgt}_transformer"
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 187
},
"colab_type": "code",
"id": "n94wlrCjVc17",
"outputId": "30c9c4b5-a0e3-4291-ae0c-92d4ad75765b"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Steps: 1000\tLoss: 99911.83594\tPPL: 29.05352\tbleu: 2.72236\tLR: 0.00030000\t*\n",
"Steps: 2000\tLoss: 83836.46875\tPPL: 16.89572\tbleu: 5.02770\tLR: 0.00030000\t*\n",
"Steps: 3000\tLoss: 74603.65625\tPPL: 12.37551\tbleu: 8.58942\tLR: 0.00030000\t*\n",
"Steps: 4000\tLoss: 68261.98438\tPPL: 9.99286\tbleu: 12.24441\tLR: 0.00030000\t*\n",
"Steps: 5000\tLoss: 64531.07812\tPPL: 8.81153\tbleu: 14.33851\tLR: 0.00030000\t*\n",
"Steps: 6000\tLoss: 61767.51562\tPPL: 8.02748\tbleu: 16.15283\tLR: 0.00030000\t*\n",
"Steps: 7000\tLoss: 59520.33203\tPPL: 7.44165\tbleu: 17.57435\tLR: 0.00030000\t*\n",
"Steps: 8000\tLoss: 57724.96875\tPPL: 7.00449\tbleu: 18.66193\tLR: 0.00030000\t*\n",
"Steps: 9000\tLoss: 56730.36328\tPPL: 6.77346\tbleu: 19.42256\tLR: 0.00030000\t*\n",
"Steps: 10000\tLoss: 54994.69922\tPPL: 6.38840\tbleu: 20.28424\tLR: 0.00030000\t*\n"
]
}
],
"source": [
"# Output our validation accuracy\n",
"! cat \"$gdrive_path/models/${src}${tgt}_transformer/validations.txt\""
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 68
},
"colab_type": "code",
"id": "66WhRE9lIhoD",
"outputId": "61637247-fd6b-41f5-b4a0-5d0a024af6d1"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2019-11-26 15:25:20,452 Hello! This is Joey-NMT.\n",
"2019-11-26 15:26:14,929 dev bleu: 21.61 [Beam search decoding with beam size = 5 and alpha = 1.0]\n",
"2019-11-26 15:28:00,670 test bleu: 31.07 [Beam search decoding with beam size = 5 and alpha = 1.0]\n"
]
}
],
"source": [
"# Test our model\n",
"! cd joeynmt; python3 -m joeynmt test \"$gdrive_path/models/${src}${tgt}_transformer/config.yaml\""
]
},
{
"cell_type": "code",
"execution_count": 0,
"metadata": {
"colab": {},
"colab_type": "code",
"id": "r54BFMrWURq5"
},
"outputs": [],
"source": []
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"collapsed_sections": [],
"name": "Copie de starter_notebook.ipynb",
"provenance": [],
"toc_visible": 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.7.1"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 1
}
|