File size: 179,202 Bytes
78aa4ee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "accelerator": "GPU",
    "colab": {
      "name": "enzu.ipynb",
      "provenance": [],
      "collapsed_sections": [],
      "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.5.6"
    }
  },
  "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 masakhanetranslation@gmail.com\n",
        "\n",
        "### - If you care enough and get a chance, doing a brief background on your language would be amazing. See examples in  [(Martinus, 2019)](https://arxiv.org/abs/1906.05685)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "l929HimrxS0a"
      },
      "source": [
        "## Retrieve your data & make a parallel corpus\n",
        "\n",
        "If you are wanting to use the JW300 data referenced on the Masakhane website or in our GitHub repo, you can use `opus-tools` to convert the data into a convenient format. `opus_read` from that package provides a convenient tool for reading the native aligned XML files and to convert them to TMX format. The tool can also be used to fetch relevant files from OPUS on the fly and to filter the data as necessary. [Read the documentation](https://pypi.org/project/opustools-pkg/) for more details.\n",
        "\n",
        "Once you have your corpus files in TMX format (an xml structure which will include the sentences in your target language and your source language in a single file), we recommend reading them into a pandas dataframe. Thankfully, Jade wrote a silly `tmx2dataframe` package which converts your tmx file to a pandas dataframe. "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "oGRmDELn7Az0",
        "outputId": "21c2658b-838b-4420-fad5-0d8cd801121c",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 121
        }
      },
      "source": [
        "from google.colab import drive\n",
        "drive.mount('/content/drive')"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&response_type=code&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly\n",
            "\n",
            "Enter your authorization code:\n",
            "··········\n",
            "Mounted at /content/drive\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "Cn3tgQLzUxwn",
        "colab": {}
      },
      "source": [
        "# TODO: Set your source and target languages. Keep in mind, these traditionally use language codes as found here:\n",
        "# These will also become the suffix's of all vocab and corpus files used throughout\n",
        "import os\n",
        "source_language = \"en\"\n",
        "target_language = \"zu\" \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)"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "kBSgJHEw7Nvx",
        "outputId": "81a15c5a-731c-4e01-823e-7704fafe7d50",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "source": [
        "!echo $gdrive_path"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/content/drive/My Drive/masakhane/en-zu-baseline\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "gA75Fs9ys8Y9",
        "outputId": "e84f82e2-7d68-46a4-c914-7cea09c55007",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 121
        }
      },
      "source": [
        "# Install opus-tools\n",
        "! pip install opustools-pkg"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "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 29.0MB/s eta 0:00:01\r\u001b[K     |████████                        | 20kB 6.5MB/s eta 0:00:01\r\u001b[K     |████████████▏                   | 30kB 9.2MB/s eta 0:00:01\r\u001b[K     |████████████████▏               | 40kB 5.9MB/s eta 0:00:01\r\u001b[K     |████████████████████▎           | 51kB 7.2MB/s eta 0:00:01\r\u001b[K     |████████████████████████▎       | 61kB 8.5MB/s eta 0:00:01\r\u001b[K     |████████████████████████████▎   | 71kB 9.7MB/s eta 0:00:01\r\u001b[K     |████████████████████████████████| 81kB 5.9MB/s \n",
            "\u001b[?25hInstalling collected packages: opustools-pkg\n",
            "Successfully installed opustools-pkg-0.0.52\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "xq-tDZVks7ZD",
        "colab": {}
      },
      "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"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "n48GDRnP8y2G",
        "colab_type": "code",
        "outputId": "20a89a4d-87c6-4b29-f930-98e059a3413d",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 571
        }
      },
      "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"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "--2019-11-26 09:00:47--  https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-any.en\n",
            "Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...\n",
            "Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.\n",
            "HTTP request sent, awaiting response... 200 OK\n",
            "Length: 277791 (271K) [text/plain]\n",
            "Saving to: ‘test.en-any.en’\n",
            "\n",
            "\rtest.en-any.en        0%[                    ]       0  --.-KB/s               \rtest.en-any.en      100%[===================>] 271.28K  --.-KB/s    in 0.02s   \n",
            "\n",
            "2019-11-26 09:00:47 (15.9 MB/s) - ‘test.en-any.en’ saved [277791/277791]\n",
            "\n",
            "--2019-11-26 09:00:51--  https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-zu.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: 206207 (201K) [text/plain]\n",
            "Saving to: ‘test.en-zu.en’\n",
            "\n",
            "test.en-zu.en       100%[===================>] 201.37K  --.-KB/s    in 0.01s   \n",
            "\n",
            "2019-11-26 09:00:51 (16.6 MB/s) - ‘test.en-zu.en’ saved [206207/206207]\n",
            "\n",
            "--2019-11-26 09:00:58--  https://raw.githubusercontent.com/juliakreutzer/masakhane/master/jw300_utils/test/test.en-zu.zu\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: 218273 (213K) [text/plain]\n",
            "Saving to: ‘test.en-zu.zu’\n",
            "\n",
            "test.en-zu.zu       100%[===================>] 213.16K  --.-KB/s    in 0.02s   \n",
            "\n",
            "2019-11-26 09:00:59 (13.5 MB/s) - ‘test.en-zu.zu’ saved [218273/218273]\n",
            "\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "NqDG-CI28y2L",
        "colab_type": "code",
        "outputId": "2df6811e-2499-47ce-9243-8eed1fd2daf0",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 34
        }
      },
      "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))"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Loaded 3571 global test sentences to filter from the training/dev data.\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "3CNdwLBCfSIl",
        "outputId": "412cf533-c8ff-4405-b4d2-303fad9f42ad",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 153
        }
      },
      "source": [
        "import pandas as pd\n",
        "\n",
        "# TMX file to dataframe\n",
        "source_file = 'enzu_parallel.train.' + source_language\n",
        "target_file = 'enzu_parallel.train.' + target_language\n",
        "\n",
        "source = []\n",
        "target = []\n",
        "skip_lines = []  # Collect the line numbers of the source portion to skip the same lines for the target portion.\n",
        "with open(source_file) as f:\n",
        "    for i, line in enumerate(f):\n",
        "        # Skip sentences that are contained in the test set.\n",
        "        if line.strip() not in en_test_sents:\n",
        "            source.append(line.strip())\n",
        "        else:\n",
        "            skip_lines.append(i)             \n",
        "with open(target_file) as f:\n",
        "    for j, line in enumerate(f):\n",
        "        # Only add to corpus if corresponding source was not skipped.\n",
        "        if j not in skip_lines:\n",
        "            target.append(line.strip())\n",
        "    \n",
        "print('Loaded data and skipped {}/{} lines since contained in test set.'.format(len(skip_lines), i))\n",
        "    \n",
        "df = pd.DataFrame(zip(source, target), columns=['source_sentence', 'target_sentence'])\n",
        "# if you get TypeError: data argument can't be an iterator is because of your zip version run this below\n",
        "#df = pd.DataFrame(list(zip(source, target)), columns=['source_sentence', 'target_sentence'])\n",
        "df.head(3)"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Loaded data and skipped 2/23727 lines since contained in test set.\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "execute_result",
          "data": {
            "text/html": [
              "<div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>source_sentence</th>\n",
              "      <th>target_sentence</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>Developing a Poverty Alleviation Programme foc...</td>\n",
              "      <td>Ukwakha uhlelo lokuxosha indlala olugxile ekun...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>When we spoke from this podium at the Millenni...</td>\n",
              "      <td>Ngesikhathi sikhuluma kulesi sidlangalala se- ...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>Promotes and facilitates social dialogues abou...</td>\n",
              "      <td>Ukugqugquzela nokulungiselela izinkulumo zomph...</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>"
            ],
            "text/plain": [
              "                                     source_sentence                                    target_sentence\n",
              "0  Developing a Poverty Alleviation Programme foc...  Ukwakha uhlelo lokuxosha indlala olugxile ekun...\n",
              "1  When we spoke from this podium at the Millenni...  Ngesikhathi sikhuluma kulesi sidlangalala se- ...\n",
              "2  Promotes and facilitates social dialogues abou...  Ukugqugquzela nokulungiselela izinkulumo zomph..."
            ]
          },
          "metadata": {
            "tags": []
          },
          "execution_count": 7
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "YkuK3B4p2AkN"
      },
      "source": [
        "## Pre-processing and export\n",
        "\n",
        "It is generally a good idea to remove duplicate translations and conflicting translations from the corpus. In practice, these public corpora include some number of these that need to be cleaned.\n",
        "\n",
        "In addition we will split our data into dev/test/train and export to the filesystem."
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "M_2ouEOH1_1q",
        "outputId": "67e06b7c-3e68-436a-fac4-56c27640274d",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 185
        }
      },
      "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)"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:6: SettingWithCopyWarning: \n",
            "A value is trying to be set on a copy of a slice from a DataFrame\n",
            "\n",
            "See the caveats in the documentation: 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"
          ],
          "name": "stderr"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "Z_1BwAApEtMk",
        "colab_type": "code",
        "outputId": "f3548870-299f-438a-891e-b4eab1abf110",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 709
        }
      },
      "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]"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "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.9MB/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=144665 sha256=82eb1605d8275e94c11fff8cf9f2ba935743e6a94b8f9ca25a42c46e629432fc\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:17.37 4.29 percent complete\n",
            "00:00:36.41 8.59 percent complete\n",
            "00:00:53.86 12.88 percent complete\n",
            "00:01:12.04 17.18 percent complete\n",
            "00:01:30.17 21.47 percent complete\n",
            "00:01:47.53 25.77 percent complete\n",
            "00:02:05.64 30.06 percent complete\n",
            "00:02:23.44 34.36 percent complete\n",
            "00:02:40.55 38.65 percent complete\n",
            "00:02:58.75 42.95 percent complete\n",
            "00:03:16.60 47.24 percent complete\n",
            "00:03:34.11 51.54 percent complete\n",
            "00:03:50.82 55.83 percent complete\n",
            "00:04:08.20 60.13 percent complete\n",
            "00:04:25.85 64.42 percent complete\n",
            "00:04:43.25 68.72 percent complete\n",
            "00:05:00.18 73.01 percent complete\n",
            "00:05:18.56 77.31 percent complete\n",
            "00:05:35.91 81.60 percent complete\n",
            "00:05:53.17 85.90 percent complete\n",
            "00:06:09.76 90.19 percent complete\n",
            "00:06:26.77 94.49 percent complete\n"
          ],
          "name": "stdout"
        },
        {
          "output_type": "stream",
          "text": [
            "WARNING:root:Applied processor reduces input query to empty string, all comparisons will have score 0. [Query: '&']\n"
          ],
          "name": "stderr"
        },
        {
          "output_type": "stream",
          "text": [
            "00:06:43.13 98.78 percent complete\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "hxxBOCA-xXhy",
        "outputId": "d24839a4-563f-4fd0-b1c4-05559db6c3dd",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 810
        }
      },
      "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.*"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "==> train.en <==\n",
            "I will develop a policy that will ensure wider accessibility and inclusivity for all our people throughout this province .\n",
            "In this regard , we must respond to the cold reality that , as in other countries , the overwhelming majority of violent crimes against the person occur in the most socio-economically deprived areas of our country and require strong and sustained community interventions focused on crime prevention .\n",
            "I am going to ask Mr Mkiwane to come and give the , a submission on behalf of the ex-councillors of the Vaal .\n",
            "Information Services Section ;\n",
            "Dr Swanepoel denies much strongly that at any stage , he compiled any false documents .\n",
            "with a view to ensuring the sustainability of the 20 major land restitution projects around the province . A Task Team coordinated by the Economic Technical Cluster of Cabinet has already been established\n",
            "MEC Dugmore congratulated the police with the speedy investigations and arrest of two suspects .\n",
            "marketing and general business management . For technical skills secondary coops should be the single point of entry by government departments with the required expertise and for private sector wishing to do business with this sector .\n",
            "The Department of Health has prioritised psychology as second in terms of prioritising its health delivery system .\n",
            "resolve disputes through conciliation ;\n",
            "\n",
            "==> train.zu <==\n",
            "Yilapho iTRC inxephezele khona ubuhlungu obuningi obudinga iziduduzo ukuze kwelapheke ikusasa lethu .\n",
            "Mayelana naloku , kufanele sivume iqiniso lokuthi njengamanye amazwe iningi lobugebengu obuhlukubezayo ebantwini benzeka ezindaweni lapha kuhlala khona abantu abampofu , ngaloko-ke kudingeka sifake umfutho ezindaweni ezinjengalezo sivikele ubugebengu bungenzeki ;\n",
            "Ngizocela uMnu Mkiwane ukuthi eze alethe izethulo egameni lamakhansela asesukile ezikhundleni aseVaal .\n",
            "Umnyango Onikeza Ngolwazi ;\n",
            "Udkt . Swanepoel ukuphika ulala umhlane ukuthi kukhona isikhathi lapho , ehlanganise khona imibhalo engelona iqiniso .\n",
            "yesifunda ngenhloso yokuqinisekisa ukungafadabali kwamaphrojekthi anqala okubuyiselwa komhlaba angu 20 esiFundeni . IThimba elididiyelwe yi Economic Technical Cluster ye Khabhinethi selakhiwe\n",
            "U MEC Dugmore utuse amaphoyisa ngokuphenya masinyane kanye nokubopha abasolwa ababili .\n",
            "awokuzigqaja nokuphatha-jikelele kwebhizinisi . Amasecondary co-operatives kufanele abe yintuba yahulumeni nabahwebi bangasese yokungena kulengosi uma befuna amakhono omsebenzi .\n",
            "Umnyango wezeMpilo ebeke ezengqondo esigabeni sesibili kwezokwendulela ohlelweni lokwethula imisebenzi kwezempilo .\n",
            "ukuxazulula izingxabano ngokubuyisana ;\n",
            "==> dev.en <==\n",
            "Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "Information about government services\n",
            "The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "This information will enable us to predict impacts and take proactive steps .\n",
            "A referral to the Tribunal , whether by the Commission or by a complainant in terms of subsection , must be in the prescribed form .\n",
            "And he had said that there was clapping or slapping when these children first came .\n",
            "it is unreasonable to expect the distributor or retailer to have discovered the unsafe product characteristic , failure , defect or hazard ,\n",
            "Succulent-leaved shrub of the family Asphodelaceae , well represented in southern Africa .\n",
            "Working together , we have scored great victories since the birth of our democracy .\n",
            "\n",
            "==> dev.zu <==\n",
            "Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "Ulwazi ngezinkonzo kahulumeni\n",
            "Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "Lolu lwazi luzosenza sikwazi ukuqagela imiphumela kanye nokuthatha izinyathelo zokuvimbela okungakenzeki .\n",
            "Ukudluliselwa kodaba eNkantolo Yobulungisa , kungakhathaliseki ukuthi kwenziwa nguKhomishane , noma ngofaka isikhalazo ngokwemibandela yesigatshana , kumelwe kwenziwe ngokubhala phansi .\n",
            "Wathi kwaba khona ukushaywa kwehlombe noma ukumpansana ngesikhathi lezi zingane ziqala ukufika .\n",
            "kungenangqondo ukulindela ukuba umthengisi noma othengela ukuthengisa kube nguyena othole isici , ukwehluleka , imfa noma ingozi\n",
            "Izihlahla ezincane ezinamahlamvu athambile zohlobo lwe -Asphodelaceae , ziningi eNgingizimu Afrika yonkana .\n",
            "Ukusebenza ngokubambisana , sibe nempumelelo enkulu selokhu kwaqala intando yeningi .\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "epeCydmCyS8X"
      },
      "source": [
        "\n",
        "\n",
        "---\n",
        "\n",
        "\n",
        "## Installation of JoeyNMT\n",
        "\n",
        "JoeyNMT is a simple, minimalist NMT package which is useful for learning and teaching. Check out the documentation for JoeyNMT [here](https://joeynmt.readthedocs.io)  "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "iBRMm4kMxZ8L",
        "outputId": "5f6e31ae-99e8-438a-a387-0229245e8ca4",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "# Install JoeyNMT\n",
        "! git clone https://github.com/joeynmt/joeynmt.git\n",
        "! cd joeynmt; pip3 install ."
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Cloning into 'joeynmt'...\n",
            "remote: Enumerating objects: 15, done.\u001b[K\n",
            "remote: Counting objects:   6% (1/15)\u001b[K\rremote: Counting objects:  13% (2/15)\u001b[K\rremote: Counting objects:  20% (3/15)\u001b[K\rremote: Counting objects:  26% (4/15)\u001b[K\rremote: Counting objects:  33% (5/15)\u001b[K\rremote: Counting objects:  40% (6/15)\u001b[K\rremote: Counting objects:  46% (7/15)\u001b[K\rremote: Counting objects:  53% (8/15)\u001b[K\rremote: Counting objects:  60% (9/15)\u001b[K\rremote: Counting objects:  66% (10/15)\u001b[K\rremote: Counting objects:  73% (11/15)\u001b[K\rremote: Counting objects:  80% (12/15)\u001b[K\rremote: Counting objects:  86% (13/15)\u001b[K\rremote: Counting objects:  93% (14/15)\u001b[K\rremote: Counting objects: 100% (15/15)\u001b[K\rremote: 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.32 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 26.2MB/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 59.0MB/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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: requests in /usr/local/lib/python3.6/dist-packages (from torchtext->joeynmt==0.0.1) (2.21.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: typing in /usr/local/lib/python3.6/dist-packages (from sacrebleu>=1.3.6->joeynmt==0.0.1) (3.6.6)\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: 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: 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: cycler>=0.10 in /usr/local/lib/python3.6/dist-packages (from matplotlib->joeynmt==0.0.1) (0.10.0)\n",
            "Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.6/dist-packages (from matplotlib->joeynmt==0.0.1) (2.6.1)\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 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 8.5MB/s \n",
            "\u001b[?25hCollecting 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 63.9MB/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: 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: 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: 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: 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: 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: 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 65.2MB/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 9.3MB/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=42eedc51262de31595036aaa80f4d09a37b88b05cda6eb9ee4e522fcf8de1cec\n",
            "  Stored in directory: /tmp/pip-ephem-wheel-cache-bu4l4oji/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=7374a812b677b2050a61f1fc8a29463e54e82a236d803d40a97b3393ef4fdb24\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, isort, typed-ast, lazy-object-proxy, astroid, 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"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "AaE77Tcppex9"
      },
      "source": [
        "# Preprocessing the Data into Subword BPE Tokens\n",
        "\n",
        "- One of the most powerful improvements for agglutinative languages (a feature of most Bantu languages) is using BPE tokenization [ (Sennrich, 2015) ](https://arxiv.org/abs/1508.07909).\n",
        "\n",
        "- It was also shown that by optimizing the umber of BPE codes we significantly improve results for low-resourced languages [(Sennrich, 2019)](https://www.aclweb.org/anthology/P19-1021) [(Martinus, 2019)](https://arxiv.org/abs/1906.05685)\n",
        "\n",
        "- Below we have the scripts for doing BPE tokenization of our data. We use 4000 tokens as recommended by [(Sennrich, 2019)](https://www.aclweb.org/anthology/P19-1021). You do not need to change anything. Simply running the below will be suitable. "
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "H-TyjtmXB1mL",
        "outputId": "58ecc0c7-4ee9-4f0c-a45a-34340d9f5992",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 423
        }
      },
      "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 Zulu Sentences\"\n",
        "! tail -n 5 test.bpe.$tgt\n",
        "! echo \"Combined BPE Vocab\"\n",
        "! tail -n 10 joeynmt/data/$src$tgt/vocab.txt  # Herman"
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "bpe.codes.4000\tdev.en\t     test.bpe.zu     test.zu\t   train.en\n",
            "dev.bpe.en\tdev.zu\t     test.en\t     train.bpe.en  train.zu\n",
            "dev.bpe.zu\ttest.bpe.en  test.en-any.en  train.bpe.zu\n",
            "bpe.codes.4000\tdev.en\t     test.bpe.zu     test.zu\t   train.en\n",
            "dev.bpe.en\tdev.zu\t     test.en\t     train.bpe.en  train.zu\n",
            "dev.bpe.zu\ttest.bpe.en  test.en-any.en  train.bpe.zu\n",
            "BPE Zulu Sentences\n",
            "Ng@@ en@@ xa yal@@ okho , ng@@ ang@@ aziwa njengom@@ untu ong@@ ath@@ emb@@ ekile .\n",
            "Lapho ng@@ ifunda iqiniso , ngen@@ q@@ aba uku@@ qhubeka nal@@ owo m@@ kh@@ uba , naku@@ ba lo m@@ sebenzi w@@ aw@@ ung@@ ih@@ ol@@ ela kahle kakhulu .\n",
            "Ngiy@@ is@@ ibonelo esi@@ hle em@@ ad@@ od@@ aneni ami amabili futhi seng@@ i@@ ye ng@@ af@@ an@@ el@@ ekela amalungelo eb@@ andl@@ eni .\n",
            "K@@ ub@@ ac@@ wan@@ ingi - m@@ abh@@ uku entela n@@ abanye eng@@ isebenz@@ elana nabo ebh@@ izin@@ is@@ ini , manje seng@@ aziwa njengom@@ untu oth@@ emb@@ ekile . ”\n",
            "U@@ R@@ u@@ the w@@ ath@@ uth@@ ela kw@@ a - Is@@ r@@ ay@@ eli lapho ay@@ ey@@ okw@@ azi khona ukukh@@ ul@@ ekela uN@@ kul@@ un@@ kulu we@@ q@@ iniso .\n",
            "Combined BPE Vocab\n",
            "=\n",
            ")@@\n",
            "ween\n",
            "eduz@@\n",
            "_\n",
            "(\n",
            "gn@@\n",
            "entre\n",
            "ublic\n",
            "_@@\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "IlMitUHR8Qy-",
        "outputId": "30fd0587-314e-4650-d1f7-e78de601ac5e",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 67
        }
      },
      "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\""
      ],
      "execution_count": 0,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "bpe.codes.4000\tdev.en\t     test.bpe.zu     test.zu\t   train.en\n",
            "dev.bpe.en\tdev.zu\t     test.en\t     train.bpe.en  train.zu\n",
            "dev.bpe.zu\ttest.bpe.en  test.en-any.en  train.bpe.zu\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "Ixmzi60WsUZ8"
      },
      "source": [
        "# Creating the JoeyNMT Config\n",
        "\n",
        "JoeyNMT requires a yaml config. We provide a template below. We've also set a number of defaults with it, that you may play with!\n",
        "\n",
        "- We used Transformer architecture \n",
        "- We set our dropout to reasonably high: 0.3 (recommended in  [(Sennrich, 2019)](https://www.aclweb.org/anthology/P19-1021))\n",
        "\n",
        "Things worth playing with:\n",
        "- The batch size (also recommended to change for low-resourced languages)\n",
        "- The number of epochs (we've set it at 30 just so it runs in about an hour, for testing purposes)\n",
        "- The decoder options (beam_size, alpha)\n",
        "- Evaluation metrics (BLEU versus Crhf4)"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "PIs1lY2hxMsl",
        "colab": {}
      },
      "source": [
        "# This creates the config file for our JoeyNMT system. It might seem overwhelming so we've provided a couple of useful parameters you'll need to update\n",
        "# (You can of course play with all the parameters if you'd like!)\n",
        "\n",
        "name = '%s%s' % (source_language, target_language)\n",
        "gdrive_path = os.environ[\"gdrive_path\"]\n",
        "\n",
        "# Create the config\n",
        "config = \"\"\"\n",
        "name: \"{name}_transformer\"\n",
        "\n",
        "data:\n",
        "    src: \"{source_language}\"\n",
        "    trg: \"{target_language}\"\n",
        "    train: \"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: 100                     # TODO: Decrease for when playing around and checking of working. Around 30 is sufficient to check if its working at all\n",
        "    validation_freq: 2000          # 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)"
      ],
      "execution_count": 0,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "colab_type": "text",
        "id": "pIifxE3Qzuvs"
      },
      "source": [
        "# Train the Model\n",
        "\n",
        "This single line of joeynmt runs the training using the config we made above"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "6ZBPFwT94WpI",
        "outputId": "1fc92b7e-75bf-4363-da15-192f14bdcc9b",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000
        }
      },
      "source": [
        "# Train the model\n",
        "# You can press Ctrl-C to stop. And then run the next cell to save your checkpoints! \n",
        "!cd joeynmt; python3 -m joeynmt train configs/transformer_$src$tgt.yaml"
      ],
      "execution_count": 15,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "2019-11-26 09:19:27,165 Hello! This is Joey-NMT.\n",
            "2019-11-26 09:19:28,525 Total params: 12123392\n",
            "2019-11-26 09:19:28,527 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 09:19:34,587 cfg.name                           : enzu_transformer\n",
            "2019-11-26 09:19:34,587 cfg.data.src                       : en\n",
            "2019-11-26 09:19:34,587 cfg.data.trg                       : zu\n",
            "2019-11-26 09:19:34,587 cfg.data.train                     : data/enzu/train.bpe\n",
            "2019-11-26 09:19:34,587 cfg.data.dev                       : data/enzu/dev.bpe\n",
            "2019-11-26 09:19:34,587 cfg.data.test                      : data/enzu/test.bpe\n",
            "2019-11-26 09:19:34,587 cfg.data.level                     : bpe\n",
            "2019-11-26 09:19:34,587 cfg.data.lowercase                 : False\n",
            "2019-11-26 09:19:34,588 cfg.data.max_sent_length           : 100\n",
            "2019-11-26 09:19:34,588 cfg.data.src_vocab                 : data/enzu/vocab.txt\n",
            "2019-11-26 09:19:34,588 cfg.data.trg_vocab                 : data/enzu/vocab.txt\n",
            "2019-11-26 09:19:34,588 cfg.testing.beam_size              : 5\n",
            "2019-11-26 09:19:34,588 cfg.testing.alpha                  : 1.0\n",
            "2019-11-26 09:19:34,588 cfg.training.random_seed           : 42\n",
            "2019-11-26 09:19:34,588 cfg.training.optimizer             : adam\n",
            "2019-11-26 09:19:34,588 cfg.training.normalization         : tokens\n",
            "2019-11-26 09:19:34,588 cfg.training.adam_betas            : [0.9, 0.999]\n",
            "2019-11-26 09:19:34,588 cfg.training.scheduling            : plateau\n",
            "2019-11-26 09:19:34,588 cfg.training.patience              : 5\n",
            "2019-11-26 09:19:34,588 cfg.training.learning_rate_factor  : 0.5\n",
            "2019-11-26 09:19:34,588 cfg.training.learning_rate_warmup  : 1000\n",
            "2019-11-26 09:19:34,588 cfg.training.decrease_factor       : 0.7\n",
            "2019-11-26 09:19:34,588 cfg.training.loss                  : crossentropy\n",
            "2019-11-26 09:19:34,588 cfg.training.learning_rate         : 0.0003\n",
            "2019-11-26 09:19:34,589 cfg.training.learning_rate_min     : 1e-08\n",
            "2019-11-26 09:19:34,589 cfg.training.weight_decay          : 0.0\n",
            "2019-11-26 09:19:34,589 cfg.training.label_smoothing       : 0.1\n",
            "2019-11-26 09:19:34,589 cfg.training.batch_size            : 4096\n",
            "2019-11-26 09:19:34,589 cfg.training.batch_type            : token\n",
            "2019-11-26 09:19:34,589 cfg.training.eval_batch_size       : 3600\n",
            "2019-11-26 09:19:34,589 cfg.training.eval_batch_type       : token\n",
            "2019-11-26 09:19:34,589 cfg.training.batch_multiplier      : 1\n",
            "2019-11-26 09:19:34,589 cfg.training.early_stopping_metric : ppl\n",
            "2019-11-26 09:19:34,589 cfg.training.epochs                : 100\n",
            "2019-11-26 09:19:34,589 cfg.training.validation_freq       : 2000\n",
            "2019-11-26 09:19:34,589 cfg.training.logging_freq          : 100\n",
            "2019-11-26 09:19:34,589 cfg.training.eval_metric           : bleu\n",
            "2019-11-26 09:19:34,589 cfg.training.model_dir             : models/enzu_transformer\n",
            "2019-11-26 09:19:34,589 cfg.training.overwrite             : False\n",
            "2019-11-26 09:19:34,589 cfg.training.shuffle               : True\n",
            "2019-11-26 09:19:34,589 cfg.training.use_cuda              : True\n",
            "2019-11-26 09:19:34,589 cfg.training.max_output_length     : 100\n",
            "2019-11-26 09:19:34,590 cfg.training.print_valid_sents     : [0, 1, 2, 3]\n",
            "2019-11-26 09:19:34,590 cfg.training.keep_last_ckpts       : 3\n",
            "2019-11-26 09:19:34,590 cfg.model.initializer              : xavier\n",
            "2019-11-26 09:19:34,590 cfg.model.bias_initializer         : zeros\n",
            "2019-11-26 09:19:34,590 cfg.model.init_gain                : 1.0\n",
            "2019-11-26 09:19:34,590 cfg.model.embed_initializer        : xavier\n",
            "2019-11-26 09:19:34,590 cfg.model.embed_init_gain          : 1.0\n",
            "2019-11-26 09:19:34,590 cfg.model.tied_embeddings          : True\n",
            "2019-11-26 09:19:34,590 cfg.model.tied_softmax             : True\n",
            "2019-11-26 09:19:34,590 cfg.model.encoder.type             : transformer\n",
            "2019-11-26 09:19:34,590 cfg.model.encoder.num_layers       : 6\n",
            "2019-11-26 09:19:34,590 cfg.model.encoder.num_heads        : 4\n",
            "2019-11-26 09:19:34,590 cfg.model.encoder.embeddings.embedding_dim : 256\n",
            "2019-11-26 09:19:34,590 cfg.model.encoder.embeddings.scale : True\n",
            "2019-11-26 09:19:34,590 cfg.model.encoder.embeddings.dropout : 0.2\n",
            "2019-11-26 09:19:34,590 cfg.model.encoder.hidden_size      : 256\n",
            "2019-11-26 09:19:34,590 cfg.model.encoder.ff_size          : 1024\n",
            "2019-11-26 09:19:34,591 cfg.model.encoder.dropout          : 0.3\n",
            "2019-11-26 09:19:34,591 cfg.model.decoder.type             : transformer\n",
            "2019-11-26 09:19:34,591 cfg.model.decoder.num_layers       : 6\n",
            "2019-11-26 09:19:34,591 cfg.model.decoder.num_heads        : 4\n",
            "2019-11-26 09:19:34,591 cfg.model.decoder.embeddings.embedding_dim : 256\n",
            "2019-11-26 09:19:34,591 cfg.model.decoder.embeddings.scale : True\n",
            "2019-11-26 09:19:34,591 cfg.model.decoder.embeddings.dropout : 0.2\n",
            "2019-11-26 09:19:34,591 cfg.model.decoder.hidden_size      : 256\n",
            "2019-11-26 09:19:34,591 cfg.model.decoder.ff_size          : 1024\n",
            "2019-11-26 09:19:34,591 cfg.model.decoder.dropout          : 0.3\n",
            "2019-11-26 09:19:34,591 Data set sizes: \n",
            "\ttrain 21971,\n",
            "\tvalid 1000,\n",
            "\ttest 2711\n",
            "2019-11-26 09:19:34,591 First training example:\n",
            "\t[SRC] I will develop a policy that will ensure w@@ id@@ er acc@@ ess@@ ibility and in@@ clus@@ iv@@ ity for all our people throug@@ h@@ out this province .\n",
            "\t[TRG] Y@@ il@@ apho i@@ T@@ R@@ C in@@ x@@ eph@@ ez@@ ele khona ub@@ uhl@@ ungu ob@@ un@@ ingi ob@@ ud@@ inga iz@@ id@@ ud@@ uzo ukuze kwel@@ aph@@ eke i@@ kus@@ asa lethu .\n",
            "2019-11-26 09:19:34,591 First 10 words (src): (0) <unk> (1) <pad> (2) <s> (3) </s> (4) . (5) , (6) the (7) of (8) and (9) to\n",
            "2019-11-26 09:19:34,592 First 10 words (trg): (0) <unk> (1) <pad> (2) <s> (3) </s> (4) . (5) , (6) the (7) of (8) and (9) to\n",
            "2019-11-26 09:19:34,592 Number of Src words (types): 4153\n",
            "2019-11-26 09:19:34,592 Number of Trg words (types): 4153\n",
            "2019-11-26 09:19:34,592 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=4153),\n",
            "\ttrg_embed=Embeddings(embedding_dim=256, vocab_size=4153))\n",
            "2019-11-26 09:19:34,596 EPOCH 1\n",
            "2019-11-26 09:19:46,393 Epoch   1 Step:      100 Batch Loss:     6.014598 Tokens per Sec:    19456, Lr: 0.000300\n",
            "2019-11-26 09:19:58,240 Epoch   1 Step:      200 Batch Loss:     6.020504 Tokens per Sec:    20193, Lr: 0.000300\n",
            "2019-11-26 09:20:09,890 Epoch   1 Step:      300 Batch Loss:     5.797283 Tokens per Sec:    19899, Lr: 0.000300\n",
            "2019-11-26 09:20:10,140 Epoch   1: total training loss 1820.56\n",
            "2019-11-26 09:20:10,140 EPOCH 2\n",
            "2019-11-26 09:20:21,735 Epoch   2 Step:      400 Batch Loss:     5.558404 Tokens per Sec:    19605, Lr: 0.000300\n",
            "2019-11-26 09:20:33,514 Epoch   2 Step:      500 Batch Loss:     5.610485 Tokens per Sec:    20147, Lr: 0.000300\n",
            "2019-11-26 09:20:45,122 Epoch   2 Step:      600 Batch Loss:     5.346512 Tokens per Sec:    19709, Lr: 0.000300\n",
            "2019-11-26 09:20:45,830 Epoch   2: total training loss 1699.15\n",
            "2019-11-26 09:20:45,830 EPOCH 3\n",
            "2019-11-26 09:20:56,882 Epoch   3 Step:      700 Batch Loss:     5.338718 Tokens per Sec:    20118, Lr: 0.000300\n",
            "2019-11-26 09:21:08,570 Epoch   3 Step:      800 Batch Loss:     5.125825 Tokens per Sec:    20001, Lr: 0.000300\n",
            "2019-11-26 09:21:20,236 Epoch   3 Step:      900 Batch Loss:     5.219011 Tokens per Sec:    19892, Lr: 0.000300\n",
            "2019-11-26 09:21:21,194 Epoch   3: total training loss 1567.79\n",
            "2019-11-26 09:21:21,194 EPOCH 4\n",
            "2019-11-26 09:21:32,085 Epoch   4 Step:     1000 Batch Loss:     5.180074 Tokens per Sec:    19949, Lr: 0.000300\n",
            "2019-11-26 09:21:43,780 Epoch   4 Step:     1100 Batch Loss:     5.023007 Tokens per Sec:    19795, Lr: 0.000300\n",
            "2019-11-26 09:21:55,370 Epoch   4 Step:     1200 Batch Loss:     4.834898 Tokens per Sec:    20100, Lr: 0.000300\n",
            "2019-11-26 09:21:56,553 Epoch   4: total training loss 1480.84\n",
            "2019-11-26 09:21:56,553 EPOCH 5\n",
            "2019-11-26 09:22:07,024 Epoch   5 Step:     1300 Batch Loss:     4.523750 Tokens per Sec:    19870, Lr: 0.000300\n",
            "2019-11-26 09:22:18,684 Epoch   5 Step:     1400 Batch Loss:     4.742941 Tokens per Sec:    20360, Lr: 0.000300\n",
            "2019-11-26 09:22:30,326 Epoch   5 Step:     1500 Batch Loss:     4.729240 Tokens per Sec:    19826, Lr: 0.000300\n",
            "2019-11-26 09:22:31,905 Epoch   5: total training loss 1408.46\n",
            "2019-11-26 09:22:31,905 EPOCH 6\n",
            "2019-11-26 09:22:41,947 Epoch   6 Step:     1600 Batch Loss:     4.637106 Tokens per Sec:    20198, Lr: 0.000300\n",
            "2019-11-26 09:22:53,673 Epoch   6 Step:     1700 Batch Loss:     3.763817 Tokens per Sec:    19896, Lr: 0.000300\n",
            "2019-11-26 09:23:05,419 Epoch   6 Step:     1800 Batch Loss:     4.441916 Tokens per Sec:    20011, Lr: 0.000300\n",
            "2019-11-26 09:23:07,154 Epoch   6: total training loss 1307.41\n",
            "2019-11-26 09:23:07,154 EPOCH 7\n",
            "2019-11-26 09:23:17,178 Epoch   7 Step:     1900 Batch Loss:     4.159864 Tokens per Sec:    20246, Lr: 0.000300\n",
            "2019-11-26 09:23:28,795 Epoch   7 Step:     2000 Batch Loss:     4.072814 Tokens per Sec:    20260, Lr: 0.000300\n",
            "2019-11-26 09:23:59,295 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 09:23:59,296 Saving new checkpoint.\n",
            "2019-11-26 09:23:59,534 Example #0\n",
            "2019-11-26 09:23:59,535 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 09:23:59,535 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 09:23:59,535 \tHypothesis: USihlalo Wokuqala uSihlalo wase Sinethi , uNgqongqoshe wenza ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa ukuthi kuhlanganisa .\n",
            "2019-11-26 09:23:59,535 Example #1\n",
            "2019-11-26 09:23:59,535 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 09:23:59,535 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 09:23:59,535 \tHypothesis: Ngenxa yokuba ngizenzo zihlo zempilo , kanye nokusebenza kwamandla , kanye nokusebenza kwamandla , kanye nokusebenza kwamandla kanye nokusebenza kwamanzi .\n",
            "2019-11-26 09:23:59,536 Example #2\n",
            "2019-11-26 09:23:59,536 \tSource:     Information about government services\n",
            "2019-11-26 09:23:59,536 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 09:23:59,536 \tHypothesis: Ukubambisana kwamandla okusebenza kwempahla\n",
            "2019-11-26 09:23:59,536 Example #3\n",
            "2019-11-26 09:23:59,536 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 09:23:59,536 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 09:23:59,536 \tHypothesis: Ukubambisana nokusebenza kwamandla kanye nokusebenza kwamandla kanye nokusebenza kwamandla , kanye nokusebenza kwamandla , kanye nokusebenza kwamandla , kanye nokuguqula , kanye nokusebenza kwamandla .\n",
            "2019-11-26 09:23:59,536 Validation result (greedy) at epoch   7, step     2000: bleu:   0.43, loss: 131604.1719, ppl:  56.3034, duration: 30.7409s\n",
            "2019-11-26 09:24:11,239 Epoch   7 Step:     2100 Batch Loss:     4.050443 Tokens per Sec:    19570, Lr: 0.000300\n",
            "2019-11-26 09:24:13,243 Epoch   7: total training loss 1239.71\n",
            "2019-11-26 09:24:13,243 EPOCH 8\n",
            "2019-11-26 09:24:23,014 Epoch   8 Step:     2200 Batch Loss:     3.443318 Tokens per Sec:    19599, Lr: 0.000300\n",
            "2019-11-26 09:24:34,995 Epoch   8 Step:     2300 Batch Loss:     3.907634 Tokens per Sec:    20437, Lr: 0.000300\n",
            "2019-11-26 09:24:46,691 Epoch   8 Step:     2400 Batch Loss:     3.817729 Tokens per Sec:    19617, Lr: 0.000300\n",
            "2019-11-26 09:24:48,698 Epoch   8: total training loss 1174.19\n",
            "2019-11-26 09:24:48,698 EPOCH 9\n",
            "2019-11-26 09:24:58,473 Epoch   9 Step:     2500 Batch Loss:     3.625718 Tokens per Sec:    20015, Lr: 0.000300\n",
            "2019-11-26 09:25:10,086 Epoch   9 Step:     2600 Batch Loss:     3.343301 Tokens per Sec:    19731, Lr: 0.000300\n",
            "2019-11-26 09:25:21,878 Epoch   9 Step:     2700 Batch Loss:     3.795723 Tokens per Sec:    19975, Lr: 0.000300\n",
            "2019-11-26 09:25:24,209 Epoch   9: total training loss 1142.71\n",
            "2019-11-26 09:25:24,209 EPOCH 10\n",
            "2019-11-26 09:25:33,729 Epoch  10 Step:     2800 Batch Loss:     3.260421 Tokens per Sec:    19749, Lr: 0.000300\n",
            "2019-11-26 09:25:45,599 Epoch  10 Step:     2900 Batch Loss:     3.896484 Tokens per Sec:    19640, Lr: 0.000300\n",
            "2019-11-26 09:25:57,451 Epoch  10 Step:     3000 Batch Loss:     3.821677 Tokens per Sec:    19864, Lr: 0.000300\n",
            "2019-11-26 09:25:59,923 Epoch  10: total training loss 1099.30\n",
            "2019-11-26 09:25:59,923 EPOCH 11\n",
            "2019-11-26 09:26:09,209 Epoch  11 Step:     3100 Batch Loss:     3.671860 Tokens per Sec:    19244, Lr: 0.000300\n",
            "2019-11-26 09:26:21,094 Epoch  11 Step:     3200 Batch Loss:     3.208810 Tokens per Sec:    20119, Lr: 0.000300\n",
            "2019-11-26 09:26:33,021 Epoch  11 Step:     3300 Batch Loss:     3.585919 Tokens per Sec:    20014, Lr: 0.000300\n",
            "2019-11-26 09:26:35,649 Epoch  11: total training loss 1068.27\n",
            "2019-11-26 09:26:35,649 EPOCH 12\n",
            "2019-11-26 09:26:44,945 Epoch  12 Step:     3400 Batch Loss:     3.671380 Tokens per Sec:    19941, Lr: 0.000300\n",
            "2019-11-26 09:26:56,804 Epoch  12 Step:     3500 Batch Loss:     3.716089 Tokens per Sec:    20214, Lr: 0.000300\n",
            "2019-11-26 09:27:08,608 Epoch  12 Step:     3600 Batch Loss:     3.491008 Tokens per Sec:    19496, Lr: 0.000300\n",
            "2019-11-26 09:27:11,352 Epoch  12: total training loss 1044.92\n",
            "2019-11-26 09:27:11,353 EPOCH 13\n",
            "2019-11-26 09:27:20,367 Epoch  13 Step:     3700 Batch Loss:     3.676591 Tokens per Sec:    20073, Lr: 0.000300\n",
            "2019-11-26 09:27:32,102 Epoch  13 Step:     3800 Batch Loss:     3.411591 Tokens per Sec:    19712, Lr: 0.000300\n",
            "2019-11-26 09:27:43,862 Epoch  13 Step:     3900 Batch Loss:     3.570380 Tokens per Sec:    20023, Lr: 0.000300\n",
            "2019-11-26 09:27:46,806 Epoch  13: total training loss 1016.23\n",
            "2019-11-26 09:27:46,806 EPOCH 14\n",
            "2019-11-26 09:27:55,735 Epoch  14 Step:     4000 Batch Loss:     3.285077 Tokens per Sec:    20104, Lr: 0.000300\n",
            "2019-11-26 09:28:26,154 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 09:28:26,154 Saving new checkpoint.\n",
            "2019-11-26 09:28:26,374 Example #0\n",
            "2019-11-26 09:28:26,374 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 09:28:26,374 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 09:28:26,374 \tHypothesis: UMnu Melson wavakashela uBlako wagcina ukuthi uhambe iqhaza ekusebenzeni kweNyakatho , kumele kube yingxenye yabantu bethu , bethu bethu bethu bethu bethu bethu .\n",
            "2019-11-26 09:28:26,374 Example #1\n",
            "2019-11-26 09:28:26,375 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 09:28:26,375 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 09:28:26,375 \tHypothesis: Kusukela kulokhu kulokhu kulokhu kuhulumeni , sikwazi ukuqhubeka nokusobala , senze ngcono izinga lokuphila komnotho wethu .\n",
            "2019-11-26 09:28:26,375 Example #2\n",
            "2019-11-26 09:28:26,375 \tSource:     Information about government services\n",
            "2019-11-26 09:28:26,375 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 09:28:26,375 \tHypothesis: Ukuze uthole olunye ulwazi olulandelayo\n",
            "2019-11-26 09:28:26,375 Example #3\n",
            "2019-11-26 09:28:26,376 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 09:28:26,376 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 09:28:26,376 \tHypothesis: Ukubambisana kwabantu bethu bethu bethu bethu bethu bethu bethu bethu bethu , bakhombisa ukuthi baqinisekise izinhlangano zasemakhaya , kanye nokuguquka kwamanzi .\n",
            "2019-11-26 09:28:26,376 Validation result (greedy) at epoch  14, step     4000: bleu:   1.32, loss: 109456.8438, ppl:  28.5721, duration: 30.6410s\n",
            "2019-11-26 09:28:38,294 Epoch  14 Step:     4100 Batch Loss:     3.002442 Tokens per Sec:    19972, Lr: 0.000300\n",
            "2019-11-26 09:28:50,039 Epoch  14 Step:     4200 Batch Loss:     3.352092 Tokens per Sec:    19529, Lr: 0.000300\n",
            "2019-11-26 09:28:53,092 Epoch  14: total training loss 993.31\n",
            "2019-11-26 09:28:53,092 EPOCH 15\n",
            "2019-11-26 09:29:01,926 Epoch  15 Step:     4300 Batch Loss:     3.498097 Tokens per Sec:    19624, Lr: 0.000300\n",
            "2019-11-26 09:29:13,708 Epoch  15 Step:     4400 Batch Loss:     2.788840 Tokens per Sec:    20071, Lr: 0.000300\n",
            "2019-11-26 09:29:25,635 Epoch  15 Step:     4500 Batch Loss:     3.091094 Tokens per Sec:    20021, Lr: 0.000300\n",
            "2019-11-26 09:29:28,592 Epoch  15: total training loss 966.89\n",
            "2019-11-26 09:29:28,592 EPOCH 16\n",
            "2019-11-26 09:29:37,503 Epoch  16 Step:     4600 Batch Loss:     3.239462 Tokens per Sec:    19840, Lr: 0.000300\n",
            "2019-11-26 09:29:49,309 Epoch  16 Step:     4700 Batch Loss:     3.408063 Tokens per Sec:    19817, Lr: 0.000300\n",
            "2019-11-26 09:30:01,134 Epoch  16 Step:     4800 Batch Loss:     3.222301 Tokens per Sec:    19941, Lr: 0.000300\n",
            "2019-11-26 09:30:04,188 Epoch  16: total training loss 960.03\n",
            "2019-11-26 09:30:04,189 EPOCH 17\n",
            "2019-11-26 09:30:12,972 Epoch  17 Step:     4900 Batch Loss:     2.723516 Tokens per Sec:    19879, Lr: 0.000300\n",
            "2019-11-26 09:30:24,786 Epoch  17 Step:     5000 Batch Loss:     3.252052 Tokens per Sec:    19789, Lr: 0.000300\n",
            "2019-11-26 09:30:36,611 Epoch  17 Step:     5100 Batch Loss:     3.282178 Tokens per Sec:    19993, Lr: 0.000300\n",
            "2019-11-26 09:30:39,870 Epoch  17: total training loss 941.43\n",
            "2019-11-26 09:30:39,870 EPOCH 18\n",
            "2019-11-26 09:30:48,350 Epoch  18 Step:     5200 Batch Loss:     2.363747 Tokens per Sec:    19378, Lr: 0.000300\n",
            "2019-11-26 09:31:00,242 Epoch  18 Step:     5300 Batch Loss:     3.022170 Tokens per Sec:    19827, Lr: 0.000300\n",
            "2019-11-26 09:31:12,154 Epoch  18 Step:     5400 Batch Loss:     3.130815 Tokens per Sec:    19850, Lr: 0.000300\n",
            "2019-11-26 09:31:15,670 Epoch  18: total training loss 921.85\n",
            "2019-11-26 09:31:15,671 EPOCH 19\n",
            "2019-11-26 09:31:23,928 Epoch  19 Step:     5500 Batch Loss:     3.067315 Tokens per Sec:    19738, Lr: 0.000300\n",
            "2019-11-26 09:31:35,708 Epoch  19 Step:     5600 Batch Loss:     2.786340 Tokens per Sec:    19638, Lr: 0.000300\n",
            "2019-11-26 09:31:47,606 Epoch  19 Step:     5700 Batch Loss:     2.969923 Tokens per Sec:    19849, Lr: 0.000300\n",
            "2019-11-26 09:31:51,398 Epoch  19: total training loss 905.89\n",
            "2019-11-26 09:31:51,398 EPOCH 20\n",
            "2019-11-26 09:31:59,506 Epoch  20 Step:     5800 Batch Loss:     2.604557 Tokens per Sec:    19615, Lr: 0.000300\n",
            "2019-11-26 09:32:11,314 Epoch  20 Step:     5900 Batch Loss:     2.769141 Tokens per Sec:    20195, Lr: 0.000300\n",
            "2019-11-26 09:32:23,087 Epoch  20 Step:     6000 Batch Loss:     2.985947 Tokens per Sec:    19977, Lr: 0.000300\n",
            "2019-11-26 09:32:53,619 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 09:32:53,619 Saving new checkpoint.\n",
            "2019-11-26 09:32:53,833 Example #0\n",
            "2019-11-26 09:32:53,834 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 09:32:53,834 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 09:32:53,834 \tHypothesis: U-Inyanga Madadado Zondi wayengumphumela wokuphatha kwezombusazwe , uAnanse waba , kumele kube yingxenye yabantu , bethu bethu .\n",
            "2019-11-26 09:32:53,834 Example #1\n",
            "2019-11-26 09:32:53,834 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 09:32:53,834 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 09:32:53,834 \tHypothesis: Kusukela ekuthuthukiseni ubudlelwane bentando yeningi , sibe yisisekelo sentando yeningi sethu sethu sikwazi ukuqhubeka nomphakathi wentando yeningi .\n",
            "2019-11-26 09:32:53,834 Example #2\n",
            "2019-11-26 09:32:53,834 \tSource:     Information about government services\n",
            "2019-11-26 09:32:53,834 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 09:32:53,834 \tHypothesis: Ukubika uhulumeni\n",
            "2019-11-26 09:32:53,834 Example #3\n",
            "2019-11-26 09:32:53,835 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 09:32:53,835 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 09:32:53,835 \tHypothesis: Ukuphucula abantu abaningi kanye nabantu abangenawo wonke umuntu , bakhombisa ukuthi bakhiphe ngokusebenzisa , ukuqhathanisa , ukuqhathanisa .\n",
            "2019-11-26 09:32:53,835 Validation result (greedy) at epoch  20, step     6000: bleu:   2.24, loss: 99408.1094, ppl:  21.0029, duration: 30.7477s\n",
            "2019-11-26 09:32:57,813 Epoch  20: total training loss 890.87\n",
            "2019-11-26 09:32:57,813 EPOCH 21\n",
            "2019-11-26 09:33:05,674 Epoch  21 Step:     6100 Batch Loss:     2.922477 Tokens per Sec:    20342, Lr: 0.000300\n",
            "2019-11-26 09:33:17,496 Epoch  21 Step:     6200 Batch Loss:     3.037483 Tokens per Sec:    19730, Lr: 0.000300\n",
            "2019-11-26 09:33:29,220 Epoch  21 Step:     6300 Batch Loss:     2.373279 Tokens per Sec:    19495, Lr: 0.000300\n",
            "2019-11-26 09:33:33,402 Epoch  21: total training loss 872.95\n",
            "2019-11-26 09:33:33,402 EPOCH 22\n",
            "2019-11-26 09:33:41,150 Epoch  22 Step:     6400 Batch Loss:     3.001296 Tokens per Sec:    19956, Lr: 0.000300\n",
            "2019-11-26 09:33:52,794 Epoch  22 Step:     6500 Batch Loss:     3.096929 Tokens per Sec:    19332, Lr: 0.000300\n",
            "2019-11-26 09:34:04,761 Epoch  22 Step:     6600 Batch Loss:     2.949541 Tokens per Sec:    20263, Lr: 0.000300\n",
            "2019-11-26 09:34:09,086 Epoch  22: total training loss 861.12\n",
            "2019-11-26 09:34:09,087 EPOCH 23\n",
            "2019-11-26 09:34:16,504 Epoch  23 Step:     6700 Batch Loss:     2.085219 Tokens per Sec:    19674, Lr: 0.000300\n",
            "2019-11-26 09:34:28,326 Epoch  23 Step:     6800 Batch Loss:     3.027412 Tokens per Sec:    19861, Lr: 0.000300\n",
            "2019-11-26 09:34:40,238 Epoch  23 Step:     6900 Batch Loss:     2.656871 Tokens per Sec:    20105, Lr: 0.000300\n",
            "2019-11-26 09:34:44,610 Epoch  23: total training loss 842.78\n",
            "2019-11-26 09:34:44,611 EPOCH 24\n",
            "2019-11-26 09:34:52,054 Epoch  24 Step:     7000 Batch Loss:     2.938528 Tokens per Sec:    19789, Lr: 0.000300\n",
            "2019-11-26 09:35:03,922 Epoch  24 Step:     7100 Batch Loss:     3.122504 Tokens per Sec:    19804, Lr: 0.000300\n",
            "2019-11-26 09:35:15,734 Epoch  24 Step:     7200 Batch Loss:     2.871222 Tokens per Sec:    20001, Lr: 0.000300\n",
            "2019-11-26 09:35:20,281 Epoch  24: total training loss 835.14\n",
            "2019-11-26 09:35:20,282 EPOCH 25\n",
            "2019-11-26 09:35:27,524 Epoch  25 Step:     7300 Batch Loss:     3.009821 Tokens per Sec:    19475, Lr: 0.000300\n",
            "2019-11-26 09:35:39,374 Epoch  25 Step:     7400 Batch Loss:     3.009806 Tokens per Sec:    19993, Lr: 0.000300\n",
            "2019-11-26 09:35:51,293 Epoch  25 Step:     7500 Batch Loss:     2.874641 Tokens per Sec:    20068, Lr: 0.000300\n",
            "2019-11-26 09:35:56,063 Epoch  25: total training loss 822.51\n",
            "2019-11-26 09:35:56,063 EPOCH 26\n",
            "2019-11-26 09:36:03,126 Epoch  26 Step:     7600 Batch Loss:     2.465379 Tokens per Sec:    20176, Lr: 0.000300\n",
            "2019-11-26 09:36:14,890 Epoch  26 Step:     7700 Batch Loss:     2.833760 Tokens per Sec:    19524, Lr: 0.000300\n",
            "2019-11-26 09:36:26,703 Epoch  26 Step:     7800 Batch Loss:     2.880417 Tokens per Sec:    19596, Lr: 0.000300\n",
            "2019-11-26 09:36:31,891 Epoch  26: total training loss 812.62\n",
            "2019-11-26 09:36:31,891 EPOCH 27\n",
            "2019-11-26 09:36:38,472 Epoch  27 Step:     7900 Batch Loss:     2.774757 Tokens per Sec:    19278, Lr: 0.000300\n",
            "2019-11-26 09:36:50,372 Epoch  27 Step:     8000 Batch Loss:     2.816342 Tokens per Sec:    19676, Lr: 0.000300\n",
            "2019-11-26 09:37:20,978 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 09:37:20,978 Saving new checkpoint.\n",
            "2019-11-26 09:37:21,233 Example #0\n",
            "2019-11-26 09:37:21,233 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 09:37:21,233 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 09:37:21,234 \tHypothesis: Inkosi uMbongeleni Zondi wayengumcimbi wobuphofu wobuphofu kumele ukuba yenze isizwe sase-Inkosi , kumele senze ngcono ukuthuthukisa abantu bethu .\n",
            "2019-11-26 09:37:21,234 Example #1\n",
            "2019-11-26 09:37:21,234 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 09:37:21,234 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 09:37:21,234 \tHypothesis: Kusukela ekuqaleni kwethu ekuthuthukiseni ubudlelwane obandlululo , sethu sethu sethu sibe nabantu bethu bethu bethu bethu bahlala ngokuhambisana nohlelo lwabantu .\n",
            "2019-11-26 09:37:21,234 Example #2\n",
            "2019-11-26 09:37:21,234 \tSource:     Information about government services\n",
            "2019-11-26 09:37:21,234 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 09:37:21,234 \tHypothesis: Ulwazi oluphathelene nokusebenza kawonkewonke\n",
            "2019-11-26 09:37:21,234 Example #3\n",
            "2019-11-26 09:37:21,235 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 09:37:21,235 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 09:37:21,235 \tHypothesis: Ukuhlela abantu abaningi kanye nabantu abahlala kanye nokuhlala abantu abahluphekayo kuyingxenye yabantu , ngokwezinga eliphansi , ukungabi nendawo kanye nokungathuthuki .\n",
            "2019-11-26 09:37:21,235 Validation result (greedy) at epoch  27, step     8000: bleu:   3.49, loss: 93906.0781, ppl:  17.7457, duration: 30.8626s\n",
            "2019-11-26 09:37:33,295 Epoch  27 Step:     8100 Batch Loss:     2.764268 Tokens per Sec:    20020, Lr: 0.000300\n",
            "2019-11-26 09:37:38,619 Epoch  27: total training loss 796.16\n",
            "2019-11-26 09:37:38,619 EPOCH 28\n",
            "2019-11-26 09:37:45,207 Epoch  28 Step:     8200 Batch Loss:     2.759162 Tokens per Sec:    19875, Lr: 0.000300\n",
            "2019-11-26 09:37:56,961 Epoch  28 Step:     8300 Batch Loss:     2.780548 Tokens per Sec:    19229, Lr: 0.000300\n",
            "2019-11-26 09:38:08,905 Epoch  28 Step:     8400 Batch Loss:     2.711523 Tokens per Sec:    20232, Lr: 0.000300\n",
            "2019-11-26 09:38:14,522 Epoch  28: total training loss 789.56\n",
            "2019-11-26 09:38:14,523 EPOCH 29\n",
            "2019-11-26 09:38:20,683 Epoch  29 Step:     8500 Batch Loss:     2.577688 Tokens per Sec:    19782, Lr: 0.000300\n",
            "2019-11-26 09:38:32,558 Epoch  29 Step:     8600 Batch Loss:     2.241548 Tokens per Sec:    19643, Lr: 0.000300\n",
            "2019-11-26 09:38:44,356 Epoch  29 Step:     8700 Batch Loss:     2.647722 Tokens per Sec:    19742, Lr: 0.000300\n",
            "2019-11-26 09:38:50,358 Epoch  29: total training loss 780.69\n",
            "2019-11-26 09:38:50,359 EPOCH 30\n",
            "2019-11-26 09:38:56,175 Epoch  30 Step:     8800 Batch Loss:     2.866000 Tokens per Sec:    19519, Lr: 0.000300\n",
            "2019-11-26 09:39:08,069 Epoch  30 Step:     8900 Batch Loss:     2.873990 Tokens per Sec:    20028, Lr: 0.000300\n",
            "2019-11-26 09:39:19,927 Epoch  30 Step:     9000 Batch Loss:     2.631161 Tokens per Sec:    20046, Lr: 0.000300\n",
            "2019-11-26 09:39:25,759 Epoch  30: total training loss 756.54\n",
            "2019-11-26 09:39:25,759 EPOCH 31\n",
            "2019-11-26 09:39:31,849 Epoch  31 Step:     9100 Batch Loss:     2.022643 Tokens per Sec:    19608, Lr: 0.000300\n",
            "2019-11-26 09:39:43,747 Epoch  31 Step:     9200 Batch Loss:     2.863181 Tokens per Sec:    20119, Lr: 0.000300\n",
            "2019-11-26 09:39:55,466 Epoch  31 Step:     9300 Batch Loss:     2.638505 Tokens per Sec:    19505, Lr: 0.000300\n",
            "2019-11-26 09:40:01,556 Epoch  31: total training loss 759.67\n",
            "2019-11-26 09:40:01,556 EPOCH 32\n",
            "2019-11-26 09:40:07,282 Epoch  32 Step:     9400 Batch Loss:     1.769421 Tokens per Sec:    19935, Lr: 0.000300\n",
            "2019-11-26 09:40:19,173 Epoch  32 Step:     9500 Batch Loss:     2.622677 Tokens per Sec:    19912, Lr: 0.000300\n",
            "2019-11-26 09:40:30,973 Epoch  32 Step:     9600 Batch Loss:     2.689215 Tokens per Sec:    19466, Lr: 0.000300\n",
            "2019-11-26 09:40:37,306 Epoch  32: total training loss 746.31\n",
            "2019-11-26 09:40:37,306 EPOCH 33\n",
            "2019-11-26 09:40:42,965 Epoch  33 Step:     9700 Batch Loss:     1.672317 Tokens per Sec:    20210, Lr: 0.000300\n",
            "2019-11-26 09:40:54,755 Epoch  33 Step:     9800 Batch Loss:     2.811683 Tokens per Sec:    19706, Lr: 0.000300\n",
            "2019-11-26 09:41:06,569 Epoch  33 Step:     9900 Batch Loss:     2.428610 Tokens per Sec:    19618, Lr: 0.000300\n",
            "2019-11-26 09:41:13,141 Epoch  33: total training loss 738.10\n",
            "2019-11-26 09:41:13,141 EPOCH 34\n",
            "2019-11-26 09:41:18,535 Epoch  34 Step:    10000 Batch Loss:     2.664236 Tokens per Sec:    19783, Lr: 0.000300\n",
            "2019-11-26 09:41:49,130 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 09:41:49,130 Saving new checkpoint.\n",
            "2019-11-26 09:41:49,382 Example #0\n",
            "2019-11-26 09:41:49,383 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 09:41:49,383 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 09:41:49,383 \tHypothesis: Inkosi uMbongeleni Zondi wayesebenza ngokuhlanganyela mayelana nokusebenza kwe-Inkosi yeLanga kumele , kumele kube ngcono izinga lokuthuthukisa abantu .\n",
            "2019-11-26 09:41:49,383 Example #1\n",
            "2019-11-26 09:41:49,383 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 09:41:49,383 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 09:41:49,383 \tHypothesis: Kusukela ekuqaleni kwendawo yokuqala komphakathi wethu , sibe nentando yeningi , seyenza ukuthi abantu bakithi bakithi bayaziqhubeke kakhulu .\n",
            "2019-11-26 09:41:49,383 Example #2\n",
            "2019-11-26 09:41:49,384 \tSource:     Information about government services\n",
            "2019-11-26 09:41:49,384 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 09:41:49,384 \tHypothesis: Ulwazi oluphathelene nezinkonzo zikahulumeni\n",
            "2019-11-26 09:41:49,384 Example #3\n",
            "2019-11-26 09:41:49,384 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 09:41:49,384 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 09:41:49,384 \tHypothesis: Ukusungulwa kwabantu abaningi kanye nokusheshisa abantu abakhubazekile emphakathini , okulinganayo , okulingana , kanye nokungathuthuki , ukungalingani kanye nokungaziphathi kahle .\n",
            "2019-11-26 09:41:49,384 Validation result (greedy) at epoch  34, step    10000: bleu:   4.49, loss: 89621.1094, ppl:  15.5631, duration: 30.8494s\n",
            "2019-11-26 09:42:01,336 Epoch  34 Step:    10100 Batch Loss:     2.699701 Tokens per Sec:    19744, Lr: 0.000300\n",
            "2019-11-26 09:42:13,328 Epoch  34 Step:    10200 Batch Loss:     2.639379 Tokens per Sec:    19655, Lr: 0.000300\n",
            "2019-11-26 09:42:19,837 Epoch  34: total training loss 724.40\n",
            "2019-11-26 09:42:19,837 EPOCH 35\n",
            "2019-11-26 09:42:25,249 Epoch  35 Step:    10300 Batch Loss:     2.488713 Tokens per Sec:    20009, Lr: 0.000300\n",
            "2019-11-26 09:42:37,139 Epoch  35 Step:    10400 Batch Loss:     2.282246 Tokens per Sec:    19326, Lr: 0.000300\n",
            "2019-11-26 09:42:49,026 Epoch  35 Step:    10500 Batch Loss:     2.319767 Tokens per Sec:    20093, Lr: 0.000300\n",
            "2019-11-26 09:42:55,674 Epoch  35: total training loss 719.15\n",
            "2019-11-26 09:42:55,675 EPOCH 36\n",
            "2019-11-26 09:43:00,945 Epoch  36 Step:    10600 Batch Loss:     2.380106 Tokens per Sec:    19874, Lr: 0.000300\n",
            "2019-11-26 09:43:12,904 Epoch  36 Step:    10700 Batch Loss:     2.519955 Tokens per Sec:    19771, Lr: 0.000300\n",
            "2019-11-26 09:43:24,733 Epoch  36 Step:    10800 Batch Loss:     1.706081 Tokens per Sec:    19437, Lr: 0.000300\n",
            "2019-11-26 09:43:31,585 Epoch  36: total training loss 711.59\n",
            "2019-11-26 09:43:31,585 EPOCH 37\n",
            "2019-11-26 09:43:36,711 Epoch  37 Step:    10900 Batch Loss:     2.589002 Tokens per Sec:    19750, Lr: 0.000300\n",
            "2019-11-26 09:43:48,662 Epoch  37 Step:    11000 Batch Loss:     2.414927 Tokens per Sec:    19810, Lr: 0.000300\n",
            "2019-11-26 09:44:00,565 Epoch  37 Step:    11100 Batch Loss:     2.566628 Tokens per Sec:    19789, Lr: 0.000300\n",
            "2019-11-26 09:44:07,388 Epoch  37: total training loss 703.18\n",
            "2019-11-26 09:44:07,389 EPOCH 38\n",
            "2019-11-26 09:44:12,548 Epoch  38 Step:    11200 Batch Loss:     1.759122 Tokens per Sec:    19201, Lr: 0.000300\n",
            "2019-11-26 09:44:24,554 Epoch  38 Step:    11300 Batch Loss:     2.381565 Tokens per Sec:    19975, Lr: 0.000300\n",
            "2019-11-26 09:44:36,374 Epoch  38 Step:    11400 Batch Loss:     2.694658 Tokens per Sec:    19399, Lr: 0.000300\n",
            "2019-11-26 09:44:43,414 Epoch  38: total training loss 698.58\n",
            "2019-11-26 09:44:43,414 EPOCH 39\n",
            "2019-11-26 09:44:48,304 Epoch  39 Step:    11500 Batch Loss:     1.903058 Tokens per Sec:    19758, Lr: 0.000300\n",
            "2019-11-26 09:45:00,222 Epoch  39 Step:    11600 Batch Loss:     2.294316 Tokens per Sec:    19924, Lr: 0.000300\n",
            "2019-11-26 09:45:12,029 Epoch  39 Step:    11700 Batch Loss:     2.442521 Tokens per Sec:    19440, Lr: 0.000300\n",
            "2019-11-26 09:45:19,357 Epoch  39: total training loss 692.19\n",
            "2019-11-26 09:45:19,357 EPOCH 40\n",
            "2019-11-26 09:45:23,899 Epoch  40 Step:    11800 Batch Loss:     2.442070 Tokens per Sec:    19769, Lr: 0.000300\n",
            "2019-11-26 09:45:35,745 Epoch  40 Step:    11900 Batch Loss:     2.306142 Tokens per Sec:    19733, Lr: 0.000300\n",
            "2019-11-26 09:45:47,663 Epoch  40 Step:    12000 Batch Loss:     2.324108 Tokens per Sec:    19378, Lr: 0.000300\n",
            "2019-11-26 09:46:18,303 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 09:46:18,304 Saving new checkpoint.\n",
            "2019-11-26 09:46:18,550 Example #0\n",
            "2019-11-26 09:46:18,551 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 09:46:18,551 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 09:46:18,551 \tHypothesis: Inkosi uMbongeleni Zondi wayengumongo wokusebenza kweNkosi uBan , kumele kube yindlela yokusebenza , ngesiBhakabhaka , ukuze senze ngcono ukusebenzisa abantu .\n",
            "2019-11-26 09:46:18,551 Example #1\n",
            "2019-11-26 09:46:18,551 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 09:46:18,551 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 09:46:18,551 \tHypothesis: Kusukela ekuqaleni kwakhiwa kabusha komphakathi wethu , senze ukuthi sikwazi ukungalingani kwethu sibe yimpilo yabantu bakithi yabantu abamhlophe .\n",
            "2019-11-26 09:46:18,552 Example #2\n",
            "2019-11-26 09:46:18,552 \tSource:     Information about government services\n",
            "2019-11-26 09:46:18,552 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 09:46:18,552 \tHypothesis: Ulwazi olusebenza nguhulumeni\n",
            "2019-11-26 09:46:18,552 Example #3\n",
            "2019-11-26 09:46:18,552 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 09:46:18,552 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 09:46:18,552 \tHypothesis: Ukusungulwa kwabantu abaningi kanye nabantu abayizile kanye nokungathuthuki kahle kwezinga eliphansi elikhulu labantu , elikhwalithi , kanye nelokulingana neliyisisekelo sabantu .\n",
            "2019-11-26 09:46:18,552 Validation result (greedy) at epoch  40, step    12000: bleu:   5.11, loss: 87071.1875, ppl:  14.3939, duration: 30.8897s\n",
            "2019-11-26 09:46:26,109 Epoch  40: total training loss 681.50\n",
            "2019-11-26 09:46:26,110 EPOCH 41\n",
            "2019-11-26 09:46:30,532 Epoch  41 Step:    12100 Batch Loss:     2.202152 Tokens per Sec:    19656, Lr: 0.000300\n",
            "2019-11-26 09:46:42,501 Epoch  41 Step:    12200 Batch Loss:     2.302921 Tokens per Sec:    19683, Lr: 0.000300\n",
            "2019-11-26 09:46:54,455 Epoch  41 Step:    12300 Batch Loss:     1.681522 Tokens per Sec:    19566, Lr: 0.000300\n",
            "2019-11-26 09:47:02,096 Epoch  41: total training loss 672.82\n",
            "2019-11-26 09:47:02,096 EPOCH 42\n",
            "2019-11-26 09:47:06,543 Epoch  42 Step:    12400 Batch Loss:     2.535761 Tokens per Sec:    19269, Lr: 0.000300\n",
            "2019-11-26 09:47:18,646 Epoch  42 Step:    12500 Batch Loss:     2.230573 Tokens per Sec:    19291, Lr: 0.000300\n",
            "2019-11-26 09:47:30,645 Epoch  42 Step:    12600 Batch Loss:     2.300069 Tokens per Sec:    19734, Lr: 0.000300\n",
            "2019-11-26 09:47:38,309 Epoch  42: total training loss 666.93\n",
            "2019-11-26 09:47:38,309 EPOCH 43\n",
            "2019-11-26 09:47:42,678 Epoch  43 Step:    12700 Batch Loss:     2.322931 Tokens per Sec:    19399, Lr: 0.000300\n",
            "2019-11-26 09:47:54,553 Epoch  43 Step:    12800 Batch Loss:     2.381737 Tokens per Sec:    19674, Lr: 0.000300\n",
            "2019-11-26 09:48:06,509 Epoch  43 Step:    12900 Batch Loss:     1.708193 Tokens per Sec:    19468, Lr: 0.000300\n",
            "2019-11-26 09:48:14,389 Epoch  43: total training loss 662.46\n",
            "2019-11-26 09:48:14,389 EPOCH 44\n",
            "2019-11-26 09:48:18,507 Epoch  44 Step:    13000 Batch Loss:     2.272575 Tokens per Sec:    19244, Lr: 0.000300\n",
            "2019-11-26 09:48:30,480 Epoch  44 Step:    13100 Batch Loss:     2.463595 Tokens per Sec:    19581, Lr: 0.000300\n",
            "2019-11-26 09:48:42,411 Epoch  44 Step:    13200 Batch Loss:     2.063261 Tokens per Sec:    19674, Lr: 0.000300\n",
            "2019-11-26 09:48:50,545 Epoch  44: total training loss 656.64\n",
            "2019-11-26 09:48:50,546 EPOCH 45\n",
            "2019-11-26 09:48:54,428 Epoch  45 Step:    13300 Batch Loss:     2.097680 Tokens per Sec:    19254, Lr: 0.000300\n",
            "2019-11-26 09:49:06,351 Epoch  45 Step:    13400 Batch Loss:     2.382205 Tokens per Sec:    19714, Lr: 0.000300\n",
            "2019-11-26 09:49:18,330 Epoch  45 Step:    13500 Batch Loss:     2.147023 Tokens per Sec:    19855, Lr: 0.000300\n",
            "2019-11-26 09:49:26,453 Epoch  45: total training loss 645.66\n",
            "2019-11-26 09:49:26,454 EPOCH 46\n",
            "2019-11-26 09:49:30,218 Epoch  46 Step:    13600 Batch Loss:     1.699259 Tokens per Sec:    18720, Lr: 0.000300\n",
            "2019-11-26 09:49:42,186 Epoch  46 Step:    13700 Batch Loss:     2.075526 Tokens per Sec:    19656, Lr: 0.000300\n",
            "2019-11-26 09:49:54,282 Epoch  46 Step:    13800 Batch Loss:     2.386219 Tokens per Sec:    19587, Lr: 0.000300\n",
            "2019-11-26 09:50:02,604 Epoch  46: total training loss 644.74\n",
            "2019-11-26 09:50:02,604 EPOCH 47\n",
            "2019-11-26 09:50:06,133 Epoch  47 Step:    13900 Batch Loss:     1.443419 Tokens per Sec:    19594, Lr: 0.000300\n",
            "2019-11-26 09:50:18,114 Epoch  47 Step:    14000 Batch Loss:     2.334391 Tokens per Sec:    20236, Lr: 0.000300\n",
            "2019-11-26 09:50:48,656 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 09:50:48,657 Saving new checkpoint.\n",
            "2019-11-26 09:50:48,911 Example #0\n",
            "2019-11-26 09:50:48,912 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 09:50:48,912 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 09:50:48,912 \tHypothesis: Inkosi uMbongeleni Zondi wayeyisisekelo sokubambisana nomsebenzi wobambiswano wokusebenza kwe-Inkosi , kumele senze ngcono ukusebenzisa abantu bakhe .\n",
            "2019-11-26 09:50:48,912 Example #1\n",
            "2019-11-26 09:50:48,912 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 09:50:48,912 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 09:50:48,912 \tHypothesis: Kusukela ekuqaleni kwethu ekuqaleni kwethu , senze ukuthi umphakathi wethu usebenze ukuthi senze umphakathi wethu usebenzisana nohlelo lokushintshisana kwabantu .\n",
            "2019-11-26 09:50:48,912 Example #2\n",
            "2019-11-26 09:50:48,912 \tSource:     Information about government services\n",
            "2019-11-26 09:50:48,913 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 09:50:48,913 \tHypothesis: Ulwazi olusebenza nguhulumeni\n",
            "2019-11-26 09:50:48,913 Example #3\n",
            "2019-11-26 09:50:48,913 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 09:50:48,913 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 09:50:48,913 \tHypothesis: Ukusungulwa kwabantu abaningi kanye nabantu abanentshisekelo yokusheshisa umphakathi osebenza ngokulinganayo , izinga lokulingana , ubuhlungu kanye nokuzigcina .\n",
            "2019-11-26 09:50:48,913 Validation result (greedy) at epoch  47, step    14000: bleu:   5.69, loss: 85434.8672, ppl:  13.6903, duration: 30.7989s\n",
            "2019-11-26 09:51:00,869 Epoch  47 Step:    14100 Batch Loss:     2.260168 Tokens per Sec:    19345, Lr: 0.000300\n",
            "2019-11-26 09:51:09,161 Epoch  47: total training loss 633.76\n",
            "2019-11-26 09:51:09,161 EPOCH 48\n",
            "2019-11-26 09:51:12,691 Epoch  48 Step:    14200 Batch Loss:     1.968730 Tokens per Sec:    19283, Lr: 0.000300\n",
            "2019-11-26 09:51:24,544 Epoch  48 Step:    14300 Batch Loss:     1.453152 Tokens per Sec:    19790, Lr: 0.000300\n",
            "2019-11-26 09:51:36,341 Epoch  48 Step:    14400 Batch Loss:     2.186552 Tokens per Sec:    19634, Lr: 0.000300\n",
            "2019-11-26 09:51:44,928 Epoch  48: total training loss 633.25\n",
            "2019-11-26 09:51:44,928 EPOCH 49\n",
            "2019-11-26 09:51:48,315 Epoch  49 Step:    14500 Batch Loss:     1.292418 Tokens per Sec:    19283, Lr: 0.000300\n",
            "2019-11-26 09:52:00,212 Epoch  49 Step:    14600 Batch Loss:     1.900462 Tokens per Sec:    19921, Lr: 0.000300\n",
            "2019-11-26 09:52:12,130 Epoch  49 Step:    14700 Batch Loss:     2.340365 Tokens per Sec:    19851, Lr: 0.000300\n",
            "2019-11-26 09:52:20,739 Epoch  49: total training loss 624.97\n",
            "2019-11-26 09:52:20,739 EPOCH 50\n",
            "2019-11-26 09:52:23,977 Epoch  50 Step:    14800 Batch Loss:     1.990870 Tokens per Sec:    18386, Lr: 0.000300\n",
            "2019-11-26 09:52:36,035 Epoch  50 Step:    14900 Batch Loss:     1.304114 Tokens per Sec:    20042, Lr: 0.000300\n",
            "2019-11-26 09:52:47,877 Epoch  50 Step:    15000 Batch Loss:     1.379934 Tokens per Sec:    19679, Lr: 0.000300\n",
            "2019-11-26 09:52:56,679 Epoch  50: total training loss 619.74\n",
            "2019-11-26 09:52:56,679 EPOCH 51\n",
            "2019-11-26 09:52:59,785 Epoch  51 Step:    15100 Batch Loss:     2.148094 Tokens per Sec:    19445, Lr: 0.000300\n",
            "2019-11-26 09:53:11,573 Epoch  51 Step:    15200 Batch Loss:     2.346195 Tokens per Sec:    19720, Lr: 0.000300\n",
            "2019-11-26 09:53:23,538 Epoch  51 Step:    15300 Batch Loss:     2.240759 Tokens per Sec:    19880, Lr: 0.000300\n",
            "2019-11-26 09:53:32,513 Epoch  51: total training loss 614.28\n",
            "2019-11-26 09:53:32,513 EPOCH 52\n",
            "2019-11-26 09:53:35,503 Epoch  52 Step:    15400 Batch Loss:     1.517102 Tokens per Sec:    19331, Lr: 0.000300\n",
            "2019-11-26 09:53:47,399 Epoch  52 Step:    15500 Batch Loss:     2.103755 Tokens per Sec:    19687, Lr: 0.000300\n",
            "2019-11-26 09:53:59,289 Epoch  52 Step:    15600 Batch Loss:     2.082289 Tokens per Sec:    19785, Lr: 0.000300\n",
            "2019-11-26 09:54:08,483 Epoch  52: total training loss 613.49\n",
            "2019-11-26 09:54:08,483 EPOCH 53\n",
            "2019-11-26 09:54:11,139 Epoch  53 Step:    15700 Batch Loss:     2.202090 Tokens per Sec:    19898, Lr: 0.000300\n",
            "2019-11-26 09:54:23,165 Epoch  53 Step:    15800 Batch Loss:     1.583899 Tokens per Sec:    19817, Lr: 0.000300\n",
            "2019-11-26 09:54:35,026 Epoch  53 Step:    15900 Batch Loss:     1.636043 Tokens per Sec:    19678, Lr: 0.000300\n",
            "2019-11-26 09:54:44,208 Epoch  53: total training loss 601.41\n",
            "2019-11-26 09:54:44,208 EPOCH 54\n",
            "2019-11-26 09:54:47,022 Epoch  54 Step:    16000 Batch Loss:     2.215353 Tokens per Sec:    20274, Lr: 0.000300\n",
            "2019-11-26 09:55:17,708 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 09:55:17,709 Saving new checkpoint.\n",
            "2019-11-26 09:55:17,958 Example #0\n",
            "2019-11-26 09:55:17,958 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 09:55:17,958 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 09:55:17,958 \tHypothesis: Inkosi uMbongeleni Zondi wayengumongo wokubambisana nombolo wobunye wobunye wobunye wobunye wobunye wobunikazi , kumele senze ngcono ukusebenzisa abantu .\n",
            "2019-11-26 09:55:17,958 Example #1\n",
            "2019-11-26 09:55:17,958 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 09:55:17,959 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 09:55:17,959 \tHypothesis: Kusukela ekuqaleni kokwakha umphakathi wethu wentando yeningi , sibe sesixazululiwe kubantu bakithi abacishe bahloniphe ngokushintshana ngabantu .\n",
            "2019-11-26 09:55:17,959 Example #2\n",
            "2019-11-26 09:55:17,959 \tSource:     Information about government services\n",
            "2019-11-26 09:55:17,959 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 09:55:17,959 \tHypothesis: Ulwazi ngezinkonzo zikahulumeni\n",
            "2019-11-26 09:55:17,959 Example #3\n",
            "2019-11-26 09:55:17,959 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 09:55:17,959 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 09:55:17,959 \tHypothesis: Ukusungulwa kwabantu abanogada kanye nabantu abahluphekile emphakathini abacebile , okukhubazeka , ukuqina kanye nokulingana kwezinga eliphezulu .\n",
            "2019-11-26 09:55:17,959 Validation result (greedy) at epoch  54, step    16000: bleu:   6.05, loss: 84317.0625, ppl:  13.2295, duration: 30.9370s\n",
            "2019-11-26 09:55:29,927 Epoch  54 Step:    16100 Batch Loss:     2.137997 Tokens per Sec:    19549, Lr: 0.000300\n",
            "2019-11-26 09:55:41,792 Epoch  54 Step:    16200 Batch Loss:     2.302978 Tokens per Sec:    19836, Lr: 0.000300\n",
            "2019-11-26 09:55:50,945 Epoch  54: total training loss 597.00\n",
            "2019-11-26 09:55:50,945 EPOCH 55\n",
            "2019-11-26 09:55:53,703 Epoch  55 Step:    16300 Batch Loss:     1.951475 Tokens per Sec:    19503, Lr: 0.000300\n",
            "2019-11-26 09:56:05,723 Epoch  55 Step:    16400 Batch Loss:     2.256732 Tokens per Sec:    19874, Lr: 0.000300\n",
            "2019-11-26 09:56:17,609 Epoch  55 Step:    16500 Batch Loss:     2.220670 Tokens per Sec:    19549, Lr: 0.000300\n",
            "2019-11-26 09:56:26,794 Epoch  55: total training loss 598.52\n",
            "2019-11-26 09:56:26,795 EPOCH 56\n",
            "2019-11-26 09:56:29,552 Epoch  56 Step:    16600 Batch Loss:     2.010661 Tokens per Sec:    19087, Lr: 0.000300\n",
            "2019-11-26 09:56:41,530 Epoch  56 Step:    16700 Batch Loss:     1.617594 Tokens per Sec:    19731, Lr: 0.000300\n",
            "2019-11-26 09:56:53,442 Epoch  56 Step:    16800 Batch Loss:     2.308049 Tokens per Sec:    19609, Lr: 0.000300\n",
            "2019-11-26 09:57:02,922 Epoch  56: total training loss 594.88\n",
            "2019-11-26 09:57:02,922 EPOCH 57\n",
            "2019-11-26 09:57:05,326 Epoch  57 Step:    16900 Batch Loss:     2.068038 Tokens per Sec:    19565, Lr: 0.000300\n",
            "2019-11-26 09:57:17,277 Epoch  57 Step:    17000 Batch Loss:     1.801753 Tokens per Sec:    20087, Lr: 0.000300\n",
            "2019-11-26 09:57:29,115 Epoch  57 Step:    17100 Batch Loss:     2.192253 Tokens per Sec:    19474, Lr: 0.000300\n",
            "2019-11-26 09:57:38,885 Epoch  57: total training loss 585.64\n",
            "2019-11-26 09:57:38,886 EPOCH 58\n",
            "2019-11-26 09:57:41,188 Epoch  58 Step:    17200 Batch Loss:     1.780569 Tokens per Sec:    18876, Lr: 0.000300\n",
            "2019-11-26 09:57:53,209 Epoch  58 Step:    17300 Batch Loss:     1.505821 Tokens per Sec:    19670, Lr: 0.000300\n",
            "2019-11-26 09:58:05,217 Epoch  58 Step:    17400 Batch Loss:     2.167284 Tokens per Sec:    19836, Lr: 0.000300\n",
            "2019-11-26 09:58:14,855 Epoch  58: total training loss 579.93\n",
            "2019-11-26 09:58:14,855 EPOCH 59\n",
            "2019-11-26 09:58:17,196 Epoch  59 Step:    17500 Batch Loss:     1.701473 Tokens per Sec:    20264, Lr: 0.000300\n",
            "2019-11-26 09:58:29,088 Epoch  59 Step:    17600 Batch Loss:     1.402009 Tokens per Sec:    19509, Lr: 0.000300\n",
            "2019-11-26 09:58:41,020 Epoch  59 Step:    17700 Batch Loss:     2.244539 Tokens per Sec:    19943, Lr: 0.000300\n",
            "2019-11-26 09:58:50,720 Epoch  59: total training loss 575.67\n",
            "2019-11-26 09:58:50,720 EPOCH 60\n",
            "2019-11-26 09:58:52,975 Epoch  60 Step:    17800 Batch Loss:     1.849226 Tokens per Sec:    20703, Lr: 0.000300\n",
            "2019-11-26 09:59:04,825 Epoch  60 Step:    17900 Batch Loss:     2.013869 Tokens per Sec:    19377, Lr: 0.000300\n",
            "2019-11-26 09:59:16,836 Epoch  60 Step:    18000 Batch Loss:     1.999858 Tokens per Sec:    20143, Lr: 0.000300\n",
            "2019-11-26 09:59:47,519 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 09:59:47,520 Saving new checkpoint.\n",
            "2019-11-26 09:59:47,773 Example #0\n",
            "2019-11-26 09:59:47,773 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 09:59:47,773 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 09:59:47,773 \tHypothesis: Inkosi uMbongeleni Zondi yasingatha isimanje sobuningi bobunikazi bophawu lwesintu , kumele senze ngcono ukusebenzisa abantu bakhe .\n",
            "2019-11-26 09:59:47,774 Example #1\n",
            "2019-11-26 09:59:47,774 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 09:59:47,774 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 09:59:47,774 \tHypothesis: Kusukela ekuqaleni kwethu ukwakhiwa komphakathi wethu wentando yeningi , sesifuna ukuthi umphakathi usebenzise umphakathi wethu oncomekayo .\n",
            "2019-11-26 09:59:47,774 Example #2\n",
            "2019-11-26 09:59:47,774 \tSource:     Information about government services\n",
            "2019-11-26 09:59:47,774 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 09:59:47,774 \tHypothesis: Ulwazi ngezinkonzo zikaHulumeni\n",
            "2019-11-26 09:59:47,774 Example #3\n",
            "2019-11-26 09:59:47,775 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 09:59:47,775 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 09:59:47,775 \tHypothesis: Ukwenyusa abantu abahlala kanye nabantu abahluphekile kanye nosizo lukahulumeni olukhulekile , olukhwalile , kanye nobuqotho bezindlu .\n",
            "2019-11-26 09:59:47,775 Validation result (greedy) at epoch  60, step    18000: bleu:   6.46, loss: 83865.2188, ppl:  13.0477, duration: 30.9389s\n",
            "2019-11-26 09:59:57,632 Epoch  60: total training loss 572.15\n",
            "2019-11-26 09:59:57,632 EPOCH 61\n",
            "2019-11-26 09:59:59,722 Epoch  61 Step:    18100 Batch Loss:     1.934814 Tokens per Sec:    19449, Lr: 0.000300\n",
            "2019-11-26 10:00:11,535 Epoch  61 Step:    18200 Batch Loss:     1.936928 Tokens per Sec:    19521, Lr: 0.000300\n",
            "2019-11-26 10:00:23,482 Epoch  61 Step:    18300 Batch Loss:     2.149231 Tokens per Sec:    19810, Lr: 0.000300\n",
            "2019-11-26 10:00:33,617 Epoch  61: total training loss 571.82\n",
            "2019-11-26 10:00:33,617 EPOCH 62\n",
            "2019-11-26 10:00:35,398 Epoch  62 Step:    18400 Batch Loss:     2.036154 Tokens per Sec:    18956, Lr: 0.000300\n",
            "2019-11-26 10:00:47,359 Epoch  62 Step:    18500 Batch Loss:     2.047510 Tokens per Sec:    19856, Lr: 0.000300\n",
            "2019-11-26 10:00:59,260 Epoch  62 Step:    18600 Batch Loss:     2.141311 Tokens per Sec:    19903, Lr: 0.000300\n",
            "2019-11-26 10:01:09,492 Epoch  62: total training loss 563.79\n",
            "2019-11-26 10:01:09,492 EPOCH 63\n",
            "2019-11-26 10:01:11,211 Epoch  63 Step:    18700 Batch Loss:     2.012838 Tokens per Sec:    19296, Lr: 0.000300\n",
            "2019-11-26 10:01:23,144 Epoch  63 Step:    18800 Batch Loss:     1.322492 Tokens per Sec:    19646, Lr: 0.000300\n",
            "2019-11-26 10:01:34,924 Epoch  63 Step:    18900 Batch Loss:     2.046419 Tokens per Sec:    19683, Lr: 0.000300\n",
            "2019-11-26 10:01:45,582 Epoch  63: total training loss 565.82\n",
            "2019-11-26 10:01:45,582 EPOCH 64\n",
            "2019-11-26 10:01:46,800 Epoch  64 Step:    19000 Batch Loss:     1.784972 Tokens per Sec:    19368, Lr: 0.000300\n",
            "2019-11-26 10:01:58,708 Epoch  64 Step:    19100 Batch Loss:     1.807434 Tokens per Sec:    19768, Lr: 0.000300\n",
            "2019-11-26 10:02:10,569 Epoch  64 Step:    19200 Batch Loss:     1.865295 Tokens per Sec:    19652, Lr: 0.000300\n",
            "2019-11-26 10:02:21,581 Epoch  64: total training loss 560.97\n",
            "2019-11-26 10:02:21,581 EPOCH 65\n",
            "2019-11-26 10:02:22,436 Epoch  65 Step:    19300 Batch Loss:     2.094594 Tokens per Sec:    18159, Lr: 0.000300\n",
            "2019-11-26 10:02:34,333 Epoch  65 Step:    19400 Batch Loss:     1.955499 Tokens per Sec:    19821, Lr: 0.000300\n",
            "2019-11-26 10:02:46,252 Epoch  65 Step:    19500 Batch Loss:     1.523212 Tokens per Sec:    19542, Lr: 0.000300\n",
            "2019-11-26 10:02:57,560 Epoch  65: total training loss 553.79\n",
            "2019-11-26 10:02:57,560 EPOCH 66\n",
            "2019-11-26 10:02:58,216 Epoch  66 Step:    19600 Batch Loss:     1.987713 Tokens per Sec:    20258, Lr: 0.000300\n",
            "2019-11-26 10:03:10,081 Epoch  66 Step:    19700 Batch Loss:     2.301929 Tokens per Sec:    19746, Lr: 0.000300\n",
            "2019-11-26 10:03:21,846 Epoch  66 Step:    19800 Batch Loss:     2.067825 Tokens per Sec:    19438, Lr: 0.000300\n",
            "2019-11-26 10:03:33,422 Epoch  66: total training loss 550.94\n",
            "2019-11-26 10:03:33,422 EPOCH 67\n",
            "2019-11-26 10:03:33,837 Epoch  67 Step:    19900 Batch Loss:     2.047011 Tokens per Sec:    20369, Lr: 0.000300\n",
            "2019-11-26 10:03:45,745 Epoch  67 Step:    20000 Batch Loss:     1.937107 Tokens per Sec:    19867, Lr: 0.000300\n",
            "2019-11-26 10:04:16,366 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 10:04:16,367 Saving new checkpoint.\n",
            "2019-11-26 10:04:16,628 Example #0\n",
            "2019-11-26 10:04:16,630 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 10:04:16,630 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 10:04:16,630 \tHypothesis: Inkosi uMbongeleni Zondi yasingatha isisekelo sokusebenza kwenkosi yami kumele , ngisize ekuthuthukiseni ukusebenza kwabantu bakhe .\n",
            "2019-11-26 10:04:16,630 Example #1\n",
            "2019-11-26 10:04:16,630 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 10:04:16,630 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 10:04:16,630 \tHypothesis: Kusukela ekuqaleni kwethu ukwakha umphakathi wethu wentando yeningi , senze ukuthi senze umphakathi wethu wonkana ngabantu .\n",
            "2019-11-26 10:04:16,630 Example #2\n",
            "2019-11-26 10:04:16,631 \tSource:     Information about government services\n",
            "2019-11-26 10:04:16,631 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 10:04:16,631 \tHypothesis: Ulwazi ngezinkonzo zikaHulumeni\n",
            "2019-11-26 10:04:16,631 Example #3\n",
            "2019-11-26 10:04:16,631 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 10:04:16,631 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 10:04:16,631 \tHypothesis: Ukwenziwa kokwenziwa komsebenzi kubantu abalinganiselwa wumphakathi ohlala ngokulingana , izinga lokulingana , ubuqotho kanye nokuzinza kahle kwezikhukhula .\n",
            "2019-11-26 10:04:16,631 Validation result (greedy) at epoch  67, step    20000: bleu:   7.12, loss: 83562.0859, ppl:  12.9271, duration: 30.8859s\n",
            "2019-11-26 10:04:28,490 Epoch  67 Step:    20100 Batch Loss:     1.203565 Tokens per Sec:    19476, Lr: 0.000300\n",
            "2019-11-26 10:04:40,169 Epoch  67: total training loss 546.21\n",
            "2019-11-26 10:04:40,170 EPOCH 68\n",
            "2019-11-26 10:04:40,448 Epoch  68 Step:    20200 Batch Loss:     1.924731 Tokens per Sec:    17436, Lr: 0.000300\n",
            "2019-11-26 10:04:52,330 Epoch  68 Step:    20300 Batch Loss:     1.493980 Tokens per Sec:    19731, Lr: 0.000300\n",
            "2019-11-26 10:05:04,120 Epoch  68 Step:    20400 Batch Loss:     1.943347 Tokens per Sec:    19445, Lr: 0.000300\n",
            "2019-11-26 10:05:16,021 Epoch  68 Step:    20500 Batch Loss:     2.069369 Tokens per Sec:    19964, Lr: 0.000300\n",
            "2019-11-26 10:05:16,099 Epoch  68: total training loss 545.83\n",
            "2019-11-26 10:05:16,100 EPOCH 69\n",
            "2019-11-26 10:05:27,931 Epoch  69 Step:    20600 Batch Loss:     1.915969 Tokens per Sec:    20012, Lr: 0.000300\n",
            "2019-11-26 10:05:39,791 Epoch  69 Step:    20700 Batch Loss:     1.981181 Tokens per Sec:    19646, Lr: 0.000300\n",
            "2019-11-26 10:05:51,719 Epoch  69 Step:    20800 Batch Loss:     2.190882 Tokens per Sec:    19723, Lr: 0.000300\n",
            "2019-11-26 10:05:51,822 Epoch  69: total training loss 537.20\n",
            "2019-11-26 10:05:51,822 EPOCH 70\n",
            "2019-11-26 10:06:03,534 Epoch  70 Step:    20900 Batch Loss:     1.078837 Tokens per Sec:    19377, Lr: 0.000300\n",
            "2019-11-26 10:06:15,404 Epoch  70 Step:    21000 Batch Loss:     1.087957 Tokens per Sec:    19836, Lr: 0.000300\n",
            "2019-11-26 10:06:27,314 Epoch  70 Step:    21100 Batch Loss:     1.759168 Tokens per Sec:    20035, Lr: 0.000300\n",
            "2019-11-26 10:06:27,658 Epoch  70: total training loss 536.03\n",
            "2019-11-26 10:06:27,658 EPOCH 71\n",
            "2019-11-26 10:06:39,235 Epoch  71 Step:    21200 Batch Loss:     1.953158 Tokens per Sec:    19473, Lr: 0.000300\n",
            "2019-11-26 10:06:51,165 Epoch  71 Step:    21300 Batch Loss:     1.117732 Tokens per Sec:    19679, Lr: 0.000300\n",
            "2019-11-26 10:07:03,130 Epoch  71 Step:    21400 Batch Loss:     1.940263 Tokens per Sec:    19741, Lr: 0.000300\n",
            "2019-11-26 10:07:03,712 Epoch  71: total training loss 533.07\n",
            "2019-11-26 10:07:03,712 EPOCH 72\n",
            "2019-11-26 10:07:15,083 Epoch  72 Step:    21500 Batch Loss:     1.802969 Tokens per Sec:    19689, Lr: 0.000300\n",
            "2019-11-26 10:07:27,019 Epoch  72 Step:    21600 Batch Loss:     1.898822 Tokens per Sec:    19754, Lr: 0.000300\n",
            "2019-11-26 10:07:38,909 Epoch  72 Step:    21700 Batch Loss:     1.831093 Tokens per Sec:    19376, Lr: 0.000300\n",
            "2019-11-26 10:07:39,758 Epoch  72: total training loss 529.70\n",
            "2019-11-26 10:07:39,758 EPOCH 73\n",
            "2019-11-26 10:07:50,908 Epoch  73 Step:    21800 Batch Loss:     2.023489 Tokens per Sec:    19366, Lr: 0.000300\n",
            "2019-11-26 10:08:03,023 Epoch  73 Step:    21900 Batch Loss:     1.760229 Tokens per Sec:    19474, Lr: 0.000300\n",
            "2019-11-26 10:08:15,056 Epoch  73 Step:    22000 Batch Loss:     2.039956 Tokens per Sec:    19539, Lr: 0.000300\n",
            "2019-11-26 10:08:45,772 Hooray! New best validation result [ppl]!\n",
            "2019-11-26 10:08:45,772 Saving new checkpoint.\n",
            "2019-11-26 10:08:46,024 Example #0\n",
            "2019-11-26 10:08:46,025 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 10:08:46,025 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 10:08:46,025 \tHypothesis: Inkosi uMbongeleni Zondi wayeyisisekelo sokubambisana nomsebenzi wobunikazi wobunikazi bami , kumele senze ngcono ukuqhubeka nokuthuthukisa abantu bakhe .\n",
            "2019-11-26 10:08:46,025 Example #1\n",
            "2019-11-26 10:08:46,025 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 10:08:46,026 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 10:08:46,026 \tHypothesis: Kusukela ekuqaleni kwethu wokwakhayo komphakathi wethu wentando yeningi , senze ukuthi sikwazi ukuqhubeka nomphakathi wabantu abavela ngokugcwele abantu .\n",
            "2019-11-26 10:08:46,026 Example #2\n",
            "2019-11-26 10:08:46,026 \tSource:     Information about government services\n",
            "2019-11-26 10:08:46,026 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 10:08:46,026 \tHypothesis: Ulwazi ngezinkonzo zikaHulumeni\n",
            "2019-11-26 10:08:46,026 Example #3\n",
            "2019-11-26 10:08:46,026 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 10:08:46,026 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 10:08:46,026 \tHypothesis: Ukwakhiwa komuntu ogxile kubantu abadala kanye nosizo lwemisebenzi kahulumeni olukhulekile , ikhwalithi , izinga lokulingana , ubuhlungu kanye nokuziqhathanisa .\n",
            "2019-11-26 10:08:46,027 Validation result (greedy) at epoch  73, step    22000: bleu:   7.27, loss: 83251.7344, ppl:  12.8048, duration: 30.9700s\n",
            "2019-11-26 10:08:47,027 Epoch  73: total training loss 525.33\n",
            "2019-11-26 10:08:47,027 EPOCH 74\n",
            "2019-11-26 10:08:58,116 Epoch  74 Step:    22100 Batch Loss:     1.742751 Tokens per Sec:    19208, Lr: 0.000300\n",
            "2019-11-26 10:09:10,120 Epoch  74 Step:    22200 Batch Loss:     2.144392 Tokens per Sec:    19495, Lr: 0.000300\n",
            "2019-11-26 10:09:22,084 Epoch  74 Step:    22300 Batch Loss:     1.825725 Tokens per Sec:    19492, Lr: 0.000300\n",
            "2019-11-26 10:09:23,416 Epoch  74: total training loss 525.17\n",
            "2019-11-26 10:09:23,416 EPOCH 75\n",
            "2019-11-26 10:09:33,973 Epoch  75 Step:    22400 Batch Loss:     1.860796 Tokens per Sec:    19372, Lr: 0.000300\n",
            "2019-11-26 10:09:46,037 Epoch  75 Step:    22500 Batch Loss:     1.715759 Tokens per Sec:    19882, Lr: 0.000300\n",
            "2019-11-26 10:09:58,000 Epoch  75 Step:    22600 Batch Loss:     1.722417 Tokens per Sec:    19138, Lr: 0.000300\n",
            "2019-11-26 10:09:59,683 Epoch  75: total training loss 521.29\n",
            "2019-11-26 10:09:59,684 EPOCH 76\n",
            "2019-11-26 10:10:10,033 Epoch  76 Step:    22700 Batch Loss:     1.849656 Tokens per Sec:    19383, Lr: 0.000300\n",
            "2019-11-26 10:10:22,118 Epoch  76 Step:    22800 Batch Loss:     1.998081 Tokens per Sec:    19730, Lr: 0.000300\n",
            "2019-11-26 10:10:34,161 Epoch  76 Step:    22900 Batch Loss:     1.873912 Tokens per Sec:    19455, Lr: 0.000300\n",
            "2019-11-26 10:10:35,941 Epoch  76: total training loss 513.67\n",
            "2019-11-26 10:10:35,941 EPOCH 77\n",
            "2019-11-26 10:10:46,115 Epoch  77 Step:    23000 Batch Loss:     2.001715 Tokens per Sec:    19361, Lr: 0.000300\n",
            "2019-11-26 10:10:58,113 Epoch  77 Step:    23100 Batch Loss:     1.870721 Tokens per Sec:    19673, Lr: 0.000300\n",
            "2019-11-26 10:11:09,845 Epoch  77 Step:    23200 Batch Loss:     1.412403 Tokens per Sec:    19438, Lr: 0.000300\n",
            "2019-11-26 10:11:12,204 Epoch  77: total training loss 519.93\n",
            "2019-11-26 10:11:12,204 EPOCH 78\n",
            "2019-11-26 10:11:21,762 Epoch  78 Step:    23300 Batch Loss:     1.938461 Tokens per Sec:    19616, Lr: 0.000300\n",
            "2019-11-26 10:11:33,701 Epoch  78 Step:    23400 Batch Loss:     1.763898 Tokens per Sec:    19651, Lr: 0.000300\n",
            "2019-11-26 10:11:45,580 Epoch  78 Step:    23500 Batch Loss:     1.786768 Tokens per Sec:    20137, Lr: 0.000300\n",
            "2019-11-26 10:11:47,878 Epoch  78: total training loss 506.37\n",
            "2019-11-26 10:11:47,878 EPOCH 79\n",
            "2019-11-26 10:11:57,637 Epoch  79 Step:    23600 Batch Loss:     1.718534 Tokens per Sec:    19920, Lr: 0.000300\n",
            "2019-11-26 10:12:09,490 Epoch  79 Step:    23700 Batch Loss:     1.916447 Tokens per Sec:    19433, Lr: 0.000300\n",
            "2019-11-26 10:12:21,342 Epoch  79 Step:    23800 Batch Loss:     1.799268 Tokens per Sec:    19518, Lr: 0.000300\n",
            "2019-11-26 10:12:23,861 Epoch  79: total training loss 507.34\n",
            "2019-11-26 10:12:23,861 EPOCH 80\n",
            "2019-11-26 10:12:33,323 Epoch  80 Step:    23900 Batch Loss:     1.584196 Tokens per Sec:    19442, Lr: 0.000300\n",
            "2019-11-26 10:12:45,147 Epoch  80 Step:    24000 Batch Loss:     1.793784 Tokens per Sec:    19439, Lr: 0.000300\n",
            "2019-11-26 10:13:15,780 Example #0\n",
            "2019-11-26 10:13:15,780 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 10:13:15,780 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 10:13:15,780 \tHypothesis: Inkosi uMbongeleni Zondi wayeyisisekelo sokubambisana nomsebenzi wenkosi yeInkosi kumele , senze ukuthi senze ngcono isimo sakhe sokuthuthukisa abantu .\n",
            "2019-11-26 10:13:15,780 Example #1\n",
            "2019-11-26 10:13:15,780 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 10:13:15,780 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 10:13:15,780 \tHypothesis: Kusukela ekuqaleni kwethu wokwakha umphakathi wentando yeningi , sibhekene nabantu besizwe sazibeke eceleni abantu abacishe bahlekelele ngohlelo lwabantu .\n",
            "2019-11-26 10:13:15,780 Example #2\n",
            "2019-11-26 10:13:15,781 \tSource:     Information about government services\n",
            "2019-11-26 10:13:15,781 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 10:13:15,781 \tHypothesis: Ulwazi olumayelana nezinsiza zikahulumeni\n",
            "2019-11-26 10:13:15,781 Example #3\n",
            "2019-11-26 10:13:15,781 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 10:13:15,781 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 10:13:15,781 \tHypothesis: Ukwakhiwa kwabantu abanjwa wubudlelwano obunika kanye nosizo lwemisebenzi kahulumeni olukhulelwa wubuliminingi , izinga lokulingana , ukuqinisa kanye nobungozi bezinto eziqinile .\n",
            "2019-11-26 10:13:15,781 Validation result (greedy) at epoch  80, step    24000: bleu:   7.65, loss: 83550.4844, ppl:  12.9225, duration: 30.6339s\n",
            "2019-11-26 10:13:27,777 Epoch  80 Step:    24100 Batch Loss:     2.019898 Tokens per Sec:    19902, Lr: 0.000300\n",
            "2019-11-26 10:13:30,507 Epoch  80: total training loss 504.47\n",
            "2019-11-26 10:13:30,507 EPOCH 81\n",
            "2019-11-26 10:13:39,735 Epoch  81 Step:    24200 Batch Loss:     1.734558 Tokens per Sec:    19730, Lr: 0.000300\n",
            "2019-11-26 10:13:51,589 Epoch  81 Step:    24300 Batch Loss:     1.623035 Tokens per Sec:    19518, Lr: 0.000300\n",
            "2019-11-26 10:14:03,475 Epoch  81 Step:    24400 Batch Loss:     1.922545 Tokens per Sec:    19978, Lr: 0.000300\n",
            "2019-11-26 10:14:06,230 Epoch  81: total training loss 498.83\n",
            "2019-11-26 10:14:06,230 EPOCH 82\n",
            "2019-11-26 10:14:15,340 Epoch  82 Step:    24500 Batch Loss:     1.635177 Tokens per Sec:    19466, Lr: 0.000300\n",
            "2019-11-26 10:14:27,261 Epoch  82 Step:    24600 Batch Loss:     0.932783 Tokens per Sec:    19864, Lr: 0.000300\n",
            "2019-11-26 10:14:39,110 Epoch  82 Step:    24700 Batch Loss:     1.919403 Tokens per Sec:    19783, Lr: 0.000300\n",
            "2019-11-26 10:14:41,996 Epoch  82: total training loss 497.23\n",
            "2019-11-26 10:14:41,996 EPOCH 83\n",
            "2019-11-26 10:14:51,094 Epoch  83 Step:    24800 Batch Loss:     1.885957 Tokens per Sec:    19591, Lr: 0.000300\n",
            "2019-11-26 10:15:02,956 Epoch  83 Step:    24900 Batch Loss:     1.823892 Tokens per Sec:    19834, Lr: 0.000300\n",
            "2019-11-26 10:15:14,759 Epoch  83 Step:    25000 Batch Loss:     1.692364 Tokens per Sec:    19669, Lr: 0.000300\n",
            "2019-11-26 10:15:17,956 Epoch  83: total training loss 497.50\n",
            "2019-11-26 10:15:17,956 EPOCH 84\n",
            "2019-11-26 10:15:26,693 Epoch  84 Step:    25100 Batch Loss:     1.612902 Tokens per Sec:    19922, Lr: 0.000300\n",
            "2019-11-26 10:15:38,503 Epoch  84 Step:    25200 Batch Loss:     1.506888 Tokens per Sec:    19602, Lr: 0.000300\n",
            "2019-11-26 10:15:50,387 Epoch  84 Step:    25300 Batch Loss:     1.289408 Tokens per Sec:    19597, Lr: 0.000300\n",
            "2019-11-26 10:15:53,829 Epoch  84: total training loss 492.96\n",
            "2019-11-26 10:15:53,829 EPOCH 85\n",
            "2019-11-26 10:16:02,263 Epoch  85 Step:    25400 Batch Loss:     1.849232 Tokens per Sec:    19364, Lr: 0.000300\n",
            "2019-11-26 10:16:14,119 Epoch  85 Step:    25500 Batch Loss:     0.995919 Tokens per Sec:    19692, Lr: 0.000300\n",
            "2019-11-26 10:16:26,207 Epoch  85 Step:    25600 Batch Loss:     1.954118 Tokens per Sec:    20156, Lr: 0.000300\n",
            "2019-11-26 10:16:29,806 Epoch  85: total training loss 490.10\n",
            "2019-11-26 10:16:29,807 EPOCH 86\n",
            "2019-11-26 10:16:38,105 Epoch  86 Step:    25700 Batch Loss:     1.980250 Tokens per Sec:    19677, Lr: 0.000300\n",
            "2019-11-26 10:16:49,979 Epoch  86 Step:    25800 Batch Loss:     1.850802 Tokens per Sec:    19588, Lr: 0.000300\n",
            "2019-11-26 10:17:01,851 Epoch  86 Step:    25900 Batch Loss:     1.356458 Tokens per Sec:    19631, Lr: 0.000300\n",
            "2019-11-26 10:17:05,820 Epoch  86: total training loss 488.20\n",
            "2019-11-26 10:17:05,820 EPOCH 87\n",
            "2019-11-26 10:17:13,827 Epoch  87 Step:    26000 Batch Loss:     1.764550 Tokens per Sec:    19503, Lr: 0.000300\n",
            "2019-11-26 10:17:44,489 Example #0\n",
            "2019-11-26 10:17:44,489 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 10:17:44,489 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 10:17:44,489 \tHypothesis: Inkosi uMbongeleni Zondi wayengumkhawulo wobambiswano lwesimo sobuningi bobunikazi bami , kumele sungule , senze ngcono indlela yokuthuthukisa abantu bakhe .\n",
            "2019-11-26 10:17:44,489 Example #1\n",
            "2019-11-26 10:17:44,489 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 10:17:44,489 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 10:17:44,490 \tHypothesis: Kusukela ekuqaleni kwezinga lokuphatha umphakathi wethu wentando yeningi , senze ukuthi sikwazi ukuqhubeka nomphakathi wethu othinta abantu abanamakhono ahlukile ngokushintshana .\n",
            "2019-11-26 10:17:44,490 Example #2\n",
            "2019-11-26 10:17:44,490 \tSource:     Information about government services\n",
            "2019-11-26 10:17:44,490 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 10:17:44,490 \tHypothesis: Ulwazi ngezinkonzo zikaHulumeni\n",
            "2019-11-26 10:17:44,490 Example #3\n",
            "2019-11-26 10:17:44,490 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 10:17:44,490 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 10:17:44,490 \tHypothesis: Ukwakhiwa komuntu ophila kubantu kanye nabantu abanokukhula emphakathini abakhona abanamakhono alinganayo , ikhwalithi , ubudlelwane kanye nobuqotho bezindlu .\n",
            "2019-11-26 10:17:44,490 Validation result (greedy) at epoch  87, step    26000: bleu:   7.76, loss: 83881.3047, ppl:  13.0541, duration: 30.6628s\n",
            "2019-11-26 10:17:56,467 Epoch  87 Step:    26100 Batch Loss:     1.663012 Tokens per Sec:    19561, Lr: 0.000300\n",
            "2019-11-26 10:18:08,342 Epoch  87 Step:    26200 Batch Loss:     1.804496 Tokens per Sec:    19629, Lr: 0.000300\n",
            "2019-11-26 10:18:12,483 Epoch  87: total training loss 483.13\n",
            "2019-11-26 10:18:12,483 EPOCH 88\n",
            "2019-11-26 10:18:20,332 Epoch  88 Step:    26300 Batch Loss:     1.615439 Tokens per Sec:    18912, Lr: 0.000300\n",
            "2019-11-26 10:18:32,359 Epoch  88 Step:    26400 Batch Loss:     1.575462 Tokens per Sec:    19802, Lr: 0.000300\n",
            "2019-11-26 10:18:44,335 Epoch  88 Step:    26500 Batch Loss:     1.855882 Tokens per Sec:    19878, Lr: 0.000300\n",
            "2019-11-26 10:18:48,541 Epoch  88: total training loss 481.87\n",
            "2019-11-26 10:18:48,541 EPOCH 89\n",
            "2019-11-26 10:18:56,322 Epoch  89 Step:    26600 Batch Loss:     1.740746 Tokens per Sec:    19536, Lr: 0.000300\n",
            "2019-11-26 10:19:08,231 Epoch  89 Step:    26700 Batch Loss:     1.642559 Tokens per Sec:    19445, Lr: 0.000300\n",
            "2019-11-26 10:19:20,174 Epoch  89 Step:    26800 Batch Loss:     1.522159 Tokens per Sec:    19755, Lr: 0.000300\n",
            "2019-11-26 10:19:24,483 Epoch  89: total training loss 480.09\n",
            "2019-11-26 10:19:24,483 EPOCH 90\n",
            "2019-11-26 10:19:32,147 Epoch  90 Step:    26900 Batch Loss:     1.487954 Tokens per Sec:    19566, Lr: 0.000300\n",
            "2019-11-26 10:19:44,011 Epoch  90 Step:    27000 Batch Loss:     1.208484 Tokens per Sec:    19814, Lr: 0.000300\n",
            "2019-11-26 10:19:55,951 Epoch  90 Step:    27100 Batch Loss:     2.000833 Tokens per Sec:    19378, Lr: 0.000300\n",
            "2019-11-26 10:20:00,510 Epoch  90: total training loss 478.16\n",
            "2019-11-26 10:20:00,510 EPOCH 91\n",
            "2019-11-26 10:20:07,924 Epoch  91 Step:    27200 Batch Loss:     1.013175 Tokens per Sec:    19604, Lr: 0.000300\n",
            "2019-11-26 10:20:19,870 Epoch  91 Step:    27300 Batch Loss:     1.662930 Tokens per Sec:    19765, Lr: 0.000300\n",
            "2019-11-26 10:20:31,872 Epoch  91 Step:    27400 Batch Loss:     1.845692 Tokens per Sec:    20116, Lr: 0.000300\n",
            "2019-11-26 10:20:36,268 Epoch  91: total training loss 471.01\n",
            "2019-11-26 10:20:36,268 EPOCH 92\n",
            "2019-11-26 10:20:43,908 Epoch  92 Step:    27500 Batch Loss:     1.503908 Tokens per Sec:    20152, Lr: 0.000300\n",
            "2019-11-26 10:20:55,739 Epoch  92 Step:    27600 Batch Loss:     1.962163 Tokens per Sec:    19499, Lr: 0.000300\n",
            "2019-11-26 10:21:07,569 Epoch  92 Step:    27700 Batch Loss:     1.684871 Tokens per Sec:    19685, Lr: 0.000300\n",
            "2019-11-26 10:21:11,984 Epoch  92: total training loss 470.55\n",
            "2019-11-26 10:21:11,984 EPOCH 93\n",
            "2019-11-26 10:21:19,602 Epoch  93 Step:    27800 Batch Loss:     1.661454 Tokens per Sec:    19930, Lr: 0.000300\n",
            "2019-11-26 10:21:31,435 Epoch  93 Step:    27900 Batch Loss:     1.802329 Tokens per Sec:    19435, Lr: 0.000300\n",
            "2019-11-26 10:21:43,378 Epoch  93 Step:    28000 Batch Loss:     1.771595 Tokens per Sec:    19808, Lr: 0.000300\n",
            "2019-11-26 10:22:14,088 Example #0\n",
            "2019-11-26 10:22:14,089 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 10:22:14,089 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 10:22:14,089 \tHypothesis: Inkosi uMbongeleni Zondi yasingatha isimanje sobambiswano mayelana nokusebenzisana nenkosi yeInkosi kumele , ngikhombisa ukusungula isimo sabo sokuthuthukisa abantu bakhe .\n",
            "2019-11-26 10:22:14,089 Example #1\n",
            "2019-11-26 10:22:14,089 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 10:22:14,089 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 10:22:14,089 \tHypothesis: Ekuqaleni kwethu sokwakha umphakathi wethu wentando yeningi , sabe sesifuna ukuthi senze umphakathi oncomekayo wumphakathi onkana ngabantu .\n",
            "2019-11-26 10:22:14,089 Example #2\n",
            "2019-11-26 10:22:14,089 \tSource:     Information about government services\n",
            "2019-11-26 10:22:14,089 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 10:22:14,089 \tHypothesis: Ulwazi ngezinkonzo zikaHulumeni\n",
            "2019-11-26 10:22:14,089 Example #3\n",
            "2019-11-26 10:22:14,090 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 10:22:14,090 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 10:22:14,090 \tHypothesis: Ukwakhiwa komuntu ophila kubantu kanye nosizo olukhulu umphakathi onikezwa wubuqotho , ikhwalithi , ukuqina kanye nokuzinza kwezinga eliphezulu .\n",
            "2019-11-26 10:22:14,090 Validation result (greedy) at epoch  93, step    28000: bleu:   8.05, loss: 83677.6953, ppl:  12.9730, duration: 30.7119s\n",
            "2019-11-26 10:22:18,550 Epoch  93: total training loss 467.49\n",
            "2019-11-26 10:22:18,550 EPOCH 94\n",
            "2019-11-26 10:22:26,180 Epoch  94 Step:    28100 Batch Loss:     1.172976 Tokens per Sec:    19793, Lr: 0.000300\n",
            "2019-11-26 10:22:38,022 Epoch  94 Step:    28200 Batch Loss:     1.482410 Tokens per Sec:    19727, Lr: 0.000300\n",
            "2019-11-26 10:22:49,991 Epoch  94 Step:    28300 Batch Loss:     1.604124 Tokens per Sec:    19438, Lr: 0.000300\n",
            "2019-11-26 10:22:54,584 Epoch  94: total training loss 468.09\n",
            "2019-11-26 10:22:54,584 EPOCH 95\n",
            "2019-11-26 10:23:01,914 Epoch  95 Step:    28400 Batch Loss:     1.744956 Tokens per Sec:    19525, Lr: 0.000300\n",
            "2019-11-26 10:23:13,755 Epoch  95 Step:    28500 Batch Loss:     1.536762 Tokens per Sec:    19597, Lr: 0.000300\n",
            "2019-11-26 10:23:25,693 Epoch  95 Step:    28600 Batch Loss:     1.570755 Tokens per Sec:    19561, Lr: 0.000300\n",
            "2019-11-26 10:23:30,566 Epoch  95: total training loss 464.36\n",
            "2019-11-26 10:23:30,567 EPOCH 96\n",
            "2019-11-26 10:23:37,781 Epoch  96 Step:    28700 Batch Loss:     1.199472 Tokens per Sec:    19933, Lr: 0.000300\n",
            "2019-11-26 10:23:49,696 Epoch  96 Step:    28800 Batch Loss:     1.787857 Tokens per Sec:    19700, Lr: 0.000300\n",
            "2019-11-26 10:24:01,596 Epoch  96 Step:    28900 Batch Loss:     1.535628 Tokens per Sec:    19773, Lr: 0.000300\n",
            "2019-11-26 10:24:06,232 Epoch  96: total training loss 458.38\n",
            "2019-11-26 10:24:06,232 EPOCH 97\n",
            "2019-11-26 10:24:13,471 Epoch  97 Step:    29000 Batch Loss:     1.884878 Tokens per Sec:    19271, Lr: 0.000300\n",
            "2019-11-26 10:24:25,394 Epoch  97 Step:    29100 Batch Loss:     1.686145 Tokens per Sec:    20063, Lr: 0.000300\n",
            "2019-11-26 10:24:37,307 Epoch  97 Step:    29200 Batch Loss:     1.741057 Tokens per Sec:    19447, Lr: 0.000300\n",
            "2019-11-26 10:24:42,160 Epoch  97: total training loss 460.41\n",
            "2019-11-26 10:24:42,160 EPOCH 98\n",
            "2019-11-26 10:24:49,214 Epoch  98 Step:    29300 Batch Loss:     1.070387 Tokens per Sec:    19570, Lr: 0.000300\n",
            "2019-11-26 10:25:01,228 Epoch  98 Step:    29400 Batch Loss:     1.681792 Tokens per Sec:    19631, Lr: 0.000300\n",
            "2019-11-26 10:25:13,087 Epoch  98 Step:    29500 Batch Loss:     1.264918 Tokens per Sec:    19928, Lr: 0.000300\n",
            "2019-11-26 10:25:18,055 Epoch  98: total training loss 457.99\n",
            "2019-11-26 10:25:18,055 EPOCH 99\n",
            "2019-11-26 10:25:24,985 Epoch  99 Step:    29600 Batch Loss:     1.464941 Tokens per Sec:    19626, Lr: 0.000300\n",
            "2019-11-26 10:25:36,944 Epoch  99 Step:    29700 Batch Loss:     1.598763 Tokens per Sec:    20027, Lr: 0.000300\n",
            "2019-11-26 10:25:48,797 Epoch  99 Step:    29800 Batch Loss:     1.752842 Tokens per Sec:    19404, Lr: 0.000300\n",
            "2019-11-26 10:25:54,031 Epoch  99: total training loss 458.93\n",
            "2019-11-26 10:25:54,032 EPOCH 100\n",
            "2019-11-26 10:26:00,759 Epoch 100 Step:    29900 Batch Loss:     1.560231 Tokens per Sec:    19783, Lr: 0.000300\n",
            "2019-11-26 10:26:12,698 Epoch 100 Step:    30000 Batch Loss:     1.418556 Tokens per Sec:    19722, Lr: 0.000300\n",
            "2019-11-26 10:26:43,325 Example #0\n",
            "2019-11-26 10:26:43,325 \tSource:     Inkosi Mbongeleni Zondi was the ultimate model of the kind of partnerships an Inkosi should , nowadays , establish in order to improve the lot of his people .\n",
            "2019-11-26 10:26:43,326 \tReference:  Inkosi uMbongeleni Zondi wayewuphawo oluhle oluphemba ubudlelwano , okuwuphawu oluhle olukhomba ukuthi inkosi kufanele kube umuntu onjani kulezi zinsuku ekuthuthukiseni izimpilo zabantu bayo .\n",
            "2019-11-26 10:26:43,326 \tHypothesis: Inkosi uMbongeleni Zondi yasingatha isimodeli somkhankaso wokusebenza kwenkosi yami kumele , ngikhumbule , sakha ukuze sakhe isethulo sabantu bakhe .\n",
            "2019-11-26 10:26:43,326 Example #1\n",
            "2019-11-26 10:26:43,326 \tSource:     From the very beginning of the construction of our democratic society , we have insisted that we sought a people-centred society characterised by a people-driven process of change .\n",
            "2019-11-26 10:26:43,326 \tReference:  Kusukela ekuqaleni kokwakha umphakathi wethu obuswa ngentando yeningi , siqinisekise ukuthi sibheke umphakathi osekelwe kubantu ovezwa ngabantu abaphokophelele ushintsho .\n",
            "2019-11-26 10:26:43,326 \tHypothesis: Kusukela ekuqaleni kwethu ukuphathwa komphakathi wethu wentando yeningi , sesiphokophelwe abantu bakithi ngokugcwele uhlelo lokushintsha kwabantu .\n",
            "2019-11-26 10:26:43,326 Example #2\n",
            "2019-11-26 10:26:43,326 \tSource:     Information about government services\n",
            "2019-11-26 10:26:43,326 \tReference:  Ulwazi ngezinkonzo kahulumeni\n",
            "2019-11-26 10:26:43,326 \tHypothesis: Ulwazi ngezinkonzo zikaHulumeni\n",
            "2019-11-26 10:26:43,326 Example #3\n",
            "2019-11-26 10:26:43,326 \tSource:     The creation of a people centred and people driven public service which is characterised by equity , quality , timeousness and a strong code of ethics .\n",
            "2019-11-26 10:26:43,326 \tReference:  Ukwakha imisebenzi esekelwe kubantu negqugquzelwa abantu evezwa wukulingana kwenani lobulili emsebenzini , ikhwalithi , ukwenza izinto ngesikhathi nendlela enhla yokuziphatha .\n",
            "2019-11-26 10:26:43,327 \tHypothesis: Ukwakhiwa kwabantu abaningi kwase kugxile kubantu abancishwe amathuba emisebenzi kahulumeni , ikhwalithi , izinkulungwane , ukuqinisa kanye nokuzinza kwehle kakhulu .\n",
            "2019-11-26 10:26:43,327 Validation result (greedy) at epoch 100, step    30000: bleu:   8.02, loss: 84230.3672, ppl:  13.1945, duration: 30.6287s\n",
            "2019-11-26 10:26:55,173 Epoch 100 Step:    30100 Batch Loss:     1.756347 Tokens per Sec:    19383, Lr: 0.000300\n",
            "2019-11-26 10:27:00,604 Epoch 100: total training loss 455.76\n",
            "2019-11-26 10:27:00,604 Training ended after 100 epochs.\n",
            "2019-11-26 10:27:00,604 Best validation result (greedy) at step    22000:  12.80 ppl.\n",
            "2019-11-26 10:27:24,217  dev bleu:   7.44 [Beam search decoding with beam size = 5 and alpha = 1.0]\n",
            "2019-11-26 10:27:24,217 Translations saved to: models/enzu_transformer/00022000.hyps.dev\n",
            "2019-11-26 10:28:12,696 test bleu:   1.96 [Beam search decoding with beam size = 5 and alpha = 1.0]\n",
            "2019-11-26 10:28:12,698 Translations saved to: models/enzu_transformer/00022000.hyps.test\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "MBoDS09JM807",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 54
        },
        "outputId": "9074bd2b-0405-413d-ff73-5a4dbd3e5fe3"
      },
      "source": [
        "# Copy the created models from the notebook storage to google drive for persistant storage \n",
        "!cp -r joeynmt/models/${src}${tgt}_transformer/* \"/content/drive/My Drive/masakhane/en-zu-baseline/models/enzu_transformer/\""
      ],
      "execution_count": 22,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "cp: cannot create symbolic link '/content/drive/My Drive/masakhane/en-zu-baseline/models/enzu_transformer/best.ckpt': Function not implemented\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "n94wlrCjVc17",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 269
        },
        "outputId": "e06640fd-0167-48cf-ceb3-1efaa2600fe7"
      },
      "source": [
        "# Output our validation accuracy\n",
        "! cat \"$gdrive_path/models/${src}${tgt}_transformer/validations.txt\""
      ],
      "execution_count": 23,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "Steps: 2000\tLoss: 131604.17188\tPPL: 56.30343\tbleu: 0.42629\tLR: 0.00030000\t*\n",
            "Steps: 4000\tLoss: 109456.84375\tPPL: 28.57208\tbleu: 1.32300\tLR: 0.00030000\t*\n",
            "Steps: 6000\tLoss: 99408.10938\tPPL: 21.00286\tbleu: 2.23503\tLR: 0.00030000\t*\n",
            "Steps: 8000\tLoss: 93906.07812\tPPL: 17.74570\tbleu: 3.49069\tLR: 0.00030000\t*\n",
            "Steps: 10000\tLoss: 89621.10938\tPPL: 15.56312\tbleu: 4.48964\tLR: 0.00030000\t*\n",
            "Steps: 12000\tLoss: 87071.18750\tPPL: 14.39391\tbleu: 5.10651\tLR: 0.00030000\t*\n",
            "Steps: 14000\tLoss: 85434.86719\tPPL: 13.69031\tbleu: 5.69149\tLR: 0.00030000\t*\n",
            "Steps: 16000\tLoss: 84317.06250\tPPL: 13.22954\tbleu: 6.04887\tLR: 0.00030000\t*\n",
            "Steps: 18000\tLoss: 83865.21875\tPPL: 13.04772\tbleu: 6.45527\tLR: 0.00030000\t*\n",
            "Steps: 20000\tLoss: 83562.08594\tPPL: 12.92714\tbleu: 7.12424\tLR: 0.00030000\t*\n",
            "Steps: 22000\tLoss: 83251.73438\tPPL: 12.80484\tbleu: 7.26507\tLR: 0.00030000\t*\n",
            "Steps: 24000\tLoss: 83550.48438\tPPL: 12.92255\tbleu: 7.65029\tLR: 0.00030000\t\n",
            "Steps: 26000\tLoss: 83881.30469\tPPL: 13.05415\tbleu: 7.76181\tLR: 0.00030000\t\n",
            "Steps: 28000\tLoss: 83677.69531\tPPL: 12.97299\tbleu: 8.05338\tLR: 0.00030000\t\n",
            "Steps: 30000\tLoss: 84230.36719\tPPL: 13.19446\tbleu: 8.02490\tLR: 0.00030000\t\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "colab_type": "code",
        "id": "66WhRE9lIhoD",
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 67
        },
        "outputId": "294b745a-db17-4063-87d3-64b66290ee78"
      },
      "source": [
        "# Test our model\n",
        "! cd joeynmt; python3 -m joeynmt test \"$gdrive_path/models/${src}${tgt}_transformer/config.yaml\""
      ],
      "execution_count": 24,
      "outputs": [
        {
          "output_type": "stream",
          "text": [
            "2019-11-26 11:11:34,962 Hello! This is Joey-NMT.\n",
            "2019-11-26 11:12:00,597  dev bleu:   7.44 [Beam search decoding with beam size = 5 and alpha = 1.0]\n",
            "2019-11-26 11:12:47,530 test bleu:   1.96 [Beam search decoding with beam size = 5 and alpha = 1.0]\n"
          ],
          "name": "stdout"
        }
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "-U-0e3pJZE4l",
        "colab_type": "code",
        "colab": {}
      },
      "source": [
        ""
      ],
      "execution_count": 0,
      "outputs": []
    }
  ]
}